github.com/castai/kvisor@v1.7.1-0.20240516114728-b3572a2607b5/pkg/ebpftracer/types.go (about) 1 package ebpftracer 2 3 type ArgType uint8 4 5 const ( 6 noneT ArgType = iota 7 intT 8 uintT 9 longT 10 ulongT 11 offT 12 modeT 13 devT 14 sizeT 15 pointerT 16 strT 17 strArrT 18 sockAddrT 19 bytesT 20 u16T 21 credT 22 intArr2T 23 uint64ArrT 24 u8T 25 timespecT 26 tupleT 27 ) 28 29 // These types don't match the ones defined in the ebpf code since they are not being used by syscalls arguments. 30 // They have their own set of value to avoid collision in the future. 31 const ( 32 argsArrT ArgType = iota + 0x80 33 boolT 34 ) 35 36 func getParamType(paramType string) ArgType { 37 switch paramType { 38 case "int", "pid_t", "uid_t", "gid_t", "mqd_t", "clockid_t", "const clockid_t", "key_t", "key_serial_t", "timer_t": 39 return intT 40 case "unsigned int", "u32": 41 return uintT 42 case "long": 43 return longT 44 case "unsigned long", "u64": 45 return ulongT 46 case "bool": 47 return boolT 48 case "off_t", "loff_t": 49 return offT 50 case "mode_t": 51 return modeT 52 case "dev_t": 53 return devT 54 case "size_t": 55 return sizeT 56 case "void*", "const void*": 57 return pointerT 58 case "char*", "const char*": 59 return strT 60 case "const char*const*": // used by execve(at) argv and env 61 return strArrT 62 case "const char**": // used by sched_process_exec argv and envp 63 return argsArrT 64 case "const struct sockaddr*", "struct sockaddr*": 65 return sockAddrT 66 case "bytes": 67 return bytesT 68 case "int[2]": 69 return intArr2T 70 case "slim_cred_t": 71 return credT 72 case "umode_t": 73 return u16T 74 case "u8": 75 return u8T 76 case "unsigned long[]", "[]HookedSymbolData": 77 return uint64ArrT 78 case "struct timespec*", "const struct timespec*": 79 return timespecT 80 case "tuple": 81 return tupleT 82 default: 83 // Default to pointer (printed as hex) for unsupported types 84 return pointerT 85 } 86 }