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