BetterOS.org : An attempt to make computer machines run better


HOME | BETTER LINUX | GAMES | SOFTWARE | TUTORIALS | ABOUT | REFERENCES | FORUM | WEB LOG |

Reference Material: INDEX | SYSCALLS | CALLING CONVENTIONS | AMD64 INSTRUCTIONS | X11 | REUSABLE CODE |

Reference Material

INTRODUCTION:
This is meant to be a useful list of AMD64 (x86_64) Linux System calls, along with descriptions, tips, and arguments needed. This is not an exhaustive list, just a useful reference.


SYSCALL:
System CallArgumentsInformation
x86_64 numberi386 numberNameReturns123456DescriptionTips
03SYS_readsizefdbuffercount Reads count bytes from fd into buffer. Returns number of bytes read.
14SYS_writesizefdbuffercount Writes count bytes to fd from buffer. Returns number of bytes written
25SYS_openfdfname Opens filename and returns the resulting file descriptor fd.
36SYS_close fd Closes fd.
4106SYS_staterr_codefnamestruct stat Returns information about file fname.
5108SYS_fstaterr_codefdstruct stat Returns information about open file with descriptor rd.
6107SYS_lstaterr_codefnamestruct stat Returns information about file or symlink fname.
7168SYS_poll
819SYS_lseek
990SYS_mmapaddraddrsizeprotflagsfdoffsetCreates a memory mapping.This can be used to allocate large blocks of memory dynamically.
10125SYS_mprotect
1191SYS_munmap
1245SYS_brkbrk_posaddr Moves the program break (end of data section) to addr. Returns previous program break. If 0 is given for addr, brk will return current the program break.Note that this syscall functions differently than the glibc wrapper.
13174SYS_rt_sigaction
14175SYS_rt_sigprocmask
15173SYS_rt_sigreturn
1654SYS_ioctl
17180SYS_pread64
18181SYS_pwrite64
19145SYS_readv
20146SYS_writev
2133SYS_access
2242SYS_pipe
2382SYS_select
24158SYS_sched_yield
25163SYS_mremap
26144SYS_msync
27218SYS_mincore
28219SYS_madvise
29SYS_shmget
30SYS_shmat
31SYS_shmctl
3241SYS_dupnewfdoldfd Create a duplicate of file descriptor oldfd. Returns new file descriptor.
3363SYS_dup2 oldfdnewfd Create a duplicate of file descriptor oldfd with index newfd. If newfd is a valid filedescriptor, it is automatically closed before duplication.This is often used to duplicate file descriptors over stdio and stdin before forking, so that the child process writes to or reads from another stream.
3429SYS_pause
35162SYS_nanosleep
36105SYS_getitimer
3727SYS_alarm
38104SYS_setitimer
3920SYS_getpid
40187SYS_sendfile
41SYS_socket
42SYS_connect
43SYS_accept
44SYS_sendto
45SYS_recvfrom
46SYS_sendmsg
47SYS_recvmsg
48SYS_shutdown
49SYS_bind
50SYS_listen
51SYS_getsockname
52SYS_getpeername
53SYS_socketpair
54SYS_setsockopt
55SYS_getsockopt
56120SYS_clone
572SYS_forkpid Creates a copy of the running process in memory. Fork returns 0 for the child process and the PID of of child process for the parent.Fork is typically used with execve to spawn a new process and execute another program.
58190SYS_vfork
5911SYS_execve fnameargvenvp Executes executable fname. argv is an array of arguments passed to the executable, and envp is an array containing the environment for the executable.
601SYS_exit
61114SYS_wait4
6237SYS_kill
63122SYS_uname utsname Gets information about the running system.utsname is a structure containing several members defined in sys/utsname.h.
64SYS_semget
65SYS_semop
66SYS_semctl
67SYS_shmdt
68SYS_msgget
69SYS_msgsnd
70SYS_msgrcv
71SYS_msgctl
7255SYS_fcntl
73143SYS_flock
74118SYS_fsync
75148SYS_fdatasync
7692SYS_truncate
7793SYS_ftruncate
78141SYS_getdents
79183SYS_getcwd
8012SYS_chdir
81133SYS_fchdir
8238SYS_rename
8339SYS_mkdir
8440SYS_rmdir
858SYS_creat
869SYS_link
8710SYS_unlink
8883SYS_symlink
8985SYS_readlink
9015SYS_chmod
9194SYS_fchmod
92182SYS_chown
9395SYS_fchown
9416SYS_lchown
9560SYS_umask
9678SYS_gettimeofday
9776SYS_getrlimit
9877SYS_getrusage
99116SYS_sysinfo
10043SYS_times
10126SYS_ptrace
10224SYS_getuid
103103SYS_SYSlog
10447SYS_getgid
10523SYS_setuid
10646SYS_setgid
10749SYS_geteuid
10850SYS_getegid
10957SYS_setpgid
11064SYS_getppid
11165SYS_getpgrp
11266SYS_setsid
11370SYS_setreuid
11471SYS_setregid
11580SYS_getgroups
11681SYS_setgroups
117164SYS_setresuid
118165SYS_getresuid
119170SYS_setresgid
120171SYS_getresgid
121132SYS_getpgid
122138SYS_setfsuid
123139SYS_setfsgid
124147SYS_getsid
125184SYS_capget
126185SYS_capset
127176SYS_rt_sigpending
128177SYS_rt_sigtimedwait
129178SYS_rt_sigqueueinfo
130179SYS_rt_sigsuspend
131186SYS_sigaltstack
13230SYS_utime
13314SYS_mknod
13486SYS_uselib
135136SYS_personality
13662SYS_ustat
13799SYS_statfs
138100SYS_fstatfs
139135SYS_SYSfs
14096SYS_getpriority
14197SYS_setpriority
142154SYS_sched_setparam
143155SYS_sched_getparam
144156SYS_sched_setscheduler
145157SYS_sched_getscheduler
146159SYS_sched_get_priority_max
147160SYS_sched_get_priority_min
148161SYS_sched_rr_get_interval
149150SYS_mlock
150151SYS_munlock
151152SYS_mlockall
152153SYS_munlockall
153111SYS_vhangup
154123SYS_modify_ldt
155217SYS_pivot_root
156149SYS__SYSctl
157172SYS_prctl
158SYS_arch_prctl
159124SYS_adjtimex
16075SYS_setrlimit
16161SYS_chroot
16236SYS_sync
16351SYS_acct
16479SYS_settimeofday
16521SYS_mount
16652SYS_umount2
16787SYS_swapon
168115SYS_swapoff
16988SYS_reboot
17074SYS_sethostnamesuccesshostnamelength Returns 0 on success.
171121SYS_setdomainname
172110SYS_iopl
173101SYS_ioperm
174127SYS_create_module
175128SYS_init_module
176129SYS_delete_module
177130SYS_get_kernel_syms
178167SYS_query_module
179131SYS_quotactl
180169SYS_nfsservctl
181188SYS_getpmsg
182189SYS_putpmsg
183137SYS_afs_SYScall
184SYS_tuxcall
185SYS_security
186224SYS_gettid
187225SYS_readahead
188226SYS_setxattr
189227SYS_lsetxattr
190228SYS_fsetxattr
191229SYS_getxattr
192230SYS_lgetxattr
193231SYS_fgetxattr
194232SYS_listxattr
195233SYS_llistxattr
196234SYS_flistxattr
197235SYS_removexattr
198236SYS_lremovexattr
199237SYS_fremovexattr
200238SYS_tkill
20113SYS_time
202240SYS_futex
203241SYS_sched_setaffinity
204242SYS_sched_getaffinity
205243SYS_set_thread_area
206245SYS_io_setup
207246SYS_io_destroy
208247SYS_io_getevents
209248SYS_io_submit
210249SYS_io_cancel
211244SYS_get_thread_area
212253SYS_lookup_dcookie
213254SYS_epoll_create
214SYS_epoll_ctl_old
215SYS_epoll_wait_old
216257SYS_remap_file_pages
217220SYS_getdents64
218258SYS_set_tid_address
2190SYS_restart_SYScall
220SYS_semtimedop
221250SYS_fadvise64 fdoffsetlengthadvice Provides hints (advice) to the kernel about how an open file will be read.
222259SYS_timer_create
223260SYS_timer_settime
224261SYS_timer_gettime
225262SYS_timer_getoverrun
226263SYS_timer_delete
227264SYS_clock_settime
228265SYS_clock_gettime
229266SYS_clock_getres
230267SYS_clock_nanosleep
231252SYS_exit_group
232256SYS_epoll_wait
233255SYS_epoll_ctl
234270SYS_tgkill
235271SYS_utimes
236273SYS_vserver
237274SYS_mbind
238276SYS_set_mempolicy
239275SYS_get_mempolicy
240277SYS_mq_open
241278SYS_mq_unlink
242279SYS_mq_timedsend
243280SYS_mq_timedreceive
244281SYS_mq_notify
245282SYS_mq_getsetattr
246283SYS_kexec_load
247284SYS_waitid
248286SYS_add_key
249287SYS_request_key
250288SYS_keyctl
251289SYS_ioprio_set
252290SYS_ioprio_get
253291SYS_inotify_init
254292SYS_inotify_add_watch
255293SYS_inotify_rm_watch
256294SYS_migrate_pages
257295SYS_openat
258296SYS_mkdirat
259297SYS_mknodat
260298SYS_fchownat
261299SYS_futimesat
262SYS_newfstatat
263301SYS_unlinkat
264302SYS_renameat
265303SYS_linkat
266304SYS_symlinkat
267305SYS_readlinkat
268306SYS_fchmodat
269307SYS_faccessat
270308SYS_pselect6
271309SYS_ppoll
272310SYS_unshare
273311SYS_set_robust_list
274312SYS_get_robust_list
275313SYS_splice
276315SYS_tee
277314SYS_sync_file_range
278316SYS_vmsplice
279317SYS_move_pages
280320SYS_utimensat
281319SYS_epoll_pwait
282321SYS_signalfd
283322SYS_timerfd_create
284323SYS_eventfd
285324SYS_fallocate
286325SYS_timerfd_settime
287326SYS_timerfd_gettime
288SYS_accept4
289327SYS_signalfd4
290328SYS_eventfd2
291329SYS_epoll_create1
292330SYS_dup3
293331SYS_pipe2
294332SYS_inotify_init1
295333SYS_preadv
296334SYS_pwritev
297335SYS_rt_tgsigqueueinfo
298336SYS_perf_event_open
299337SYS_recvmmsg
300338SYS_fanotify_init
301339SYS_fanotify_mark
302340SYS_prlimit64
303341SYS_name_to_handle_at
304342SYS_open_by_handle_at
305343SYS_clock_adjtime
306344SYS_syncfs
307345SYS_sendmmsg
308346SYS_setns
309318SYS_getcpu
310347SYS_process_vm_readv
311348SYS_process_vm_writev
312349SYS_kcmp
313350SYS_finit_module
314351SYS_sched_setattr
315352SYS_sched_getattr
316353SYS_renameat2
317354SYS_seccomp
318355SYS_getrandom
319356SYS_memfd_create
320SYS_kexec_file_load
321357SYS_bpf