| 1 | module builtin |
| 2 | |
| 3 | pub enum Linux_mem { |
| 4 | page_size = 4096 |
| 5 | } |
| 6 | |
| 7 | pub const wp_sys_wnohang = u64(0x00000001) |
| 8 | pub const wp_sys_wuntraced = u64(0x00000002) |
| 9 | pub const wp_sys_wstopped = u64(0x00000002) |
| 10 | pub const wp_sys_wexited = u64(0x00000004) |
| 11 | pub const wp_sys_wcontinued = u64(0x00000008) |
| 12 | pub const wp_sys_wnowait = u64(0x01000000) // don't reap, just poll status. |
| 13 | |
| 14 | pub const wp_sys___wnothread = u64(0x20000000) // don't wait on children of other threads in this group |
| 15 | |
| 16 | pub const wp_sys___wall = u64(0x40000000) // wait on all children, regardless of type |
| 17 | |
| 18 | pub const wp_sys___wclone = u64(0x80000000) |
| 19 | |
| 20 | // First argument to waitid: |
| 21 | pub enum Wi_which { |
| 22 | p_all = 0 |
| 23 | p_pid = 1 |
| 24 | p_pgid = 2 |
| 25 | } |
| 26 | |
| 27 | pub enum Wi_si_code { |
| 28 | cld_exited = 1 // child has exited |
| 29 | cld_killed = 2 // child was killed |
| 30 | cld_dumped = 3 // child terminated abnormally |
| 31 | cld_trapped = 4 // traced child has trapped |
| 32 | cld_stopped = 5 // child has stopped |
| 33 | cld_continued = 6 // stopped child has continued |
| 34 | } |
| 35 | |
| 36 | /* |
| 37 | Paraphrased from "man 2 waitid" on Linux |
| 38 | |
| 39 | Upon successful return, waitid() fills in the |
| 40 | following fields of the siginfo_t structure |
| 41 | pointed to by infop: |
| 42 | |
| 43 | si_pid, offset 0x10, int index 0x04: |
| 44 | The process ID of the child. |
| 45 | |
| 46 | si_uid: offset 0x14, int index 0x05 |
| 47 | The real user ID of the child. |
| 48 | |
| 49 | si_signo: offset 0x00, int index 0x00 |
| 50 | Always set to SIGCHLD. |
| 51 | |
| 52 | si_status: ofset 0x18, int index 0x06 |
| 53 | 1 the exit status of the child, as given to _exit(2) |
| 54 | (or exit(3)) (sc_sys.cld_exited) |
| 55 | 2 the signal that caused the child to terminate, stop, |
| 56 | or continue. |
| 57 | 3 The si_code field can be used to determine how to |
| 58 | interpret this field. |
| 59 | |
| 60 | si_code, set to one of (enum Wi_si_code), offset 0x08, int index 0x02: |
| 61 | CLD_EXITED (child called _exit(2)); |
| 62 | CLD_KILLED (child killed by signal); |
| 63 | CLD_DUMPED (child killed by signal, and dumped core); |
| 64 | CLD_STOPPED (child stopped by signal); |
| 65 | CLD_TRAPPED (traced child has trapped); |
| 66 | CLD_CONTINUED (child continued by SIGCONT). |
| 67 | */ |
| 68 | |
| 69 | pub enum Sig_index { |
| 70 | si_signo = 0x00 |
| 71 | si_code = 0x02 |
| 72 | si_pid = 0x04 |
| 73 | si_uid = 0x05 |
| 74 | si_status = 0x06 |
| 75 | si_size = 0x80 |
| 76 | } |
| 77 | |
| 78 | pub enum Signo { |
| 79 | sighup = 1 // Hangup. |
| 80 | sigint = 2 // Interactive attention signal. |
| 81 | sigquit = 3 // Quit. |
| 82 | sigill = 4 // Illegal instruction. |
| 83 | sigtrap = 5 // Trace/breakpoint trap. |
| 84 | sigabrt = 6 // Abnormal termination. |
| 85 | sigbus = 7 |
| 86 | sigfpe = 8 // Erroneous arithmetic operation. |
| 87 | sigkill = 9 // Killed. |
| 88 | sigusr1 = 10 |
| 89 | sigsegv = 11 // Invalid access to storage. |
| 90 | sigusr2 = 12 |
| 91 | sigpipe = 13 // Broken pipe. |
| 92 | sigalrm = 14 // Alarm clock. |
| 93 | sigterm = 15 // Termination request. |
| 94 | sigstkflt = 16 |
| 95 | sigchld = 17 |
| 96 | sigcont = 18 |
| 97 | sigstop = 19 |
| 98 | sigtstp = 20 |
| 99 | sigttin = 21 // Background read from control terminal. |
| 100 | sigttou = 22 // Background write to control terminal. |
| 101 | sigurg = 23 |
| 102 | sigxcpu = 24 // CPU time limit exceeded. |
| 103 | sigxfsz = 25 // File size limit exceeded. |
| 104 | sigvtalrm = 26 // Virtual timer expired. |
| 105 | sigprof = 27 // Profiling timer expired. |
| 106 | sigwinch = 28 |
| 107 | sigpoll = 29 |
| 108 | sigsys = 31 |
| 109 | } |
| 110 | |
| 111 | pub const fcntlf_dupfd = 0x00000000 |
| 112 | pub const fcntlf_exlck = 0x00000004 |
| 113 | pub const fcntlf_getfd = 0x00000001 |
| 114 | pub const fcntlf_getfl = 0x00000003 |
| 115 | pub const fcntlf_getlk = 0x00000005 |
| 116 | pub const fcntlf_getlk64 = 0x0000000c |
| 117 | pub const fcntlf_getown = 0x00000009 |
| 118 | pub const fcntlf_getowner_uids = 0x00000011 |
| 119 | pub const fcntlf_getown_ex = 0x00000010 |
| 120 | pub const fcntlf_getsig = 0x0000000b |
| 121 | pub const fcntlf_ofd_getlk = 0x00000024 |
| 122 | pub const fcntlf_ofd_setlk = 0x00000025 |
| 123 | pub const fcntlf_ofd_setlkw = 0x00000026 |
| 124 | pub const fcntlf_owner_pgrp = 0x00000002 |
| 125 | pub const fcntlf_owner_pid = 0x00000001 |
| 126 | pub const fcntlf_owner_tid = 0x00000000 |
| 127 | pub const fcntlf_rdlck = 0x00000000 |
| 128 | pub const fcntlf_setfd = 0x00000002 |
| 129 | pub const fcntlf_setfl = 0x00000004 |
| 130 | pub const fcntlf_setlk = 0x00000006 |
| 131 | pub const fcntlf_setlk64 = 0x0000000d |
| 132 | pub const fcntlf_setlkw = 0x00000007 |
| 133 | pub const fcntlf_setlkw64 = 0x0000000e |
| 134 | pub const fcntlf_setown = 0x00000008 |
| 135 | pub const fcntlf_setown_ex = 0x0000000f |
| 136 | pub const fcntlf_setsig = 0x0000000a |
| 137 | pub const fcntlf_shlck = 0x00000008 |
| 138 | pub const fcntlf_unlck = 0x00000002 |
| 139 | pub const fcntlf_wrlck = 0x00000001 |
| 140 | pub const fcntllock_ex = 0x00000002 |
| 141 | pub const fcntllock_mand = 0x00000020 |
| 142 | pub const fcntllock_nb = 0x00000004 |
| 143 | pub const fcntllock_read = 0x00000040 |
| 144 | pub const fcntllock_rw = 0x000000c0 |
| 145 | pub const fcntllock_sh = 0x00000001 |
| 146 | pub const fcntllock_un = 0x00000008 |
| 147 | pub const fcntllock_write = 0x00000080 |
| 148 | pub const fcntlo_accmode = 0x00000003 |
| 149 | pub const fcntlo_append = 0x00000400 |
| 150 | pub const fcntlo_cloexec = 0x00080000 |
| 151 | pub const fcntlo_creat = 0x00000040 |
| 152 | pub const fcntlo_direct = 0x00004000 |
| 153 | pub const fcntlo_directory = 0x00010000 |
| 154 | pub const fcntlo_dsync = 0x00001000 |
| 155 | pub const fcntlo_excl = 0x00000080 |
| 156 | pub const fcntlo_largefile = 0x00008000 |
| 157 | pub const fcntlo_ndelay = 0x00000800 |
| 158 | pub const fcntlo_noatime = 0x00040000 |
| 159 | pub const fcntlo_noctty = 0x00000100 |
| 160 | pub const fcntlo_nofollow = 0x00020000 |
| 161 | pub const fcntlo_nonblock = 0x00000800 |
| 162 | pub const fcntlo_path = 0x00200000 |
| 163 | pub const fcntlo_rdonly = 0x00000000 |
| 164 | pub const fcntlo_rdwr = 0x00000002 |
| 165 | pub const fcntlo_trunc = 0x00000200 |
| 166 | pub const fcntlo_wronly = 0x00000001 |
| 167 | |
| 168 | pub enum Errno { |
| 169 | enoerror = 0x00000000 |
| 170 | e2big = 0x00000007 |
| 171 | eacces = 0x0000000d |
| 172 | eagain = 0x0000000b |
| 173 | ebadf = 0x00000009 |
| 174 | ebusy = 0x00000010 |
| 175 | echild = 0x0000000a |
| 176 | edom = 0x00000021 |
| 177 | eexist = 0x00000011 |
| 178 | efault = 0x0000000e |
| 179 | efbig = 0x0000001b |
| 180 | eintr = 0x00000004 |
| 181 | einval = 0x00000016 |
| 182 | eio = 0x00000005 |
| 183 | eisdir = 0x00000015 |
| 184 | emfile = 0x00000018 |
| 185 | emlink = 0x0000001f |
| 186 | enfile = 0x00000017 |
| 187 | enodev = 0x00000013 |
| 188 | enoent = 0x00000002 |
| 189 | enoexec = 0x00000008 |
| 190 | enomem = 0x0000000c |
| 191 | enospc = 0x0000001c |
| 192 | enotblk = 0x0000000f |
| 193 | enotdir = 0x00000014 |
| 194 | enotty = 0x00000019 |
| 195 | enxio = 0x00000006 |
| 196 | eperm = 0x00000001 |
| 197 | epipe = 0x00000020 |
| 198 | erange = 0x00000022 |
| 199 | erofs = 0x0000001e |
| 200 | espipe = 0x0000001d |
| 201 | esrch = 0x00000003 |
| 202 | etxtbsy = 0x0000001a |
| 203 | exdev = 0x00000012 |
| 204 | } |
| 205 | |
| 206 | pub enum Mm_prot { |
| 207 | prot_read = 0x1 |
| 208 | prot_write = 0x2 |
| 209 | prot_exec = 0x4 |
| 210 | prot_none = 0x0 |
| 211 | prot_growsdown = 0x01000000 |
| 212 | prot_growsup = 0x02000000 |
| 213 | } |
| 214 | |
| 215 | pub enum Map_flags { |
| 216 | map_shared = 0x01 |
| 217 | map_private = 0x02 |
| 218 | map_shared_validate = 0x03 |
| 219 | map_type = 0x0f |
| 220 | map_fixed = 0x10 |
| 221 | map_file = 0x00 |
| 222 | map_anonymous = 0x20 |
| 223 | map_huge_shift = 26 |
| 224 | map_huge_mask = 0x3f |
| 225 | } |
| 226 | |
| 227 | fn sys_call0(scn u64) u64 { |
| 228 | res := u64(0) |
| 229 | asm amd64 { |
| 230 | syscall |
| 231 | ; =a (res) |
| 232 | ; a (scn) |
| 233 | } |
| 234 | return res |
| 235 | } |
| 236 | |
| 237 | fn sys_call1(scn u64, arg1 u64) u64 { |
| 238 | res := u64(0) |
| 239 | asm amd64 { |
| 240 | syscall |
| 241 | ; =a (res) |
| 242 | ; a (scn) |
| 243 | D (arg1) |
| 244 | } |
| 245 | return res |
| 246 | } |
| 247 | |
| 248 | fn sys_call2(scn u64, arg1 u64, arg2 u64) u64 { |
| 249 | res := u64(0) |
| 250 | asm amd64 { |
| 251 | syscall |
| 252 | ; =a (res) |
| 253 | ; a (scn) |
| 254 | D (arg1) |
| 255 | S (arg2) |
| 256 | } |
| 257 | return res |
| 258 | } |
| 259 | |
| 260 | fn sys_call3(scn u64, arg1 u64, arg2 u64, arg3 u64) u64 { |
| 261 | res := u64(0) |
| 262 | asm amd64 { |
| 263 | syscall |
| 264 | ; =a (res) |
| 265 | ; a (scn) |
| 266 | D (arg1) |
| 267 | S (arg2) |
| 268 | d (arg3) |
| 269 | } |
| 270 | return res |
| 271 | } |
| 272 | |
| 273 | fn sys_call4(scn u64, arg1 u64, arg2 u64, arg3 u64, arg4 u64) u64 { |
| 274 | res := u64(0) |
| 275 | asm amd64 { |
| 276 | mov r10, arg4 |
| 277 | syscall |
| 278 | ; =a (res) |
| 279 | ; a (scn) |
| 280 | D (arg1) |
| 281 | S (arg2) |
| 282 | d (arg3) |
| 283 | r (arg4) |
| 284 | ; r10 |
| 285 | } |
| 286 | return res |
| 287 | } |
| 288 | |
| 289 | fn sys_call5(scn u64, arg1 u64, arg2 u64, arg3 u64, arg4 u64, arg5 u64) u64 { |
| 290 | res := u64(0) |
| 291 | asm amd64 { |
| 292 | mov r10, arg4 |
| 293 | mov r8, arg5 |
| 294 | syscall |
| 295 | ; =a (res) |
| 296 | ; a (scn) |
| 297 | D (arg1) |
| 298 | S (arg2) |
| 299 | d (arg3) |
| 300 | r (arg4) |
| 301 | r (arg5) |
| 302 | ; r10 |
| 303 | r8 |
| 304 | } |
| 305 | return res |
| 306 | } |
| 307 | |
| 308 | fn sys_call6(scn u64, arg1 u64, arg2 u64, arg3 u64, arg4 u64, arg5 u64, arg6 u64) u64 { |
| 309 | res := u64(0) |
| 310 | asm amd64 { |
| 311 | mov r10, arg4 |
| 312 | mov r8, arg5 |
| 313 | mov r9, arg6 |
| 314 | syscall |
| 315 | ; =a (res) |
| 316 | ; a (scn) |
| 317 | D (arg1) |
| 318 | S (arg2) |
| 319 | d (arg3) |
| 320 | r (arg4) |
| 321 | r (arg5) |
| 322 | r (arg6) |
| 323 | ; r10 |
| 324 | r8 |
| 325 | r9 |
| 326 | } |
| 327 | return res |
| 328 | } |
| 329 | |
| 330 | fn split_int_errno(rc_in u64) (i64, Errno) { |
| 331 | rc := i64(rc_in) |
| 332 | if rc < 0 { |
| 333 | return i64(-1), Errno(-rc) |
| 334 | } |
| 335 | return rc, Errno.enoerror |
| 336 | } |
| 337 | |
| 338 | // 0 sys_read unsigned int fd char *buf size_t count |
| 339 | pub fn sys_read(fd i64, buf &u8, count u64) (i64, Errno) { |
| 340 | return split_int_errno(sys_call3(0, u64(fd), u64(buf), count)) |
| 341 | } |
| 342 | |
| 343 | // 1 sys_write unsigned int fd, const char *buf, size_t count |
| 344 | pub fn sys_write(fd i64, buf &u8, count u64) (i64, Errno) { |
| 345 | return split_int_errno(sys_call3(1, u64(fd), u64(buf), count)) |
| 346 | } |
| 347 | |
| 348 | pub fn sys_open(filename &u8, flags i64, mode int) (i64, Errno) { |
| 349 | // 2 sys_open const char *filename int flags int mode |
| 350 | return split_int_errno(sys_call3(2, u64(filename), u64(flags), u64(mode))) |
| 351 | } |
| 352 | |
| 353 | pub fn sys_close(fd i64) Errno { |
| 354 | // 3 sys_close unsigned int fd |
| 355 | return Errno(-i64(sys_call1(3, u64(fd)))) |
| 356 | } |
| 357 | |
| 358 | // 9 sys_mmap unsigned long addr unsigned long len unsigned long prot unsigned long flags unsigned long fd unsigned long off |
| 359 | pub fn sys_mmap(addr &u8, len u64, prot Mm_prot, flags Map_flags, fildes u64, off u64) (&u8, Errno) { |
| 360 | rc := sys_call6(9, u64(addr), len, u64(prot), u64(flags), fildes, off) |
| 361 | a, e := split_int_errno(rc) |
| 362 | return &u8(a), e |
| 363 | } |
| 364 | |
| 365 | pub fn sys_munmap(addr voidptr, len u64) Errno { |
| 366 | // 11 sys_munmap unsigned long addr size_t len |
| 367 | return Errno(-sys_call2(11, u64(addr), len)) |
| 368 | } |
| 369 | |
| 370 | // 22 sys_pipe int *filedes |
| 371 | pub fn sys_pipe(filedes &int) Errno { |
| 372 | return Errno(sys_call1(22, u64(filedes))) |
| 373 | } |
| 374 | |
| 375 | // 24 sys_sched_yield |
| 376 | pub fn sys_sched_yield() Errno { |
| 377 | return Errno(sys_call0(24)) |
| 378 | } |
| 379 | |
| 380 | pub fn sys_madvise(addr voidptr, len u64, advice int) Errno { |
| 381 | // 28 sys_madvise unsigned long start size_t len_in int behavior |
| 382 | return Errno(sys_call3(28, u64(addr), len, u64(advice))) |
| 383 | } |
| 384 | |
| 385 | // 39 sys_getpid |
| 386 | pub fn sys_getpid() int { |
| 387 | return int(sys_call0(39)) |
| 388 | } |
| 389 | |
| 390 | // 57 sys_fork |
| 391 | pub fn sys_fork() int { |
| 392 | return int(sys_call0(57)) |
| 393 | } |
| 394 | |
| 395 | // 58 sys_vfork |
| 396 | pub fn sys_vfork() int { |
| 397 | return int(sys_call0(58)) |
| 398 | } |
| 399 | |
| 400 | // 33 sys_dup2 unsigned int oldfd unsigned int newfd |
| 401 | pub fn sys_dup2(oldfd int, newfd int) (i64, Errno) { |
| 402 | return split_int_errno(sys_call2(33, u64(oldfd), u64(newfd))) |
| 403 | } |
| 404 | |
| 405 | // 59 sys_execve const char *filename const char *const argv[] const char *const envp[] |
| 406 | // pub fn sys_execve(filename byteptr, argv []u8ptr, envp []u8ptr) int { |
| 407 | // return sys_call3(59, filename, argv, envp) |
| 408 | //} |
| 409 | |
| 410 | // 60 sys_exit int error_code |
| 411 | pub fn sys_exit(ec int) { |
| 412 | sys_call1(60, u64(ec)) |
| 413 | } |
| 414 | |
| 415 | // 102 sys_getuid |
| 416 | pub fn sys_getuid() int { |
| 417 | return int(sys_call0(102)) |
| 418 | } |
| 419 | |
| 420 | // 247 sys_waitid int which pid_t upid struct siginfo *infop int options struct rusage *ru |
| 421 | pub fn sys_waitid(which Wi_which, pid int, infop &int, options int, ru voidptr) Errno { |
| 422 | return Errno(sys_call5(247, u64(which), u64(pid), u64(infop), u64(options), u64(ru))) |
| 423 | } |
| 424 | |
| 425 | /* |
| 426 | A few years old, but still relevant |
| 427 | https://blog.rchapman.org/posts/Linux_System_Call_Table_for_x86_64/ |
| 428 | |
| 429 | >0 sys_read unsigned int fd char *buf size_t count |
| 430 | >1 sys_write unsigned int fd const char *buf size_t count |
| 431 | >2 sys_open const char *filename int flags int mode |
| 432 | >3 sys_close unsigned int fd |
| 433 | 4 sys_stat const char *filename struct stat *statbuf |
| 434 | 5 sys_fstat unsigned int fd struct stat *statbuf |
| 435 | 6 sys_lstat fconst char *filename struct stat *statbuf |
| 436 | 7 sys_poll struct poll_fd *ufds unsigned int nfds long timeout_msecs |
| 437 | 8 sys_lseek unsigned int fd off_t offset unsigned int origin |
| 438 | >9 sys_mmap unsigned long addr unsigned long len unsigned long prot unsigned long flags unsigned long fd unsigned long off |
| 439 | 10 sys_mprotect unsigned long start size_t len unsigned long prot |
| 440 | >11 sys_munmap unsigned long addr size_t len |
| 441 | 12 sys_brk unsigned long brk |
| 442 | 13 sys_rt_sigaction int sig const struct sigaction *act struct sigaction *oact size_t sigsetsize |
| 443 | 14 sys_rt_sigprocmask int how sigset_t *nset sigset_t *oset size_t sigsetsize |
| 444 | 15 sys_rt_sigreturn unsigned long __unused |
| 445 | 16 sys_ioctl unsigned int fd unsigned int cmd unsigned long arg |
| 446 | 17 sys_pread64 unsigned long fd char *buf size_t count loff_t pos |
| 447 | 18 sys_pwrite64 unsigned int fd const char *buf size_t count loff_t pos |
| 448 | 19 sys_readv unsigned long fd const struct iovec *vec unsigned long vlen |
| 449 | 20 sys_writev unsigned long fd const struct iovec *vec unsigned long vlen |
| 450 | 21 sys_access const char *filename int mode |
| 451 | >22 sys_pipe int *filedes |
| 452 | 23 sys_select int n fd_set *inp fd_set *outp fd_set*exp struct timeval *tvp |
| 453 | >24 sys_sched_yield |
| 454 | 25 sys_mremap unsigned long addr unsigned long old_len unsigned long new_len unsigned long flags unsigned long new_addr |
| 455 | 26 sys_msync unsigned long start size_t len int flags |
| 456 | 27 sys_mincore unsigned long start size_t len unsigned char *vec |
| 457 | >28 sys_madvise unsigned long start size_t len_in int behavior |
| 458 | 29 sys_shmget key_t key size_t size int shmflg |
| 459 | 30 sys_shmat int shmid char *shmaddr int shmflg |
| 460 | 31 sys_shmctl int shmid int cmd struct shmid_ds *buf |
| 461 | 32 sys_dup unsigned int fildes |
| 462 | 33 sys_dup2 unsigned int oldfd unsigned int newfd |
| 463 | 34 sys_pause |
| 464 | 35 sys_nanosleep struct timespec *rqtp struct timespec *rmtp |
| 465 | 36 sys_getitimer int which struct itimerval *value |
| 466 | 37 sys_alarm unsigned int seconds |
| 467 | 38 sys_setitimer int which struct itimerval *value struct itimerval *ovalue |
| 468 | >39 sys_getpid |
| 469 | 40 sys_sendfile int out_fd int in_fd off_t *offset size_t count |
| 470 | 41 sys_socket int family int type int protocol |
| 471 | 42 sys_connect int fd struct sockaddr *uservaddr int addrlen |
| 472 | 43 sys_accept int fd struct sockaddr *upeer_sockaddr int *upeer_addrlen |
| 473 | 44 sys_sendto int fd void *buff size_t len unsigned flags struct sockaddr *addr int addr_len |
| 474 | 45 sys_recvfrom int fd void *ubuf size_t size unsigned flags struct sockaddr *addr int *addr_len |
| 475 | 46 sys_sendmsg int fd struct msghdr *msg unsigned flags |
| 476 | 47 sys_recvmsg int fd struct msghdr *msg unsigned int flags |
| 477 | 48 sys_shutdown int fd int how |
| 478 | 49 sys_bind int fd struct sokaddr *umyaddr int addrlen |
| 479 | 50 sys_listen int fd int backlog |
| 480 | 51 sys_getsockname int fd struct sockaddr *usockaddr int *usockaddr_len |
| 481 | 52 sys_getpeername int fd struct sockaddr *usockaddr int *usockaddr_len |
| 482 | 53 sys_socketpair int family int type int protocol int *usockvec |
| 483 | 54 sys_setsockopt int fd int level int optname char *optval int optlen |
| 484 | 55 sys_getsockopt int fd int level int optname char *optval int *optlen |
| 485 | 56 sys_clone unsigned long clone_flags unsigned long newsp void *parent_tid void *child_tid |
| 486 | >57 sys_fork |
| 487 | >58 sys_vfork |
| 488 | >59 sys_execve const char *filename const char *const argv[] const char *const envp[] |
| 489 | >60 sys_exit int error_code |
| 490 | 61 sys_wait4 pid_t upid int *stat_addr int options struct rusage *ru |
| 491 | 62 sys_kill pid_t pid int sig |
| 492 | 63 sys_uname struct old_utsname *name |
| 493 | 64 sys_semget key_t key int nsems int semflg |
| 494 | 65 sys_semop int semid struct sembuf *tsops unsigned nsops |
| 495 | 66 sys_semctl int semid int semnum int cmd union semun arg |
| 496 | 67 sys_shmdt char *shmaddr |
| 497 | 68 sys_msgget key_t key int msgflg |
| 498 | 69 sys_msgsnd int msqid struct msgbuf *msgp size_t msgsz int msgflg |
| 499 | 70 sys_msgrcv int msqid struct msgbuf *msgp size_t msgsz long msgtyp int msgflg |
| 500 | 71 sys_msgctl int msqid int cmd struct msqid_ds *buf |
| 501 | 72 sys_fcntl unsigned int fd unsigned int cmd unsigned long arg |
| 502 | 73 sys_flock unsigned int fd unsigned int cmd |
| 503 | 74 sys_fsync unsigned int fd |
| 504 | 75 sys_fdatasync unsigned int fd |
| 505 | 76 sys_truncate const char *path long length |
| 506 | 77 sys_ftruncate unsigned int fd unsigned long length |
| 507 | 78 sys_getdents unsigned int fd struct linux_dirent *dirent unsigned int count |
| 508 | 79 sys_getcwd char *buf unsigned long size |
| 509 | 80 sys_chdir const char *filename |
| 510 | 81 sys_fchdir unsigned int fd |
| 511 | 82 sys_rename const char *oldname const char *newname |
| 512 | 83 sys_mkdir const char *pathname int mode |
| 513 | 84 sys_rmdir const char *pathname |
| 514 | 85 sys_creat const char *pathname int mode |
| 515 | 86 sys_link const char *oldname const char *newname |
| 516 | 87 sys_unlink const char *pathname |
| 517 | 88 sys_symlink const char *oldname const char *newname |
| 518 | 89 sys_readlink const char *path char *buf int bufsiz |
| 519 | 90 sys_chmod const char *filename mode_t mode |
| 520 | 91 sys_fchmod unsigned int fd mode_t mode |
| 521 | 92 sys_chown const char *filename uid_t user gid_t group |
| 522 | 93 sys_fchown unsigned int fd uid_t user gid_t group |
| 523 | 94 sys_lchown const char *filename uid_t user gid_t group |
| 524 | 95 sys_umask int mask |
| 525 | 96 sys_gettimeofday struct timeval *tv struct timezone *tz |
| 526 | 97 sys_getrlimit unsigned int resource struct rlimit *rlim |
| 527 | 98 sys_getrusage int who struct rusage *ru |
| 528 | 99 sys_sysinfo struct sysinfo *info |
| 529 | 100 sys_times struct sysinfo *info |
| 530 | 101 sys_ptrace long request long pid unsigned long addr unsigned long data |
| 531 | >102 sys_getuid |
| 532 | 103 sys_syslog int type char *buf int len |
| 533 | 104 sys_getgid |
| 534 | 105 sys_setuid uid_t uid |
| 535 | 106 sys_setgid gid_t gid |
| 536 | 107 sys_geteuid |
| 537 | 108 sys_getegid |
| 538 | 109 sys_setpgid pid_t pid pid_t pgid |
| 539 | 110 sys_getppid |
| 540 | 111 sys_getpgrp |
| 541 | 112 sys_setsid |
| 542 | 113 sys_setreuid uid_t ruid uid_t euid |
| 543 | 114 sys_setregid gid_t rgid gid_t egid |
| 544 | 115 sys_getgroups int gidsetsize gid_t *grouplist |
| 545 | 116 sys_setgroups int gidsetsize gid_t *grouplist |
| 546 | 117 sys_setresuid uid_t *ruid uid_t *euid uid_t *suid |
| 547 | 118 sys_getresuid uid_t *ruid uid_t *euid uid_t *suid |
| 548 | 119 sys_setresgid gid_t rgid gid_t egid gid_t sgid |
| 549 | 120 sys_getresgid gid_t *rgid gid_t *egid gid_t *sgid |
| 550 | 121 sys_getpgid pid_t pid |
| 551 | 122 sys_setfsuid uid_t uid |
| 552 | 123 sys_setfsgid gid_t gid |
| 553 | 124 sys_getsid pid_t pid |
| 554 | 125 sys_capget cap_user_header_t header cap_user_data_t dataptr |
| 555 | 126 sys_capset cap_user_header_t header const cap_user_data_t data |
| 556 | 127 sys_rt_sigpending sigset_t *set size_t sigsetsize |
| 557 | 128 sys_rt_sigtimedwait const sigset_t *uthese siginfo_t *uinfo const struct timespec *uts size_t sigsetsize |
| 558 | 129 sys_rt_sigqueueinfo pid_t pid int sig siginfo_t *uinfo |
| 559 | 130 sys_rt_sigsuspend sigset_t *unewset size_t sigsetsize |
| 560 | 131 sys_sigaltstack const stack_t *uss stack_t *uoss |
| 561 | 132 sys_utime char *filename struct utimbuf *times |
| 562 | 133 sys_mknod const char *filename umode_t mode unsigned dev |
| 563 | 134 sys_uselib NOT IMPLEMENTED |
| 564 | 135 sys_personality unsigned int personality |
| 565 | 136 sys_ustat unsigned dev struct ustat *ubuf |
| 566 | 137 sys_statfs const char *pathname struct statfs *buf |
| 567 | 138 sys_fstatfs unsigned int fd struct statfs *buf |
| 568 | 139 sys_sysfs int option unsigned long arg1 unsigned long arg2 |
| 569 | 140 sys_getpriority int which int who |
| 570 | 141 sys_setpriority int which int who int niceval |
| 571 | 142 sys_sched_setparam pid_t pid struct sched_param *param |
| 572 | 143 sys_sched_getparam pid_t pid struct sched_param *param |
| 573 | 144 sys_sched_setscheduler pid_t pid int policy struct sched_param *param |
| 574 | 145 sys_sched_getscheduler pid_t pid |
| 575 | 146 sys_sched_get_priority_max int policy |
| 576 | 147 sys_sched_get_priority_min int policy |
| 577 | 148 sys_sched_rr_get_interval pid_t pid struct timespec *interval |
| 578 | 149 sys_mlock unsigned long start size_t len |
| 579 | 150 sys_munlock unsigned long start size_t len |
| 580 | 151 sys_mlockall int flags |
| 581 | 152 sys_munlockall |
| 582 | 153 sys_vhangup |
| 583 | 154 sys_modify_ldt int func void *ptr unsigned long bytecount |
| 584 | 155 sys_pivot_root const char *new_root const char *put_old |
| 585 | 156 sys__sysctl struct __sysctl_args *args |
| 586 | 157 sys_prctl int option unsigned long arg2 unsigned long arg3 unsigned long arg4 unsigned long arg5 |
| 587 | 158 sys_arch_prctl struct task_struct *task int code unsigned long *addr |
| 588 | 159 sys_adjtimex struct timex *txc_p |
| 589 | 160 sys_setrlimit unsigned int resource struct rlimit *rlim |
| 590 | 161 sys_chroot const char *filename |
| 591 | 162 sys_sync |
| 592 | 163 sys_acct const char *name |
| 593 | 164 sys_settimeofday struct timeval *tv struct timezone *tz |
| 594 | 165 sys_mount char *dev_name char *dir_name char *type unsigned long flags void *data |
| 595 | 166 sys_umount2 const char *target int flags |
| 596 | 167 sys_swapon const char *specialfile int swap_flags |
| 597 | 168 sys_swapoff const char *specialfile |
| 598 | 169 sys_reboot int magic1 int magic2 unsigned int cmd void *arg |
| 599 | 170 sys_sethostname char *name int len |
| 600 | 171 sys_setdomainname char *name int len |
| 601 | 172 sys_iopl unsigned int level struct pt_regs *regs |
| 602 | 173 sys_ioperm unsigned long from unsigned long num int turn_on |
| 603 | 174 sys_create_module REMOVED IN Linux 2.6 |
| 604 | 175 sys_init_module void *umod unsigned long len const char *uargs |
| 605 | 176 sys_delete_module const chat *name_user unsigned int flags |
| 606 | 177 sys_get_kernel_syms REMOVED IN Linux 2.6 |
| 607 | 178 sys_query_module REMOVED IN Linux 2.6 |
| 608 | 179 sys_quotactl unsigned int cmd const char *special qid_t id void *addr |
| 609 | 180 sys_nfsservctl NOT IMPLEMENTED |
| 610 | 181 sys_getpmsg NOT IMPLEMENTED |
| 611 | 182 sys_putpmsg NOT IMPLEMENTED |
| 612 | 183 sys_afs_syscall NOT IMPLEMENTED |
| 613 | 184 sys_tuxcall NOT IMPLEMENTED |
| 614 | 185 sys_security NOT IMPLEMENTED |
| 615 | 186 sys_gettid |
| 616 | 187 sys_readahead int fd loff_t offset size_t count |
| 617 | 188 sys_setxattr const char *pathname const char *name const void *value size_t size int flags |
| 618 | 189 sys_lsetxattr const char *pathname const char *name const void *value size_t size int flags |
| 619 | 190 sys_fsetxattr int fd const char *name const void *value size_t size int flags |
| 620 | 191 sys_getxattr const char *pathname const char *name void *value size_t size |
| 621 | 192 sys_lgetxattr const char *pathname const char *name void *value size_t size |
| 622 | 193 sys_fgetxattr int fd const har *name void *value size_t size |
| 623 | 194 sys_listxattr const char *pathname char *list size_t size |
| 624 | 195 sys_llistxattr const char *pathname char *list size_t size |
| 625 | 196 sys_flistxattr int fd char *list size_t size |
| 626 | 197 sys_removexattr const char *pathname const char *name |
| 627 | 198 sys_lremovexattr const char *pathname const char *name |
| 628 | 199 sys_fremovexattr int fd const char *name |
| 629 | 200 sys_tkill pid_t pid ing sig |
| 630 | 201 sys_time time_t *tloc |
| 631 | 202 sys_futex u32 *uaddr int op u32 val struct timespec *utime u32 *uaddr2 u32 val3 |
| 632 | 203 sys_sched_setaffinity pid_t pid unsigned int len unsigned long *user_mask_ptr |
| 633 | 204 sys_sched_getaffinity pid_t pid unsigned int len unsigned long *user_mask_ptr |
| 634 | 205 sys_set_thread_area NOT IMPLEMENTED. Use arch_prctl |
| 635 | 206 sys_io_setup unsigned nr_events aio_context_t *ctxp |
| 636 | 207 sys_io_destroy aio_context_t ctx |
| 637 | 208 sys_io_getevents aio_context_t ctx_id long min_nr long nr struct io_event *events |
| 638 | 209 sys_io_submit aio_context_t ctx_id long nr struct iocb **iocbpp |
| 639 | 210 sys_io_cancel aio_context_t ctx_id struct iocb *iocb struct io_event *result |
| 640 | 211 sys_get_thread_area NOT IMPLEMENTED. Use arch_prctl |
| 641 | 212 sys_lookup_dcookie u64 cookie64 long buf long len |
| 642 | 213 sys_epoll_create int size |
| 643 | 214 sys_epoll_ctl_old NOT IMPLEMENTED |
| 644 | 215 sys_epoll_wait_old NOT IMPLEMENTED |
| 645 | 216 sys_remap_file_pages unsigned long start unsigned long size unsigned long prot unsigned long pgoff unsigned long flags |
| 646 | 217 sys_getdents64 unsigned int fd struct linux_dirent64 *dirent unsigned int count |
| 647 | 218 sys_set_tid_address int *tidptr |
| 648 | 219 sys_restart_syscall |
| 649 | 220 sys_semtimedop int semid struct sembuf *tsops unsigned nsops const struct timespec *timeout |
| 650 | 221 sys_fadvise64 int fd loff_t offset size_t len int advice |
| 651 | 222 sys_timer_create const clockid_t which_clock struct sigevent *timer_event_spec timer_t *created_timer_id |
| 652 | 223 sys_timer_settime timer_t timer_id int flags const struct itimerspec *new_setting struct itimerspec *old_setting |
| 653 | 224 sys_timer_gettime timer_t timer_id struct itimerspec *setting |
| 654 | 225 sys_timer_getoverrun timer_t timer_id |
| 655 | 226 sys_timer_delete timer_t timer_id |
| 656 | 227 sys_clock_settime const clockid_t which_clock const struct timespec *tp |
| 657 | 228 sys_clock_gettime const clockid_t which_clock struct timespec *tp |
| 658 | 229 sys_clock_getres const clockid_t which_clock struct timespec *tp |
| 659 | 230 sys_clock_nanosleep const clockid_t which_clock int flags const struct timespec *rqtp struct timespec *rmtp |
| 660 | 231 sys_exit_group int error_code |
| 661 | 232 sys_epoll_wait int epfd struct epoll_event *events int maxevents int timeout |
| 662 | 233 sys_epoll_ctl int epfd int op int fd struct epoll_event *event |
| 663 | 234 sys_tgkill pid_t tgid pid_t pid int sig |
| 664 | 235 sys_utimes char *filename struct timeval *utimes |
| 665 | 236 sys_vserver NOT IMPLEMENTED |
| 666 | 237 sys_mbind unsigned long start unsigned long len unsigned long mode unsigned long *nmask unsigned long maxnode unsigned flags |
| 667 | 238 sys_set_mempolicy int mode unsigned long *nmask unsigned long maxnode |
| 668 | 239 sys_get_mempolicy int *policy unsigned long *nmask unsigned long maxnode unsigned long addr unsigned long flags |
| 669 | 240 sys_mq_open const char *u_name int oflag mode_t mode struct mq_attr *u_attr |
| 670 | 241 sys_mq_unlink const char *u_name |
| 671 | 242 sys_mq_timedsend mqd_t mqdes const char *u_msg_ptr size_t msg_len unsigned int msg_prio const struct timespec *u_abs_timeout |
| 672 | 243 sys_mq_timedreceive mqd_t mqdes char *u_msg_ptr size_t msg_len unsigned int *u_msg_prio const struct timespec *u_abs_timeout |
| 673 | 244 sys_mq_notify mqd_t mqdes const struct sigevent *u_notification |
| 674 | 245 sys_mq_getsetattr mqd_t mqdes const struct mq_attr *u_mqstat struct mq_attr *u_omqstat |
| 675 | 246 sys_kexec_load unsigned long entry unsigned long nr_segments struct kexec_segment *segments unsigned long flags |
| 676 | >247 sys_waitid int which pid_t upid struct siginfo *infop int options struct rusage *ru |
| 677 | 248 sys_add_key const char *_type const char *_description const void *_payload size_t plen |
| 678 | 249 sys_request_key const char *_type const char *_description const char *_callout_info key_serial_t destringid |
| 679 | 250 sys_keyctl int option unsigned long arg2 unsigned long arg3 unsigned long arg4 unsigned long arg5 |
| 680 | 251 sys_ioprio_set int which int who int ioprio |
| 681 | 252 sys_ioprio_get int which int who |
| 682 | 253 sys_inotify_init |
| 683 | 254 sys_inotify_add_watch int fd const char *pathname u32 mask |
| 684 | 255 sys_inotify_rm_watch int fd __s32 wd |
| 685 | 256 sys_migrate_pages pid_t pid unsigned long maxnode const unsigned long *old_nodes const unsigned long *new_nodes |
| 686 | 257 sys_openat int dfd const char *filename int flags int mode |
| 687 | 258 sys_mkdirat int dfd const char *pathname int mode |
| 688 | 259 sys_mknodat int dfd const char *filename int mode unsigned dev |
| 689 | 260 sys_fchownat int dfd const char *filename uid_t user gid_t group int flag |
| 690 | 261 sys_futimesat int dfd const char *filename struct timeval *utimes |
| 691 | 262 sys_newfstatat int dfd const char *filename struct stat *statbuf int flag |
| 692 | 263 sys_unlinkat int dfd const char *pathname int flag |
| 693 | 264 sys_renameat int oldfd const char *oldname int newfd const char *newname |
| 694 | 265 sys_linkat int oldfd const char *oldname int newfd const char *newname int flags |
| 695 | 266 sys_symlinkat const char *oldname int newfd const char *newname |
| 696 | 267 sys_readlinkat int dfd const char *pathname char *buf int bufsiz |
| 697 | 268 sys_fchmodat int dfd const char *filename mode_t mode |
| 698 | 269 sys_faccessat int dfd const char *filename int mode |
| 699 | 270 sys_pselect6 int n fd_set *inp fd_set *outp fd_set *exp struct timespec *tsp void *sig |
| 700 | 271 sys_ppoll struct pollfd *ufds unsigned int nfds struct timespec *tsp const sigset_t *sigmask size_t sigsetsize |
| 701 | 272 sys_unshare unsigned long unshare_flags |
| 702 | 273 sys_set_robust_list struct robust_list_head *head size_t len |
| 703 | 274 sys_get_robust_list int pid struct robust_list_head **head_ptr size_t *len_ptr |
| 704 | 275 sys_splice int fd_in loff_t *off_in int fd_out loff_t *off_out size_t len unsigned int flags |
| 705 | 276 sys_tee int fdin int fdout size_t len unsigned int flags |
| 706 | 277 sys_sync_file_range long fd loff_t offset loff_t bytes long flags |
| 707 | 278 sys_vmsplice int fd const struct iovec *iov unsigned long nr_segs unsigned int flags |
| 708 | 279 sys_move_pages pid_t pid unsigned long nr_pages const void **pages const int *nodes int *status int flags |
| 709 | 280 sys_utimensat int dfd const char *filename struct timespec *utimes int flags |
| 710 | 281 sys_epoll_pwait int epfd struct epoll_event *events int maxevents int timeout const sigset_t *sigmask size_t sigsetsize |
| 711 | 282 sys_signalfd int ufd sigset_t *user_mask size_t sizemask |
| 712 | 283 sys_timerfd_create int clockid int flags |
| 713 | 284 sys_eventfd unsigned int count |
| 714 | 285 sys_fallocate long fd long mode loff_t offset loff_t len |
| 715 | 286 sys_timerfd_settime int ufd int flags const struct itimerspec *utmr struct itimerspec *otmr |
| 716 | 287 sys_timerfd_gettime int ufd struct itimerspec *otmr |
| 717 | 288 sys_accept4 int fd struct sockaddr *upeer_sockaddr int *upeer_addrlen int flags |
| 718 | 289 sys_signalfd4 int ufd sigset_t *user_mask size_t sizemask int flags |
| 719 | 290 sys_eventfd2 unsigned int count int flags |
| 720 | 291 sys_epoll_create1 int flags |
| 721 | 292 sys_dup3 unsigned int oldfd unsigned int newfd int flags |
| 722 | 293 sys_pipe2 int *filedes int flags |
| 723 | 294 sys_inotify_init1 int flags |
| 724 | 295 sys_preadv unsigned long fd const struct iovec *vec unsigned long vlen unsigned long pos_l unsigned long pos_h |
| 725 | 296 sys_pwritev unsigned long fd const struct iovec *vec unsigned long vlen unsigned long pos_l unsigned long pos_h |
| 726 | 297 sys_rt_tgsigqueueinfo pid_t tgid pid_t pid int sig siginfo_t *uinfo |
| 727 | 298 sys_perf_event_open struct perf_event_attr *attr_uptr pid_t pid int cpu int group_fd unsigned long flags |
| 728 | 299 sys_recvmmsg int fd struct msghdr *mmsg unsigned int vlen unsigned int flags struct timespec *timeout |
| 729 | 300 sys_fanotify_init unsigned int flags unsigned int event_f_flags |
| 730 | 301 sys_fanotify_mark long fanotify_fd long flags __u64 mask long dfd long pathname |
| 731 | 302 sys_prlimit64 pid_t pid unsigned int resource const struct rlimit64 *new_rlim struct rlimit64 *old_rlim |
| 732 | 303 sys_name_to_handle_at int dfd const char *name struct file_handle *handle int *mnt_id int flag |
| 733 | 304 sys_open_by_handle_at int dfd const char *name struct file_handle *handle int *mnt_id int flags |
| 734 | 305 sys_clock_adjtime clockid_t which_clock struct timex *tx |
| 735 | 306 sys_syncfs int fd |
| 736 | 307 sys_sendmmsg int fd struct mmsghdr *mmsg unsigned int vlen unsigned int flags |
| 737 | 308 sys_setns int fd int nstype |
| 738 | 309 sys_getcpu unsigned *cpup unsigned *nodep struct getcpu_cache *unused |
| 739 | 310 sys_process_vm_readv pid_t pid const struct iovec *lvec unsigned long liovcnt const struct iovec *rvec unsigned long riovcnt unsigned long flags |
| 740 | 311 sys_process_vm_writev pid_t pid const struct iovec *lvec unsigned long liovcnt const struct iovcc *rvec unsigned long riovcnt unsigned long flags |
| 741 | 312 sys_kcmp pid_t pid1 pid_t pid2 int type unsigned long idx1 unsigned long idx2 |
| 742 | 313 sys_finit_module int fd const char __user *uargs int flags |
| 743 | 314 sys_sched_setattr pid_t pid struct sched_attr __user *attr unsigned int flags |
| 744 | 315 sys_sched_getattr pid_t pid struct sched_attr __user *attr unsigned int size unsigned int flags |
| 745 | 316 sys_renameat2 int olddfd const char __user *oldname int newdfd const char __user *newname unsigned int flags |
| 746 | 317 sys_seccomp unsigned int op unsigned int flags const char __user *uargs |
| 747 | 318 sys_getrandom char __user *buf size_t count unsigned int flags |
| 748 | 319 sys_memfd_create const char __user *uname_ptr unsigned int flags |
| 749 | 320 sys_kexec_file_load int kernel_fd int initrd_fd unsigned long cmdline_len const char __user *cmdline_ptr unsigned long flags |
| 750 | 321 sys_bpf int cmd union bpf_attr *attr unsigned int size |
| 751 | 322 stub_execveat int dfd const char __user *filename const char __user *const __user *argv const char __user *const __user *envp int flags |
| 752 | 323 userfaultfd int flags |
| 753 | 324 membarrier int cmd int flags |
| 754 | 325 mlock2 unsigned long start size_t len int flags |
| 755 | 326 copy_file_range int fd_in loff_t __user *off_in int fd_out loff_t __user * off_out size_t len unsigned int flags |
| 756 | 327 preadv2 unsigned long fd const struct iovec __user *vec unsigned long vlen unsigned long pos_l unsigned long pos_h int flags |
| 757 | 328 pwritev2 unsigned long fd const struct iovec __user *vec unsigned long vlen unsigned long pos_l unsigned long pos_h int flags |
| 758 | */ |
| 759 | |