github.com/cilium/ebpf@v0.15.1-0.20240517100537-8079b37aa138/internal/unix/types_linux.go (about) 1 //go:build linux 2 3 package unix 4 5 import ( 6 "syscall" 7 8 linux "golang.org/x/sys/unix" 9 ) 10 11 const ( 12 ENOENT = linux.ENOENT 13 EEXIST = linux.EEXIST 14 EAGAIN = linux.EAGAIN 15 ENOSPC = linux.ENOSPC 16 EINVAL = linux.EINVAL 17 EPOLLIN = linux.EPOLLIN 18 EINTR = linux.EINTR 19 EPERM = linux.EPERM 20 ESRCH = linux.ESRCH 21 ENODEV = linux.ENODEV 22 EBADF = linux.EBADF 23 E2BIG = linux.E2BIG 24 EFAULT = linux.EFAULT 25 EACCES = linux.EACCES 26 EILSEQ = linux.EILSEQ 27 EOPNOTSUPP = linux.EOPNOTSUPP 28 ESTALE = linux.ESTALE 29 ) 30 31 const ( 32 BPF_F_NO_PREALLOC = linux.BPF_F_NO_PREALLOC 33 BPF_F_NUMA_NODE = linux.BPF_F_NUMA_NODE 34 BPF_F_RDONLY = linux.BPF_F_RDONLY 35 BPF_F_WRONLY = linux.BPF_F_WRONLY 36 BPF_F_RDONLY_PROG = linux.BPF_F_RDONLY_PROG 37 BPF_F_WRONLY_PROG = linux.BPF_F_WRONLY_PROG 38 BPF_F_SLEEPABLE = linux.BPF_F_SLEEPABLE 39 BPF_F_XDP_HAS_FRAGS = linux.BPF_F_XDP_HAS_FRAGS 40 BPF_F_MMAPABLE = linux.BPF_F_MMAPABLE 41 BPF_F_INNER_MAP = linux.BPF_F_INNER_MAP 42 BPF_F_KPROBE_MULTI_RETURN = linux.BPF_F_KPROBE_MULTI_RETURN 43 BPF_F_UPROBE_MULTI_RETURN = linux.BPF_F_UPROBE_MULTI_RETURN 44 BPF_F_LOCK = linux.BPF_F_LOCK 45 BPF_OBJ_NAME_LEN = linux.BPF_OBJ_NAME_LEN 46 BPF_TAG_SIZE = linux.BPF_TAG_SIZE 47 BPF_RINGBUF_BUSY_BIT = linux.BPF_RINGBUF_BUSY_BIT 48 BPF_RINGBUF_DISCARD_BIT = linux.BPF_RINGBUF_DISCARD_BIT 49 BPF_RINGBUF_HDR_SZ = linux.BPF_RINGBUF_HDR_SZ 50 SYS_BPF = linux.SYS_BPF 51 F_DUPFD_CLOEXEC = linux.F_DUPFD_CLOEXEC 52 EPOLL_CTL_ADD = linux.EPOLL_CTL_ADD 53 EPOLL_CLOEXEC = linux.EPOLL_CLOEXEC 54 O_CLOEXEC = linux.O_CLOEXEC 55 O_NONBLOCK = linux.O_NONBLOCK 56 PROT_NONE = linux.PROT_NONE 57 PROT_READ = linux.PROT_READ 58 PROT_WRITE = linux.PROT_WRITE 59 MAP_ANON = linux.MAP_ANON 60 MAP_SHARED = linux.MAP_SHARED 61 MAP_PRIVATE = linux.MAP_PRIVATE 62 PERF_ATTR_SIZE_VER1 = linux.PERF_ATTR_SIZE_VER1 63 PERF_TYPE_SOFTWARE = linux.PERF_TYPE_SOFTWARE 64 PERF_TYPE_TRACEPOINT = linux.PERF_TYPE_TRACEPOINT 65 PERF_COUNT_SW_BPF_OUTPUT = linux.PERF_COUNT_SW_BPF_OUTPUT 66 PERF_EVENT_IOC_DISABLE = linux.PERF_EVENT_IOC_DISABLE 67 PERF_EVENT_IOC_ENABLE = linux.PERF_EVENT_IOC_ENABLE 68 PERF_EVENT_IOC_SET_BPF = linux.PERF_EVENT_IOC_SET_BPF 69 PerfBitWatermark = linux.PerfBitWatermark 70 PerfBitWriteBackward = linux.PerfBitWriteBackward 71 PERF_SAMPLE_RAW = linux.PERF_SAMPLE_RAW 72 PERF_FLAG_FD_CLOEXEC = linux.PERF_FLAG_FD_CLOEXEC 73 RLIM_INFINITY = linux.RLIM_INFINITY 74 RLIMIT_MEMLOCK = linux.RLIMIT_MEMLOCK 75 BPF_STATS_RUN_TIME = linux.BPF_STATS_RUN_TIME 76 PERF_RECORD_LOST = linux.PERF_RECORD_LOST 77 PERF_RECORD_SAMPLE = linux.PERF_RECORD_SAMPLE 78 AT_FDCWD = linux.AT_FDCWD 79 RENAME_NOREPLACE = linux.RENAME_NOREPLACE 80 SO_ATTACH_BPF = linux.SO_ATTACH_BPF 81 SO_DETACH_BPF = linux.SO_DETACH_BPF 82 SOL_SOCKET = linux.SOL_SOCKET 83 SIGPROF = linux.SIGPROF 84 SIG_BLOCK = linux.SIG_BLOCK 85 SIG_UNBLOCK = linux.SIG_UNBLOCK 86 EM_NONE = linux.EM_NONE 87 EM_BPF = linux.EM_BPF 88 BPF_FS_MAGIC = linux.BPF_FS_MAGIC 89 TRACEFS_MAGIC = linux.TRACEFS_MAGIC 90 DEBUGFS_MAGIC = linux.DEBUGFS_MAGIC 91 BPF_RB_NO_WAKEUP = linux.BPF_RB_NO_WAKEUP 92 BPF_RB_FORCE_WAKEUP = linux.BPF_RB_FORCE_WAKEUP 93 ) 94 95 type Statfs_t = linux.Statfs_t 96 type Stat_t = linux.Stat_t 97 type Rlimit = linux.Rlimit 98 type Signal = linux.Signal 99 type Sigset_t = linux.Sigset_t 100 type PerfEventMmapPage = linux.PerfEventMmapPage 101 type EpollEvent = linux.EpollEvent 102 type PerfEventAttr = linux.PerfEventAttr 103 type Utsname = linux.Utsname 104 type CPUSet = linux.CPUSet 105 106 func Syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) { 107 return linux.Syscall(trap, a1, a2, a3) 108 } 109 110 func PthreadSigmask(how int, set, oldset *Sigset_t) error { 111 return linux.PthreadSigmask(how, set, oldset) 112 } 113 114 func FcntlInt(fd uintptr, cmd, arg int) (int, error) { 115 return linux.FcntlInt(fd, cmd, arg) 116 } 117 118 func IoctlSetInt(fd int, req uint, value int) error { 119 return linux.IoctlSetInt(fd, req, value) 120 } 121 122 func Statfs(path string, buf *Statfs_t) (err error) { 123 return linux.Statfs(path, buf) 124 } 125 126 func Close(fd int) (err error) { 127 return linux.Close(fd) 128 } 129 130 func EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) { 131 return linux.EpollWait(epfd, events, msec) 132 } 133 134 func EpollCtl(epfd int, op int, fd int, event *EpollEvent) (err error) { 135 return linux.EpollCtl(epfd, op, fd, event) 136 } 137 138 func Eventfd(initval uint, flags int) (fd int, err error) { 139 return linux.Eventfd(initval, flags) 140 } 141 142 func Write(fd int, p []byte) (n int, err error) { 143 return linux.Write(fd, p) 144 } 145 146 func EpollCreate1(flag int) (fd int, err error) { 147 return linux.EpollCreate1(flag) 148 } 149 150 func SetNonblock(fd int, nonblocking bool) (err error) { 151 return linux.SetNonblock(fd, nonblocking) 152 } 153 154 func Mmap(fd int, offset int64, length int, prot int, flags int) (data []byte, err error) { 155 return linux.Mmap(fd, offset, length, prot, flags) 156 } 157 158 func Munmap(b []byte) (err error) { 159 return linux.Munmap(b) 160 } 161 162 func PerfEventOpen(attr *PerfEventAttr, pid int, cpu int, groupFd int, flags int) (fd int, err error) { 163 return linux.PerfEventOpen(attr, pid, cpu, groupFd, flags) 164 } 165 166 func Uname(buf *Utsname) (err error) { 167 return linux.Uname(buf) 168 } 169 170 func Getpid() int { 171 return linux.Getpid() 172 } 173 174 func Gettid() int { 175 return linux.Gettid() 176 } 177 178 func Tgkill(tgid int, tid int, sig syscall.Signal) (err error) { 179 return linux.Tgkill(tgid, tid, sig) 180 } 181 182 func BytePtrFromString(s string) (*byte, error) { 183 return linux.BytePtrFromString(s) 184 } 185 186 func ByteSliceToString(s []byte) string { 187 return linux.ByteSliceToString(s) 188 } 189 190 func Renameat2(olddirfd int, oldpath string, newdirfd int, newpath string, flags uint) error { 191 return linux.Renameat2(olddirfd, oldpath, newdirfd, newpath, flags) 192 } 193 194 func Prlimit(pid, resource int, new, old *Rlimit) error { 195 return linux.Prlimit(pid, resource, new, old) 196 } 197 198 func Open(path string, mode int, perm uint32) (int, error) { 199 return linux.Open(path, mode, perm) 200 } 201 202 func Fstat(fd int, stat *Stat_t) error { 203 return linux.Fstat(fd, stat) 204 } 205 206 func SetsockoptInt(fd, level, opt, value int) error { 207 return linux.SetsockoptInt(fd, level, opt, value) 208 } 209 210 func SchedSetaffinity(pid int, set *CPUSet) error { 211 return linux.SchedSetaffinity(pid, set) 212 } 213 214 func SchedGetaffinity(pid int, set *CPUSet) error { 215 return linux.SchedGetaffinity(pid, set) 216 }