| 1 |
|
| 2 |
|
| 3 |
package unix |
| 4 |
|
| 5 |
import ( |
| 6 |
"syscall" |
| 7 |
"unsafe" |
| 8 |
|
| 9 |
linux "golang.org/x/sys/unix" |
| 10 |
) |
| 11 |
|
| 12 |
const ( |
| 13 |
BPF_F_NO_PREALLOC = linux.BPF_F_NO_PREALLOC |
| 14 |
BPF_F_NUMA_NODE = linux.BPF_F_NUMA_NODE |
| 15 |
BPF_F_RDONLY = linux.BPF_F_RDONLY |
| 16 |
BPF_F_WRONLY = linux.BPF_F_WRONLY |
| 17 |
BPF_F_RDONLY_PROG = linux.BPF_F_RDONLY_PROG |
| 18 |
BPF_F_WRONLY_PROG = linux.BPF_F_WRONLY_PROG |
| 19 |
BPF_F_SLEEPABLE = linux.BPF_F_SLEEPABLE |
| 20 |
BPF_F_XDP_HAS_FRAGS = linux.BPF_F_XDP_HAS_FRAGS |
| 21 |
BPF_F_MMAPABLE = linux.BPF_F_MMAPABLE |
| 22 |
BPF_F_INNER_MAP = linux.BPF_F_INNER_MAP |
| 23 |
BPF_F_KPROBE_MULTI_RETURN = linux.BPF_F_KPROBE_MULTI_RETURN |
| 24 |
BPF_F_UPROBE_MULTI_RETURN = linux.BPF_F_UPROBE_MULTI_RETURN |
| 25 |
BPF_F_LOCK = linux.BPF_F_LOCK |
| 26 |
BPF_OBJ_NAME_LEN = linux.BPF_OBJ_NAME_LEN |
| 27 |
BPF_TAG_SIZE = linux.BPF_TAG_SIZE |
| 28 |
BPF_RINGBUF_BUSY_BIT = linux.BPF_RINGBUF_BUSY_BIT |
| 29 |
BPF_RINGBUF_DISCARD_BIT = linux.BPF_RINGBUF_DISCARD_BIT |
| 30 |
BPF_RINGBUF_HDR_SZ = linux.BPF_RINGBUF_HDR_SZ |
| 31 |
SYS_BPF = linux.SYS_BPF |
| 32 |
F_DUPFD_CLOEXEC = linux.F_DUPFD_CLOEXEC |
| 33 |
EPOLL_CTL_ADD = linux.EPOLL_CTL_ADD |
| 34 |
EPOLL_CLOEXEC = linux.EPOLL_CLOEXEC |
| 35 |
O_RDONLY = linux.O_RDONLY |
| 36 |
O_DIRECTORY = linux.O_DIRECTORY |
| 37 |
O_CLOEXEC = linux.O_CLOEXEC |
| 38 |
O_NONBLOCK = linux.O_NONBLOCK |
| 39 |
PROT_NONE = linux.PROT_NONE |
| 40 |
PROT_READ = linux.PROT_READ |
| 41 |
PROT_WRITE = linux.PROT_WRITE |
| 42 |
MAP_ANON = linux.MAP_ANON |
| 43 |
MAP_SHARED = linux.MAP_SHARED |
| 44 |
MAP_FIXED = linux.MAP_FIXED |
| 45 |
MAP_PRIVATE = linux.MAP_PRIVATE |
| 46 |
PERF_ATTR_SIZE_VER1 = linux.PERF_ATTR_SIZE_VER1 |
| 47 |
PERF_TYPE_SOFTWARE = linux.PERF_TYPE_SOFTWARE |
| 48 |
PERF_TYPE_TRACEPOINT = linux.PERF_TYPE_TRACEPOINT |
| 49 |
PERF_COUNT_SW_BPF_OUTPUT = linux.PERF_COUNT_SW_BPF_OUTPUT |
| 50 |
PERF_EVENT_IOC_DISABLE = linux.PERF_EVENT_IOC_DISABLE |
| 51 |
PERF_EVENT_IOC_ENABLE = linux.PERF_EVENT_IOC_ENABLE |
| 52 |
PERF_EVENT_IOC_SET_BPF = linux.PERF_EVENT_IOC_SET_BPF |
| 53 |
PerfBitWatermark = linux.PerfBitWatermark |
| 54 |
PerfBitWriteBackward = linux.PerfBitWriteBackward |
| 55 |
PERF_SAMPLE_RAW = linux.PERF_SAMPLE_RAW |
| 56 |
PERF_FLAG_FD_CLOEXEC = linux.PERF_FLAG_FD_CLOEXEC |
| 57 |
RLIM_INFINITY = linux.RLIM_INFINITY |
| 58 |
RLIMIT_MEMLOCK = linux.RLIMIT_MEMLOCK |
| 59 |
BPF_STATS_RUN_TIME = linux.BPF_STATS_RUN_TIME |
| 60 |
PERF_RECORD_LOST = linux.PERF_RECORD_LOST |
| 61 |
PERF_RECORD_SAMPLE = linux.PERF_RECORD_SAMPLE |
| 62 |
AT_FDCWD = linux.AT_FDCWD |
| 63 |
RENAME_NOREPLACE = linux.RENAME_NOREPLACE |
| 64 |
SO_ATTACH_BPF = linux.SO_ATTACH_BPF |
| 65 |
SO_DETACH_BPF = linux.SO_DETACH_BPF |
| 66 |
SOL_SOCKET = linux.SOL_SOCKET |
| 67 |
SIGPROF = linux.SIGPROF |
| 68 |
SIGUSR1 = linux.SIGUSR1 |
| 69 |
SIG_BLOCK = linux.SIG_BLOCK |
| 70 |
SIG_UNBLOCK = linux.SIG_UNBLOCK |
| 71 |
BPF_FS_MAGIC = linux.BPF_FS_MAGIC |
| 72 |
TRACEFS_MAGIC = linux.TRACEFS_MAGIC |
| 73 |
DEBUGFS_MAGIC = linux.DEBUGFS_MAGIC |
| 74 |
BPF_RB_NO_WAKEUP = linux.BPF_RB_NO_WAKEUP |
| 75 |
BPF_RB_FORCE_WAKEUP = linux.BPF_RB_FORCE_WAKEUP |
| 76 |
AF_UNSPEC = linux.AF_UNSPEC |
| 77 |
IFF_UP = linux.IFF_UP |
| 78 |
LINUX_CAPABILITY_VERSION_3 = linux.LINUX_CAPABILITY_VERSION_3 |
| 79 |
CLONE_NEWNET = linux.CLONE_NEWNET |
| 80 |
CLONE_NEWUSER = linux.CLONE_NEWUSER |
| 81 |
CLONE_NEWNS = linux.CLONE_NEWNS |
| 82 |
MOVE_MOUNT_F_EMPTY_PATH = linux.MOVE_MOUNT_F_EMPTY_PATH |
| 83 |
AF_UNIX = linux.AF_UNIX |
| 84 |
SOCK_STREAM = linux.SOCK_STREAM |
| 85 |
SOCK_CLOEXEC = linux.SOCK_CLOEXEC |
| 86 |
FSOPEN_CLOEXEC = linux.FSOPEN_CLOEXEC |
| 87 |
FSMOUNT_CLOEXEC = linux.FSMOUNT_CLOEXEC |
| 88 |
MSG_CMSG_CLOEXEC = linux.MSG_CMSG_CLOEXEC |
| 89 |
SizeofInt = linux.SizeofInt |
| 90 |
) |
| 91 |
|
| 92 |
type Statfs_t = linux.Statfs_t |
| 93 |
type Stat_t = linux.Stat_t |
| 94 |
type Rlimit = linux.Rlimit |
| 95 |
type Signal = linux.Signal |
| 96 |
type Sigset_t = linux.Sigset_t |
| 97 |
type PerfEventMmapPage = linux.PerfEventMmapPage |
| 98 |
type EpollEvent = linux.EpollEvent |
| 99 |
type PerfEventAttr = linux.PerfEventAttr |
| 100 |
type Utsname = linux.Utsname |
| 101 |
type CPUSet = linux.CPUSet |
| 102 |
type CapUserData = linux.CapUserData |
| 103 |
type CapUserHeader = linux.CapUserHeader |
| 104 |
type SysProcAttr = linux.SysProcAttr |
| 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 |
|
| 159 |
func MmapPtr(fd int, offset int64, addr unsafe.Pointer, length uintptr, prot int, flags int) (ret unsafe.Pointer, err error) { |
| 160 |
return linux.MmapPtr(fd, offset, addr, length, prot, flags) |
| 161 |
} |
| 162 |
|
| 163 |
func Munmap(b []byte) (err error) { |
| 164 |
return linux.Munmap(b) |
| 165 |
} |
| 166 |
|
| 167 |
func PerfEventOpen(attr *PerfEventAttr, pid int, cpu int, groupFd int, flags int) (fd int, err error) { |
| 168 |
return linux.PerfEventOpen(attr, pid, cpu, groupFd, flags) |
| 169 |
} |
| 170 |
|
| 171 |
func Uname(buf *Utsname) (err error) { |
| 172 |
return linux.Uname(buf) |
| 173 |
} |
| 174 |
|
| 175 |
func Getpid() int { |
| 176 |
return linux.Getpid() |
| 177 |
} |
| 178 |
|
| 179 |
func Gettid() int { |
| 180 |
return linux.Gettid() |
| 181 |
} |
| 182 |
|
| 183 |
func Tgkill(tgid int, tid int, sig syscall.Signal) (err error) { |
| 184 |
return linux.Tgkill(tgid, tid, sig) |
| 185 |
} |
| 186 |
|
| 187 |
func BytePtrFromString(s string) (*byte, error) { |
| 188 |
return linux.BytePtrFromString(s) |
| 189 |
} |
| 190 |
|
| 191 |
func ByteSliceToString(s []byte) string { |
| 192 |
return linux.ByteSliceToString(s) |
| 193 |
} |
| 194 |
|
| 195 |
func ByteSliceFromString(s string) ([]byte, error) { |
| 196 |
return linux.ByteSliceFromString(s) |
| 197 |
} |
| 198 |
|
| 199 |
func Renameat2(olddirfd int, oldpath string, newdirfd int, newpath string, flags uint) error { |
| 200 |
return linux.Renameat2(olddirfd, oldpath, newdirfd, newpath, flags) |
| 201 |
} |
| 202 |
|
| 203 |
func Prlimit(pid, resource int, new, old *Rlimit) error { |
| 204 |
return linux.Prlimit(pid, resource, new, old) |
| 205 |
} |
| 206 |
|
| 207 |
func Open(path string, mode int, perm uint32) (int, error) { |
| 208 |
return linux.Open(path, mode, perm) |
| 209 |
} |
| 210 |
|
| 211 |
func Fstat(fd int, stat *Stat_t) error { |
| 212 |
return linux.Fstat(fd, stat) |
| 213 |
} |
| 214 |
|
| 215 |
func SetsockoptInt(fd, level, opt, value int) error { |
| 216 |
return linux.SetsockoptInt(fd, level, opt, value) |
| 217 |
} |
| 218 |
|
| 219 |
func SchedSetaffinity(pid int, set *CPUSet) error { |
| 220 |
return linux.SchedSetaffinity(pid, set) |
| 221 |
} |
| 222 |
|
| 223 |
func SchedGetaffinity(pid int, set *CPUSet) error { |
| 224 |
return linux.SchedGetaffinity(pid, set) |
| 225 |
} |
| 226 |
|
| 227 |
func Auxv() ([][2]uintptr, error) { |
| 228 |
return linux.Auxv() |
| 229 |
} |
| 230 |
|
| 231 |
func Unshare(flag int) error { |
| 232 |
return linux.Unshare(flag) |
| 233 |
} |
| 234 |
|
| 235 |
func Setns(fd int, nstype int) error { |
| 236 |
return linux.Setns(fd, nstype) |
| 237 |
} |
| 238 |
|
| 239 |
func Capget(hdr *CapUserHeader, data *CapUserData) (err error) { |
| 240 |
return linux.Capget(hdr, data) |
| 241 |
} |
| 242 |
|
| 243 |
func Capset(hdr *CapUserHeader, data *CapUserData) (err error) { |
| 244 |
return linux.Capset(hdr, data) |
| 245 |
} |
| 246 |
|
| 247 |
func Sendmsg(fd int, p []byte, oob []byte, to linux.Sockaddr, flags int) (err error) { |
| 248 |
return linux.Sendmsg(fd, p, oob, to, flags) |
| 249 |
} |
| 250 |
|
| 251 |
func Fsopen(fsname string, flags int) (fd int, err error) { |
| 252 |
return linux.Fsopen(fsname, flags) |
| 253 |
} |
| 254 |
|
| 255 |
func FsconfigSetString(fd int, key string, value string) error { |
| 256 |
return linux.FsconfigSetString(fd, key, value) |
| 257 |
} |
| 258 |
|
| 259 |
func FsconfigCreate(fd int) (err error) { |
| 260 |
return linux.FsconfigCreate(fd) |
| 261 |
} |
| 262 |
|
| 263 |
func Fsmount(fd int, flags int, mountAttrs int) (fsfd int, err error) { |
| 264 |
return linux.Fsmount(fd, flags, mountAttrs) |
| 265 |
} |
| 266 |
|
| 267 |
func MoveMount(fromDirfd int, fromPathName string, toDirfd int, toPathName string, flags int) (err error) { |
| 268 |
return linux.MoveMount(fromDirfd, fromPathName, toDirfd, toPathName, flags) |
| 269 |
} |
| 270 |
|
| 271 |
func UnixRights(fds ...int) []byte { |
| 272 |
return linux.UnixRights(fds...) |
| 273 |
} |
| 274 |
|
| 275 |
func Recvmsg(fd int, p []byte, oob []byte, flags int) (n int, oobn int, recvflags int, from linux.Sockaddr, err error) { |
| 276 |
return linux.Recvmsg(fd, p, oob, flags) |
| 277 |
} |
| 278 |
|
| 279 |
func Socketpair(domain int, typ int, proto int) (fd [2]int, err error) { |
| 280 |
return linux.Socketpair(domain, typ, proto) |
| 281 |
} |
| 282 |
|
| 283 |
func CmsgSpace(datalen int) int { |
| 284 |
return linux.CmsgSpace(datalen) |
| 285 |
} |
| 286 |
|
| 287 |
func ParseSocketControlMessage(b []byte) ([]linux.SocketControlMessage, error) { |
| 288 |
return linux.ParseSocketControlMessage(b) |
| 289 |
} |
| 290 |
|
| 291 |
func ParseUnixRights(m *linux.SocketControlMessage) ([]int, error) { |
| 292 |
return linux.ParseUnixRights(m) |
| 293 |
} |