lib: Document syscalls.
* include/linux/SYSCALLS: New file.
This commit is contained in:
parent
2848cf6a18
commit
9ae3426c96
111
include/linux/SYSCALLS
Normal file
111
include/linux/SYSCALLS
Normal file
|
@ -0,0 +1,111 @@
|
||||||
|
#+COMMENT: -*- org -*-
|
||||||
|
#+TITLE: Linux System Calls
|
||||||
|
|
||||||
|
|---------------+----------+-----+--------+-----+---------|
|
||||||
|
| name | old | x86 | x86_64 | arm | riscv64 |
|
||||||
|
|---------------+----------+-----+--------+-----+---------|
|
||||||
|
| libc-mini | | | | | |
|
||||||
|
|---------------+----------+-----+--------+-----+---------|
|
||||||
|
| exit | | 1 | 60 | 1 | 1 |
|
||||||
|
| write | | 4 | 1 | 4 | 4 |
|
||||||
|
|---------------+----------+-----+--------+-----+---------|
|
||||||
|
| libc | | | | | |
|
||||||
|
|---------------+----------+-----+--------+-----+---------|
|
||||||
|
| fork | | 2 | 57 | 2 | 2 |
|
||||||
|
| read | | 3 | 0 | 3 | 3 |
|
||||||
|
| open | | 5 | 2 | 5 | 5 |
|
||||||
|
| waitpid | | 7 | | | |
|
||||||
|
| wait4 | waitpid | 114 | 61 | 114 | 114 |
|
||||||
|
| execve | | 11 | 59 | 11 | 11 |
|
||||||
|
| chmod | | 15 | 90 | 15 | 15 |
|
||||||
|
| access | | 33 | 21 | 33 | 33 |
|
||||||
|
| brk | | 45 | 12 | 45 | 45 |
|
||||||
|
| ioctl | | 54 | 16 | 54 | 54 |
|
||||||
|
| fsync | | 118 | 74 | 118 | 118 |
|
||||||
|
| getcwd | | 183 | 79 | 183 | 183 |
|
||||||
|
| dup | | 41 | 32 | 41 | 41 |
|
||||||
|
| dup2 | | 63 | 33 | 63 | 63 |
|
||||||
|
| unlink | | 10 | 87 | 10 | 10 |
|
||||||
|
| gettimeofday | time | 78 | 96 | 78 | 78 |
|
||||||
|
| clock_gettime | | 265 | 228 | 263 | 260 |
|
||||||
|
| time | | 13 | 201 | 13 | |
|
||||||
|
|---------------+----------+-----+--------+-----+---------|
|
||||||
|
| libc+tcc | | | | | |
|
||||||
|
|---------------+----------+-----+--------+-----+---------|
|
||||||
|
| close | | 6 | 3 | 6 | 6 |
|
||||||
|
| lseek | | 19 | 8 | 19 | 19 |
|
||||||
|
| rmdir | | 40 | 84 | 40 | 40 |
|
||||||
|
| stat | | 106 | 4 | 106 | 106 |
|
||||||
|
|---------------+----------+-----+--------+-----+---------|
|
||||||
|
| libc+GNU | | | | | |
|
||||||
|
|---------------+----------+-----+--------+-----+---------|
|
||||||
|
| chdir | | 12 | 80 | 12 | 12 |
|
||||||
|
| link | | 9 | 86 | 9 | 9 |
|
||||||
|
| getpid | | 20 | 39 | 20 | 20 |
|
||||||
|
| getuid | | 24 | 102 | 24 | 199 |
|
||||||
|
| kill | | 37 | 62 | 37 | 37 |
|
||||||
|
| rename | | 38 | 82 | 38 | 38 |
|
||||||
|
| mkdir | | 39 | 83 | 39 | 39 |
|
||||||
|
| pipe | | 42 | 22 | 42 | 42 |
|
||||||
|
| getgid | | 47 | 104 | 47 | 200 |
|
||||||
|
| signal | | 48 | | | 48 |
|
||||||
|
| sigaction | | 67 | | 67 | 67 |
|
||||||
|
| rt_sigaction | | 174 | 13 | 174 | 174 |
|
||||||
|
| signal | | 48 | | | 48 |
|
||||||
|
| fcntl | | 55 | 72 | 55 | 55 |
|
||||||
|
| getrusage | | 77 | 98 | 77 | 77 |
|
||||||
|
| lstat | | 107 | 6 | 107 | 107 |
|
||||||
|
| setitimer | | 104 | 38 | 104 | 104 |
|
||||||
|
| fstat | | 108 | 5 | 108 | 108 |
|
||||||
|
| nanosleep | | 162 | 35 | 162 | 162 |
|
||||||
|
| getdents | | 141 | 78 | 141 | 141 |
|
||||||
|
|---------------+----------+-----+--------+-----+---------|
|
||||||
|
| GNU+bash | | | | | |
|
||||||
|
|---------------+----------+-----+--------+-----+---------|
|
||||||
|
| setuid | | 23 | 105 | 23 | 213 |
|
||||||
|
| geteuid | | 49 | 107 | 49 | 201 |
|
||||||
|
| getegid | | 50 | 108 | 50 | 202 |
|
||||||
|
| setgid | | 46 | 106 | 46 | 214 |
|
||||||
|
| getppid | | 64 | 110 | 64 | 64 |
|
||||||
|
|---------------+----------+-----+--------+-----+---------|
|
||||||
|
| GNU+make | | | | | |
|
||||||
|
|---------------+----------+-----+--------+-----+---------|
|
||||||
|
| sigprocmask | | 126 | | 126 | 126 |
|
||||||
|
|---------------+----------+-----+--------+-----+---------|
|
||||||
|
| GNU+tar | | | | | |
|
||||||
|
|---------------+----------+-----+--------+-----+---------|
|
||||||
|
| symlink | | 83 | 88 | 83 | 83 |
|
||||||
|
| readlink | | 85 | 89 | 85 | 85 |
|
||||||
|
| mknod | | 14 | 133 | 14 | 14 |
|
||||||
|
|---------------+----------+-----+--------+-----+---------|
|
||||||
|
| new | | | | | |
|
||||||
|
|---------------+----------+-----+--------+-----+---------|
|
||||||
|
| clone | fork | 120 | 56 | 120 | 120 |
|
||||||
|
| getdents64 | getdents | 220 | 217 | 217 | 220 |
|
||||||
|
| openat | open | 295 | 257 | 322 | 288 |
|
||||||
|
| mkdirat | mkdir | 296 | 258 | 323 | 289 |
|
||||||
|
| mknodat | mknod | 297 | 259 | 324 | 290 |
|
||||||
|
| unlinkat | rmdir | 301 | 263 | 328 | 294 |
|
||||||
|
| unlinkat | unlink | 301 | 263 | 328 | 294 |
|
||||||
|
| renameat | rename | 302 | 264 | 329 | 295 |
|
||||||
|
| linkat | link | 303 | 265 | 330 | 296 |
|
||||||
|
| symlinkat | symlink | 304 | 266 | 331 | 297 |
|
||||||
|
| readlinkat | readlink | 305 | 267 | 332 | 298 |
|
||||||
|
| fchmodat | chmod | 306 | 268 | 333 | 299 |
|
||||||
|
| faccessat | access | 307 | 269 | 334 | 300 |
|
||||||
|
| dup3 | dup2 | 330 | 292 | 358 | 326 |
|
||||||
|
| pipe2 | pipe | 331 | 293 | 359 | 325 |
|
||||||
|
|---------------+----------+-----+--------+-----+---------|
|
||||||
|
|
||||||
|
* Sources
|
||||||
|
|
||||||
|
https://github.com/torvalds/linux/blob/v4.19/arch/arm/tools/syscall.tbl
|
||||||
|
https://github.com/torvalds/linux/blob/v4.19/arch/x86/entry/syscalls/syscall_32.tbl
|
||||||
|
https://github.com/torvalds/linux/blob/v4.19/arch/x86/entry/syscalls/syscall_64.tbl
|
||||||
|
|
||||||
|
* Legalese
|
||||||
|
Copyright © 2022 Jan (janneke) Nieuwenhuizen <[[mailto:janneke@gnu.org][janneke@gnu.org]]>
|
||||||
|
|
||||||
|
Copying and distribution of this file, with or without modification,
|
||||||
|
are permitted in any medium without royalty provided the copyright
|
||||||
|
notice and this notice are preserved.
|
|
@ -18,11 +18,14 @@
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
|
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
/* Commentary:
|
||||||
|
* See https://github.com/torvalds/linux/blob/v4.19/arch/arm/tools/syscall.tbl
|
||||||
|
*
|
||||||
|
* Code:
|
||||||
|
*/
|
||||||
#ifndef __MES_LINUX_ARM_SYSCALL_H
|
#ifndef __MES_LINUX_ARM_SYSCALL_H
|
||||||
#define __MES_LINUX_ARM_SYSCALL_H 1
|
#define __MES_LINUX_ARM_SYSCALL_H 1
|
||||||
|
|
||||||
/* See https://github.com/torvalds/linux/blob/v4.19/arch/arm/tools/syscall.tbl */
|
|
||||||
|
|
||||||
/* libc-mini */
|
/* libc-mini */
|
||||||
#ifndef SYS_exit
|
#ifndef SYS_exit
|
||||||
#define SYS_exit 0x01
|
#define SYS_exit 0x01
|
||||||
|
|
|
@ -17,6 +17,11 @@
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
|
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
/* Commentary:
|
||||||
|
* See https://github.com/torvalds/linux/blob/v4.19/arch/x86/entry/syscalls/syscall_32.tbl
|
||||||
|
*
|
||||||
|
* Code:
|
||||||
|
*/
|
||||||
#ifndef __MES_LINUX_X86_SYSCALL_H
|
#ifndef __MES_LINUX_X86_SYSCALL_H
|
||||||
#define __MES_LINUX_X86_SYSCALL_H 1
|
#define __MES_LINUX_X86_SYSCALL_H 1
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* -*-comment-start: "//";comment-end:""-*-
|
/* -*-comment-start: "//";comment-end:""-*-
|
||||||
* GNU Mes --- Maxwell Equations of Software
|
* GNU Mes --- Maxwell Equations of Software
|
||||||
* Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
* Copyright © 2018,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
||||||
*
|
*
|
||||||
* This file is part of GNU Mes.
|
* This file is part of GNU Mes.
|
||||||
*
|
*
|
||||||
|
@ -17,12 +17,21 @@
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
|
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
/* Commentary:
|
||||||
|
* See https://github.com/torvalds/linux/blob/v4.19/arch/x86/entry/syscalls/syscall_64.tbl
|
||||||
|
*
|
||||||
|
* Code:
|
||||||
|
*/
|
||||||
#ifndef __MES_LINUX_X86_64_SYSCALL_H
|
#ifndef __MES_LINUX_X86_64_SYSCALL_H
|
||||||
#define __MES_LINUX_X86_64_SYSCALL_H 1
|
#define __MES_LINUX_X86_64_SYSCALL_H 1
|
||||||
|
|
||||||
// libc-mini
|
// libc-mini
|
||||||
// #define SYS_write 0x01
|
#ifndef SYS_write
|
||||||
// #define SYS_exit 0x3c
|
#define SYS_write 0x01
|
||||||
|
#endif
|
||||||
|
#ifndef SYS_exit
|
||||||
|
#define SYS_exit 0x3c
|
||||||
|
#endif
|
||||||
|
|
||||||
// libc
|
// libc
|
||||||
#define SYS_fork 0x39
|
#define SYS_fork 0x39
|
||||||
|
@ -36,16 +45,19 @@
|
||||||
#define SYS_brk 0x0c
|
#define SYS_brk 0x0c
|
||||||
#define SYS_ioctl 0x10
|
#define SYS_ioctl 0x10
|
||||||
#define SYS_fsync 0x4a
|
#define SYS_fsync 0x4a
|
||||||
|
#define SYS_getcwd 0x4f
|
||||||
|
#define SYS_dup 0x20
|
||||||
|
#define SYS_dup2 0x21
|
||||||
|
#define SYS_unlink 0x57
|
||||||
|
#define SYS_gettimeofday 0x60
|
||||||
|
#define SYS_clock_gettime 0xe4
|
||||||
|
#define SYS_time 0xc9
|
||||||
|
|
||||||
// libc+tcc
|
// libc+tcc
|
||||||
#define SYS_close 0x03
|
#define SYS_close 0x03
|
||||||
#define SYS_time 0xc9
|
|
||||||
#define SYS_lseek 0x08
|
#define SYS_lseek 0x08
|
||||||
#define SYS_unlink 0x57
|
|
||||||
#define SYS_rmdir 0x54
|
#define SYS_rmdir 0x54
|
||||||
#define SYS_gettimeofday 0x60
|
|
||||||
#define SYS_stat 0x04
|
#define SYS_stat 0x04
|
||||||
#define SYS_getcwd 0x4f
|
|
||||||
|
|
||||||
// libc+gnu
|
// libc+gnu
|
||||||
#define SYS_chdir 0x50
|
#define SYS_chdir 0x50
|
||||||
|
@ -55,20 +67,17 @@
|
||||||
#define SYS_kill 0x3e
|
#define SYS_kill 0x3e
|
||||||
#define SYS_rename 0x52
|
#define SYS_rename 0x52
|
||||||
#define SYS_mkdir 0x53
|
#define SYS_mkdir 0x53
|
||||||
#define SYS_dup 0x20
|
|
||||||
#define SYS_pipe 0x16
|
#define SYS_pipe 0x16
|
||||||
#define SYS_getgid 0x68
|
#define SYS_getgid 0x68
|
||||||
#define SYS_rt_sigaction 0x0d
|
#define SYS_rt_sigaction 0x0d
|
||||||
#define SYS_rt_sigreturn 0x0f
|
#define SYS_rt_sigreturn 0x0f
|
||||||
#define SYS_fcntl 0x48
|
#define SYS_fcntl 0x48
|
||||||
#define SYS_dup2 0x21
|
|
||||||
#define SYS_getrusage 0x62
|
#define SYS_getrusage 0x62
|
||||||
#define SYS_lstat 0x06
|
#define SYS_lstat 0x06
|
||||||
#define SYS_setitimer 0x26
|
#define SYS_setitimer 0x26
|
||||||
#define SYS_fstat 0x05
|
#define SYS_fstat 0x05
|
||||||
#define SYS_nanosleep 0x33
|
#define SYS_nanosleep 0x33
|
||||||
#define SYS_getdents 0x4e
|
#define SYS_getdents 0x4e
|
||||||
#define SYS_clock_gettime 0xe4
|
|
||||||
|
|
||||||
// bash
|
// bash
|
||||||
#define SYS_setuid 0x69
|
#define SYS_setuid 0x69
|
||||||
|
|
Loading…
Reference in a new issue