github.com/cilium/ebpf@v0.10.0/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  )
    29  
    30  const (
    31  	BPF_F_NO_PREALLOC         = linux.BPF_F_NO_PREALLOC
    32  	BPF_F_NUMA_NODE           = linux.BPF_F_NUMA_NODE
    33  	BPF_F_RDONLY              = linux.BPF_F_RDONLY
    34  	BPF_F_WRONLY              = linux.BPF_F_WRONLY
    35  	BPF_F_RDONLY_PROG         = linux.BPF_F_RDONLY_PROG
    36  	BPF_F_WRONLY_PROG         = linux.BPF_F_WRONLY_PROG
    37  	BPF_F_SLEEPABLE           = linux.BPF_F_SLEEPABLE
    38  	BPF_F_MMAPABLE            = linux.BPF_F_MMAPABLE
    39  	BPF_F_INNER_MAP           = linux.BPF_F_INNER_MAP
    40  	BPF_F_KPROBE_MULTI_RETURN = linux.BPF_F_KPROBE_MULTI_RETURN
    41  	BPF_OBJ_NAME_LEN          = linux.BPF_OBJ_NAME_LEN
    42  	BPF_TAG_SIZE              = linux.BPF_TAG_SIZE
    43  	BPF_RINGBUF_BUSY_BIT      = linux.BPF_RINGBUF_BUSY_BIT
    44  	BPF_RINGBUF_DISCARD_BIT   = linux.BPF_RINGBUF_DISCARD_BIT
    45  	BPF_RINGBUF_HDR_SZ        = linux.BPF_RINGBUF_HDR_SZ
    46  	SYS_BPF                   = linux.SYS_BPF
    47  	F_DUPFD_CLOEXEC           = linux.F_DUPFD_CLOEXEC
    48  	EPOLL_CTL_ADD             = linux.EPOLL_CTL_ADD
    49  	EPOLL_CLOEXEC             = linux.EPOLL_CLOEXEC
    50  	O_CLOEXEC                 = linux.O_CLOEXEC
    51  	O_NONBLOCK                = linux.O_NONBLOCK
    52  	PROT_READ                 = linux.PROT_READ
    53  	PROT_WRITE                = linux.PROT_WRITE
    54  	MAP_SHARED                = linux.MAP_SHARED
    55  	PERF_ATTR_SIZE_VER1       = linux.PERF_ATTR_SIZE_VER1
    56  	PERF_TYPE_SOFTWARE        = linux.PERF_TYPE_SOFTWARE
    57  	PERF_TYPE_TRACEPOINT      = linux.PERF_TYPE_TRACEPOINT
    58  	PERF_COUNT_SW_BPF_OUTPUT  = linux.PERF_COUNT_SW_BPF_OUTPUT
    59  	PERF_EVENT_IOC_DISABLE    = linux.PERF_EVENT_IOC_DISABLE
    60  	PERF_EVENT_IOC_ENABLE     = linux.PERF_EVENT_IOC_ENABLE
    61  	PERF_EVENT_IOC_SET_BPF    = linux.PERF_EVENT_IOC_SET_BPF
    62  	PerfBitWatermark          = linux.PerfBitWatermark
    63  	PERF_SAMPLE_RAW           = linux.PERF_SAMPLE_RAW
    64  	PERF_FLAG_FD_CLOEXEC      = linux.PERF_FLAG_FD_CLOEXEC
    65  	RLIM_INFINITY             = linux.RLIM_INFINITY
    66  	RLIMIT_MEMLOCK            = linux.RLIMIT_MEMLOCK
    67  	BPF_STATS_RUN_TIME        = linux.BPF_STATS_RUN_TIME
    68  	PERF_RECORD_LOST          = linux.PERF_RECORD_LOST
    69  	PERF_RECORD_SAMPLE        = linux.PERF_RECORD_SAMPLE
    70  	AT_FDCWD                  = linux.AT_FDCWD
    71  	RENAME_NOREPLACE          = linux.RENAME_NOREPLACE
    72  	SO_ATTACH_BPF             = linux.SO_ATTACH_BPF
    73  	SO_DETACH_BPF             = linux.SO_DETACH_BPF
    74  	SOL_SOCKET                = linux.SOL_SOCKET
    75  	SIGPROF                   = linux.SIGPROF
    76  	SIG_BLOCK                 = linux.SIG_BLOCK
    77  	SIG_UNBLOCK               = linux.SIG_UNBLOCK
    78  	EM_NONE                   = linux.EM_NONE
    79  	EM_BPF                    = linux.EM_BPF
    80  )
    81  
    82  type Statfs_t = linux.Statfs_t
    83  type Stat_t = linux.Stat_t
    84  type Rlimit = linux.Rlimit
    85  type Signal = linux.Signal
    86  type Sigset_t = linux.Sigset_t
    87  type PerfEventMmapPage = linux.PerfEventMmapPage
    88  type EpollEvent = linux.EpollEvent
    89  type PerfEventAttr = linux.PerfEventAttr
    90  type Utsname = linux.Utsname
    91  
    92  func Syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) {
    93  	return linux.Syscall(trap, a1, a2, a3)
    94  }
    95  
    96  func PthreadSigmask(how int, set, oldset *Sigset_t) error {
    97  	return linux.PthreadSigmask(how, set, oldset)
    98  }
    99  
   100  func FcntlInt(fd uintptr, cmd, arg int) (int, error) {
   101  	return linux.FcntlInt(fd, cmd, arg)
   102  }
   103  
   104  func IoctlSetInt(fd int, req uint, value int) error {
   105  	return linux.IoctlSetInt(fd, req, value)
   106  }
   107  
   108  func Statfs(path string, buf *Statfs_t) (err error) {
   109  	return linux.Statfs(path, buf)
   110  }
   111  
   112  func Close(fd int) (err error) {
   113  	return linux.Close(fd)
   114  }
   115  
   116  func EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) {
   117  	return linux.EpollWait(epfd, events, msec)
   118  }
   119  
   120  func EpollCtl(epfd int, op int, fd int, event *EpollEvent) (err error) {
   121  	return linux.EpollCtl(epfd, op, fd, event)
   122  }
   123  
   124  func Eventfd(initval uint, flags int) (fd int, err error) {
   125  	return linux.Eventfd(initval, flags)
   126  }
   127  
   128  func Write(fd int, p []byte) (n int, err error) {
   129  	return linux.Write(fd, p)
   130  }
   131  
   132  func EpollCreate1(flag int) (fd int, err error) {
   133  	return linux.EpollCreate1(flag)
   134  }
   135  
   136  func SetNonblock(fd int, nonblocking bool) (err error) {
   137  	return linux.SetNonblock(fd, nonblocking)
   138  }
   139  
   140  func Mmap(fd int, offset int64, length int, prot int, flags int) (data []byte, err error) {
   141  	return linux.Mmap(fd, offset, length, prot, flags)
   142  }
   143  
   144  func Munmap(b []byte) (err error) {
   145  	return linux.Munmap(b)
   146  }
   147  
   148  func PerfEventOpen(attr *PerfEventAttr, pid int, cpu int, groupFd int, flags int) (fd int, err error) {
   149  	return linux.PerfEventOpen(attr, pid, cpu, groupFd, flags)
   150  }
   151  
   152  func Uname(buf *Utsname) (err error) {
   153  	return linux.Uname(buf)
   154  }
   155  
   156  func Getpid() int {
   157  	return linux.Getpid()
   158  }
   159  
   160  func Gettid() int {
   161  	return linux.Gettid()
   162  }
   163  
   164  func Tgkill(tgid int, tid int, sig syscall.Signal) (err error) {
   165  	return linux.Tgkill(tgid, tid, sig)
   166  }
   167  
   168  func BytePtrFromString(s string) (*byte, error) {
   169  	return linux.BytePtrFromString(s)
   170  }
   171  
   172  func ByteSliceToString(s []byte) string {
   173  	return linux.ByteSliceToString(s)
   174  }
   175  
   176  func Renameat2(olddirfd int, oldpath string, newdirfd int, newpath string, flags uint) error {
   177  	return linux.Renameat2(olddirfd, oldpath, newdirfd, newpath, flags)
   178  }
   179  
   180  func Prlimit(pid, resource int, new, old *Rlimit) error {
   181  	return linux.Prlimit(pid, resource, new, old)
   182  }
   183  
   184  func Open(path string, mode int, perm uint32) (int, error) {
   185  	return linux.Open(path, mode, perm)
   186  }
   187  
   188  func Fstat(fd int, stat *Stat_t) error {
   189  	return linux.Fstat(fd, stat)
   190  }