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

     1  #ifndef __COMMON_CONSTS_H__
     2  #define __COMMON_CONSTS_H__
     3  
     4  // clang-format off
     5  
     6  #include <vmlinux.h>
     7  
     8  #define MAX_PERCPU_BUFSIZE (1 << 15)  // set by the kernel as an upper bound
     9  #define MAX_STRING_SIZE    4096       // same as PATH_MAX
    10  #define MAX_BYTES_ARR_SIZE 4096       // max size of bytes array (arbitrarily chosen)
    11  #define MAX_STR_FILTER_SIZE 16        // bounded to size of the compared values (comm)
    12  #define MAX_BIN_PATH_SIZE   256       // max binary path size
    13  #define FILE_MAGIC_HDR_SIZE 32        // magic_write: bytes to save from a file's header
    14  #define FILE_MAGIC_MASK     31        // magic_write: mask used for verifier boundaries
    15  #define NET_SEQ_OPS_SIZE    4         // print_net_seq_ops: struct size - TODO: replace with uprobe argument
    16  #define NET_SEQ_OPS_TYPES   6         // print_net_seq_ops: argument size - TODO: replace with uprobe argument
    17  #define MAX_KSYM_NAME_SIZE  64
    18  #define UPROBE_MAGIC_NUMBER 20220829
    19  #define ARGS_BUF_SIZE       32000
    20  #define SEND_META_SIZE      28
    21  
    22  #define MAX_MEM_DUMP_SIZE   127
    23  
    24  #define MAX_STR_ARR_ELEM      38 // TODO: turn this into global variables set w/ libbpfgo
    25  #define MAX_ARGS_STR_ARR_ELEM 15
    26  #define MAX_PATH_PREF_SIZE    64
    27  #define MAX_PATH_COMPONENTS   20
    28  #define MAX_BIN_CHUNKS        110
    29  
    30  #define CAPTURE_IFACE (1 << 0)
    31  #define TRACE_IFACE   (1 << 1)
    32  
    33  #define OPT_EXEC_ENV              (1 << 0)
    34  #define OPT_CAPTURE_FILES_WRITE   (1 << 1)
    35  #define OPT_EXTRACT_DYN_CODE      (1 << 2)
    36  #define OPT_CAPTURE_STACK_TRACES  (1 << 3)
    37  #define OPT_CAPTURE_MODULES       (1 << 4)
    38  #define OPT_CGROUP_V1             (1 << 5)
    39  #define OPT_TRANSLATE_FD_FILEPATH (1 << 6)
    40  #define OPT_CAPTURE_BPF           (1 << 7)
    41  #define OPT_CAPTURE_FILES_READ    (1 << 8)
    42  #define OPT_FORK_PROCTREE         (1 << 9)
    43  
    44  #define STDIN  0
    45  #define STDOUT 1
    46  #define STDERR 2
    47  
    48  enum buf_idx_e
    49  {
    50      STRING_BUF_IDX,
    51      FILE_BUF_IDX,
    52      MAX_BUFFERS
    53  };
    54  
    55  // clang-format on
    56  
    57  typedef struct {
    58      // id of the pid namespace the node host PID will be translated to
    59      u64 pid_ns_id;
    60      u64 flow_sample_submit_interval_seconds;
    61  } global_config_t;
    62  
    63  volatile const global_config_t global_config;
    64  
    65  #endif