github.com/castai/kvisor@v1.7.1-0.20240516114728-b3572a2607b5/pkg/ebpftracer/c/headers/vmlinux_flavors.h (about)

     1  #ifndef __VMLINUX_FLAVORS_H__
     2  #define __VMLINUX_FLAVORS_H__
     3  
     4  #include <vmlinux.h>
     5  
     6  ;
     7  ; // don't remove: clangd parsing bug https://github.com/clangd/clangd/issues/1167
     8  #pragma clang attribute push(__attribute__((preserve_access_index)), apply_to = record)
     9  
    10  // (struct kernfs_node *)->id was union kernfs_node_id before 5.5
    11  
    12  union kernfs_node_id {
    13      struct {
    14          u32 ino;
    15          u32 generation;
    16      };
    17      u64 id;
    18  };
    19  
    20  struct kernfs_node___older_v55 {
    21      const char *name;
    22      union kernfs_node_id id;
    23  };
    24  
    25  struct kernfs_node___rh8 {
    26      const char *name;
    27      union {
    28          u64 id;
    29          struct {
    30              union kernfs_node_id id;
    31          } rh_kabi_hidden_172;
    32          union {
    33          };
    34      };
    35  };
    36  
    37  // commit bf9765145b85 ("sock: Make sk_protocol a 16-bit value")
    38  
    39  // clang-format off
    40  
    41  struct sock___old {
    42      struct sock_common  __sk_common;
    43      unsigned int        __sk_flags_offset[0];
    44      unsigned int        sk_padding : 1,
    45                          sk_kern_sock : 1,
    46                          sk_no_check_tx : 1,
    47                          sk_no_check_rx : 1,
    48                          sk_userlocks : 4,
    49                          sk_protocol  : 8,
    50                          sk_type      : 16;
    51      u16                 sk_gso_max_segs;
    52  };
    53  
    54  // clang-format on
    55  
    56  // support bpf_core_type_exists((task struct)->pids) for kernels < 5.0
    57  
    58  enum pid_type
    59  {
    60      PIDTYPE_PID,
    61      PIDTYPE_PGID,
    62      PIDTYPE_SID,
    63      PIDTYPE_MAX,
    64      __PIDTYPE_TGID
    65  };
    66  
    67  struct pid_link {
    68      struct hlist_node node;
    69      struct pid *pid;
    70  };
    71  
    72  struct task_struct___older_v50 {
    73      struct pid_link pids[PIDTYPE_MAX];
    74  };
    75  
    76  struct trace_probe___v53 {
    77      struct trace_event_call call;
    78  };
    79  
    80  // kernel >= 6.1 kernel_cap_t type change
    81  
    82  struct kernel_cap_struct___older {
    83      __u32 cap[2];
    84  };
    85  
    86  typedef struct kernel_cap_struct___older kernel_cap_t___older;
    87  
    88  // struct module //
    89  
    90  struct module_layout {
    91      void *base;
    92  };
    93  
    94  struct module___older_v64 {
    95      struct module_layout core_layout;
    96  };
    97  
    98  // kernel >= v6.6 inode i_ctime field change
    99  struct inode___older_v66 {
   100      struct timespec64 i_ctime;
   101  };
   102  
   103  ///////////////////
   104  
   105  #pragma clang attribute pop
   106  
   107  #endif