lutfisk.net

# Linux system call table for AMD64

Be aware that this API can change, and depending on LibC is usually preferred, however much it sucks.

Includes the first 173 out of 335 calls as of 2024-05-02.


Return values are passed in RAX, with values above 0xFFFFFFFFFFFFF000 (unsigned negative 4096) being error codes equivalent to those of LibC's errno after a sign flip by a negq instruction.

SyscallRAXRDIRSIRDXR10R8R9
read0FDBUF*SIZE
write1FDBUF*SIZE
open2PATH*FLAGSMODE
close3FD
stat4PATH*STATBUF*
fstat5FDSTATBUF*
lstat6PATH*STATBUF*
poll7UFDSCOUNTTIMEOUT
lseek8FDOFFSETORIGIN
mmap9ADDR*SIZEPERMITFLAGSFDOFFSET
mprotect10ADDR*SIZEPERMIT
munmap11ADDR*SIZE
brk12SIZE
rt_sigaction13SIGACT*OACT*COUNT
rt_sigprocmask14HOWSET*OSET*COUNT
rt_sigreturn15UNUSED
ioctl16FDCMDARG
pread6417FDBUF*SIZEOFFSET
pwrite6418FDBUF*SIZEOFFSET
readv19FDIOVEC*COUNT
writev20FDIOVEC*COUNT
access21PATH*MODE
pipe22FD*MODE
select23COUNTIFDSET*OFDSET*EXPFDSET*TIMEVAL*
sched_yield24
mremap25ADDR*SIZENEWSIZEFLAGSNEWADDR*
msync26ADDR*SIZEFLAGS
mincore27ADDR*SIZECHARVEC*
madvise28ADDR*SIZEBEHAVIOUR
shmget29KEYSIZEFLAGS
shmat30IDADDR*FLAGS
shmctl31IDCMDBUF*
dup32FD
dup233FDNEWFD
pause34
nanosleep35RQTP*RMTP*
getitimer36WHICHVAL*
alarm37SEC
setitimer38WHICHVAL*OVAL*
getpid39
sendfile40OFDIFDOFFSET*SIZE
socket41FAMILYTYPEPROTO
connect42FDSOCKADDR*ADDRLEN
accept43FDSOCKADDR*ADDRLEN*
sendto44FDBUF*SIZEFLAGSSOCKADDR*ADDRLEN
recvfrom45FDBUF*SIZEFLAGSSOCKADDR*ADDRLEN
sendmsg46FDMSG*FLAGS
recvmsg47FDMSG*FLAGS
shutdown48FDHOW
bind49FDSOCKADDR*ADDRLEN
listen50FDBACKLOG
getsockname51FDSOCKADDR*ADDRLEN
getpeername52FDSOCKADDR*ADDRLEN
socketpair53FAMILYTYPEPROTOFD*
setsockopt54FDLEVELOPTVAL*SIZE
getsockopt55FDLEVELOPTVAL*SIZE*
clone56FLAGSNEWSPPARENTID*CHILDID*TID
fork57
vfork58
execve59PATH*ARGV**ENV**
exit60CODE
wait461PIDSTATADDR*OPTRUSAGE*
kill62PIDSIG
uname63NAME*
semget64KEYCOUNTFLAGS
semop65IDSEMOPS*COUNT
semctl66IDCOUNTCMDARG
shmdt67ADDR*
msgget68KEYFLAGS
msgsnd69IDBUF*SIZEFLAGS
msgrcv70IDBUF*SIZETYPEFLAGS
msgctl71IDCMDBUF*
fcntl72FDCMDARG
flock73FDCMD
fsync74FD
fdatasync75FD
truncate76PATH*SIZE
ftruncate77FDSIZE
getdents78FDDIRENT*COUNT
getcwd79BUF*SIZE
chdir80PATH*
fchdir81FD
rename82PATH*NEWPATH*
mkdir83PATH*MODE
rmdir84PATH*
creat85PATH*MODE
link86PATH*NEWPATH*
unlink87PATH*
symlink88PATH*NEWPATH*
readlink89PATH*BUF*SIZE
chmod90PATH*MODE
fchmod91FDMODE
chown92PATH*USRIDGRPID
fchmod93FDUSRIDGRPID
lchmod94PATH*USRIDGRPID
umask95MASK
gettimeofday96TIMEVAL*TIMEZONE*
getrlimit97RESOURCERLIMIT*
getrusage98WHORUSAGE*
sysinfo99SYSINFO*
times100TMS*
ptrace101REQUESTPIDADDR*DATA*
getuid102
syslog103TYPEBUF*SIZE
getgid104
setuid105USRID
setgid106GRPID
geteuid107
getegid108
setpgid109PIDGRPID
getppid110
getpgrp111
setsid112
setreuid113RUSRIDEUSRID
setregid114RGRPIDEGRPID
getgroups115COUNTGRPID*
setgroups116COUNTGRPID*
setresuid117RUSRID*EUSRID*SUSRID*
getresuid118RUSRID*EUSRID*SUSRID*
setresgid119RGRPIDEGRPIDSGRPID
getresgid120RGRPID*EGRPID*SGRPID*
getpgid121PID
setfsuid122USRID
setfsgid123GRPID
getsid124PID
capget125CAPHEADERCAPDATAPTR
capset126CAPHEADERCAPDATAPTR
rt_sigpending127SIGSET*COUNT
rt_sigtimedwait128SIGSET*SIGINFO*TIMESPEC*COUNT
rt_sigqueueinfo129PIDSIGSIGINFO*
rt_sigsuspend130SIGSET*COUNT
sigaltstack131STACK*OSTACK*
utime132PATH*UTIMBUF*
mknod133PATH*MODEDEV
uselib134--DEPRECATED--
personality135PERSONALITY
ustat136DEVUSTATBUF*
statfs137PATH*STATFSBUF*
fstatfs138FDSTATFSBUF*
sysfs139OPTARG1ARG2
getpriority140WHICHWHO
setpriority141WHICHWHONICENESS
sched_setparam142PIDSCHEDPARAM*
sched_getparam143PIDSCHEDPARAM*
sched_setscheduler144PIDPOLICYSCHEDPARAM*
sched_getscheduler145PID
sched_get_priority_max146POLICY
sched_get_priority_min147POLICY
sched_rr_get_interval148PIDTIMESPEC*
mlock149ADDR*SIZE
munlock150ADDR*SIZE
mlockall151FLAGS
munlockall152
vhangup153
modify_ldt154FUNCPTR*BYTES
pivot_root155PATH*OLDPATH*
_sysctl156ARGS*
prctl157OPTARG2ARG3ARG4ARG5
arch_prctl158TASK*CODEADDR*
adjtimex159TIMEX*
setrlimit160RESOURCERLIMIT*
chroot161PATH*
sync162
acct163PATH*
settimeofday164TIMEVAL*TIMEZONE*
mount165DEVPATH*DIRPATH*TYPE*FLAGSDATA*
umount2166PATH*FLAGS
swapon167PATH*FLAGS
swapoff168PATH*
reboot169MAGIC1MAGIC2CMDARG*
sethostname170NAME*SIZE
setdomainname171NAME*SIZE
iopl172LEVELPTREGS*
ioperm173FROMCOUNTTURN_ON