Jump to content

The Linux Kernel/Syscalls

From Wikibooks, open books for an open world

Linux kernel system calls as exported by glibc, all on one sheet

System 

sys/ioctl.h:
ioctl

sys/random.h:
getrandom

pci.h:
pciconfig_read
pciconfig_write

linux/sysctl.h:
sysctl

linux/membarrier.h:
membarrier

sys/klog.h:
syslog

linux/bpf.h:
bpf

grp.h:
setgroups

sys/utsname.h:
uname

linux/getcpu.h:
getcpu

sys/sysinfo.h:
sysinfo

sys/personality.h:
personality

sys/ptrace.h:
ptrace

linux/kexec.h:
kexec_file_load
kexec_load

linux/reboot.h:
reboot

Unexported:
delete_module
init_module
finit_module
perf_event_op
rseq
Time

sys/time.h:
futimesat
utimes
gettimeofday
settimeofday
getitimer, setitimer

time.h:
clock_settime
clock_gettime
clock_getres
clock_nanosleep
time
stime
nanosleep

posix-timers.c:
timer_create
timer_gettime
timer_getoverrun
timer_settime
timer_delete

sys/timerfd.h:
timerfd_create
timerfd_settime
timerfd_gettime

sys/eventfd.h:
eventfd2
eventfd

utime.h:
utime

sys/times.h:
times

bits/time.h:
clock_adjtime

sys/timex.h:
adjtimex
Processes

unistd.h:
fork, vfork
brk
getpid, getppid, getpgrp
uselib
execve, execveat
nice
getgroups
getgid, setgid
getuid, setuid
getresuid, setresuid
getresgid, setresgid
getsid, setsid
setpgid, getpgid
getegid, geteuid 
setreuid, setregid
pause
alarm
acct

sys/prctl.h:
prctl
 
sched.h:
clone
sched_setscheduler
sched_setparam
sched_setattr
sched_getscheduler
sched_getparam
sched_getattr
sched_setaffinity
sched_getaffinity
sched_yield
sched_get_priority_max
sched_get_priority_min
sched_rr_get_interval
unshare
setns

linux/unistd.h:
set_tid_address
exit_group

sys/resource.h:
setpriority, getpriority
getrlimit setrlimit
getrusage
gettid

linux/kcmp.h:
kcmp

sys/capability.h:
capget, capset

stdlib.h:
exit
Synchronization

sys/sem.h:
semget
semctl
semtimedop
semop

mqueue.h:
mq_open
mq_unlink
mq_timedsend
mq_timedreceive
mq_notify

sys/msg.h:
msgget
msgctl
msgsnd
msgrcv

sys/wait.h:
waitid
wait4
waitpid

sys/signalfd.h:
signalfd4
signalfd

signal.h:
kill
sigtimedwait
sigaltstack
sigpending
sigprocmask
sigaction
signal
sigsuspend

Unexported:
futex
set_robust_list
get_robust_list

restart_syscall
tgkill
rt_sigqueueinfo
rt_tgsigqueueinfo

mq_getsetattr
Memory 

numaif.h:
mbind
set_mempolicy
migrate_pages
get_mempolicy

numaif.h:
move_pages

sys/mman.h:
msync
mincore
munmap
remap_file_pages
mremap
mlock, mlock2
munlockmlockall
munlockall
mprotect
pkey_mprotect
pkey_alloc
pkey_free
madvise

sys/shm.h: 

shmget, shmctl
shmat, shmdt

sys/swap.h:
swapoff, swapon

sys/memfd.h: 
memfd_create

Security

sys/fsuid.h:
setfsuid
setfsgid

keyutils.h:
add_key
request_key
keyctl

Unexported:
seccomp
Metadata

sys/stat.h:
stat

sys/statfs.h:
statfs
fstatfs

sys/inotify.h:
inotify_init1
inotify_init
inotify_add_watch
inotify_rm_watch

sys/fanotify.h:
fanotify_init
fanotify_mark

sys/xattr.h:
setxattr
lsetxattr
fsetxattr
getxattr
lgetxattr
fgetxattr
listxattr
llistxattr
flistxattr
removexattr
lremovexattr
fremovexattr

sys/quota.h:
quotactl

stdio.h:
renameat
rename

Unexported:
statx
io_getevents
io_pgetevents
fsopen
fspick
lookup_dcookie
renameat2
fsinfo
open_tree
fsmount
move_mount
pivot_root
getdents
vmsplice
name_to_handle_at
open_by_handle_at
pselect6
userfaultfd
mmap_pgoff
ioprio_set
ioprio_get
Data

fcntl.h:
open, openat
fcntl
sync_file_range
fallocate
creat
splice
tee
readahead

unistd.h:
truncate, ftruncate
faccessat, access
fchdir, chdir 
chroot
fchownat, chown
lchown, fchown
close
vhangup
pipe, pipe2
sync, syncfs
fsync, fdatasync
dup, dup2, dup3
lseek
read, write
copy_file_range

sys/uio.h:
readv, writev
preadv, pwritev
preadv2, pwritev2
process_vm_readv
process_vm_writev

sys/file.h:
flock

sys/mount.h:
mount, umount

Nonblocking IO

sys/epoll.h:
epoll_create1
epoll_create
epoll_ctl
epoll_wait
epoll_pwait

sys/select.h:
select

poll.h:
poll, ppoll

linux/aio_abi.h:
io_setup
io_destroy
io_submit
io_cancel
Network

sys/socket.h:
socket, socketpair
bind
listen
accept, accept4
connect
getsockname
getpeername
send, recv
sendto, recvfrom
setsockopt, getsockopt
shutdown
sendmsg, sendmmsg
recvmsg, recvmmsg

linux/net.h:
socketcall

sys/sendfile.h:
sendfile
unistd.h:
sethostname
gethostname
setdomainname
Obsolete:
ipc, sgetmask, ssetmask, sysfs

Descriptions

[edit | edit source]

accept, accept4 - accept a connection on a socket

access, faccessat - check user's permissions for a file

acct - switch process accounting on or off

add_key - add a key to the kernel's key management facility

adjtimex, ntp_adjtime - tune kernel clock

afs_syscall, break, fattach, fdetach, ftime, getmsg, getpmsg, gtty, isastream, lock, madvise1, mpx, prof, profil, putmsg, putpmsg, security, stty, tuxcall, ulimit, vserver - unimplemented system calls

alarm - set an alarm clock for delivery of a signal

alloc_hugepages, free_hugepages - allocate or free huge pages

arch_prctl - set architecture-specific thread state

bdflush - start, flush, or tune buffer-dirty-flush daemon

bind - bind a name to a socket

bpf - perform a command on an extended BPF map or program

brk, sbrk - change data segment size

cacheflush - flush contents of instruction and/or data cache

capget, capset - set/get capabilities of thread(s)

chdir, fchdir - change working directory

chmod, fchmod, fchmodat - change permissions of a file

chown, fchown, lchown, fchownat - change ownership of a file

chroot - change root directory

clock_getres, clock_gettime, clock_settime - clock and time functions

clock_nanosleep - high-resolution sleep with specifiable clock

clone, __clone2 - create a child process

close - close a file descriptor

connect - initiate a connection on a socket

copy_file_range - Copy a range of data from one file to another

create_module - create a loadable module entry

delete_module - unload a kernel module

dup, dup2, dup3 - duplicate a file descriptor

epoll_create, epoll_create1 - open an epoll file descriptor

epoll_ctl - control interface for an epoll file descriptor

epoll_wait, epoll_pwait - wait for an I/O event on an epoll file descriptor

eventfd - create a file descriptor for event notification

execveat - execute program relative to a directory file descriptor

execve - execute program

_exit, _Exit - terminate the calling process

exit_group - exit all threads in a process

fallocate - manipulate file space

fanotify_init - create and initialize fanotify group

fanotify_mark - add, remove, or modify an fanotify mark on a filesystem object

fcntl - manipulate file descriptor

flock - apply or remove an advisory lock on an open file

fork - create a child process

fsync, fdatasync - synchronize a file's in-core state with storage device

futex - fast user-space locking

futimesat - change timestamps of a file relative to a directory file descriptor

getcontext, setcontext - get or set the user context

getcpu - determine CPU and NUMA node on which the calling thread is running

getcwd, getwd, get_current_dir_name - get current working directory

getdents, getdents64 - get directory entries

getdomainname, setdomainname - get/set NIS domain name

getdtablesize - get file descriptor table size

getgid, getegid - get group identity

getgroups, setgroups - get/set list of supplementary group IDs

gethostid, sethostid - get or set the unique identifier of the current host

gethostname, sethostname - get/set hostname

getitimer, setitimer - get or set value of an interval timer

get_kernel_syms - retrieve exported kernel and module symbols

get_mempolicy - retrieve NUMA memory policy for a thread

getpagesize - get memory page size

getpeername - get name of connected peer socket

getpid, getppid - get process identification

getpriority, setpriority - get/set program scheduling priority

getrandom - obtain a series of random bytes

getresuid, getresgid - get real, effective and saved user/group IDs

getrlimit, setrlimit, prlimit - get/set resource limits

get_robust_list, set_robust_list - get/set list of robust futexes

getrusage - get resource usage

getsid - get session ID

getsockname - get socket name

getsockopt, setsockopt - get and set options on sockets

get_thread_area, set_thread_area - set a GDT entry for thread-local storage

gettid - get thread identification

gettimeofday, settimeofday - get / set time

getuid, geteuid - get user identity

getunwind - copy the unwind data to caller's buffer

idle - make process 0 idle

init_module, finit_module - load a kernel module

inotify_add_watch - add a watch to an initialized inotify instance

inotify_init, inotify_init1 - initialize an inotify instance

inotify_rm_watch - remove an existing watch from an inotify instance

intro - introduction to system calls

io_cancel - cancel an outstanding asynchronous I/O operation

ioctl_console - ioctls for console terminal and virtual consoles

ioctl - control device

ioctl_fat - manipulating the FAT filesystem

ioctl_ficlonerange, ioctl_ficlone - share some the data of one file with another file

ioctl_fideduperange - share some the data of one file with another file

ioctl_getfsmap - retrieve the physical layout of the filesystem

ioctl_iflags - ioctl() operations for inode flags

ioctl_list - list of ioctl calls in Linux/i386 kernel

ioctl_ns - ioctl() operations for Linux namespaces

ioctl_tty - ioctls for terminals and serial lines

ioctl_userfaultfd - create a file descriptor for handling page faults in user space

io_destroy - destroy an asynchronous I/O context

io_getevents - read asynchronous I/O events from the completion queue

ioperm - set port input/output permissions

iopl - change I/O privilege level

ioprio_get, ioprio_set - get/set I/O scheduling class and priority

io_setup - create an asynchronous I/O context

io_submit - submit asynchronous I/O blocks for processing

ipc - System V IPC system calls

kcmp - compare two processes to determine if they share a kernel resource

kexec_load, kexec_file_load - load a new kernel for later execution

keyctl - manipulate the kernel's key management facility

killpg - send signal to a process group

kill - send signal to a process

link, linkat - make a new name for a file

listen - listen for connections on a socket

_llseek - reposition read/write file offset

lookup_dcookie - return a directory entry's path

lseek - reposition read/write file offset

madvise - give advice about use of memory

mbind - set memory policy for a memory range

membarrier - issue memory barriers on a set of threads

memfd_create - create an anonymous file

migrate_pages - move all pages in a process to another set of nodes

mincore - determine whether pages are resident in memory

mkdir, mkdirat - create a directory

mknod, mknodat - create a special or ordinary file

mlock, mlock2, munlock, mlockall, munlockall - lock and unlock memory

mmap2 - map files or devices into memory

mmap, munmap - map or unmap files or devices into memory

modify_ldt - get or set a per-process LDT entry

mount - mount filesystem

move_pages - move individual pages of a process to another node

mprotect, pkey_mprotect - set protection on a region of memory

mq_getsetattr - get/set message queue attributes

mq_notify - register for notification when a message is available

mq_open - open a message queue

mq_receive, mq_timedreceive - receive a message from a message queue

mq_send, mq_timedsend - send a message to a message queue

mq_unlink - remove a message queue

mremap - remap a virtual memory address

msgctl - System V message control operations

msgget - get a System V message queue identifier

msgrcv, msgsnd - System V message queue operations

msync - synchronize a file with a memory map

name_to_handle_at, open_by_handle_at - obtain handle for a pathname and open file via a handle

nanosleep - high-resolution sleep

nfsservctl - syscall interface to kernel nfs daemon

nice - change process priority

open, openat, creat - open and possibly create a file

outb, outw, outl, outsb, outsw, outsl, inb, inw, inl, insb, insw, insl, outb_p, outw_p, outl_p, inb_p, inw_p, inl_p - port I/O

pause - wait for signal

pciconfig_read, pciconfig_write, pciconfig_iobase - pci device information handling

perf_event_open - set up performance monitoring

perfmonctl - interface to IA-64 performance monitoring unit

personality - set the process execution domain

pipe, pipe2 - create pipe

pivot_root - change the root filesystem

pkey_alloc, pkey_free - allocate or free a protection key

poll, ppoll - wait for some event on a file descriptor

posix_fadvise - predeclare an access pattern for file data

prctl - operations on a process

pread, pwrite - read from or write to a file descriptor at a given offset

process_vm_readv, process_vm_writev - transfer data between process address spaces

ptrace - process trace

query_module - query the kernel for various bits pertaining to modules

quotactl - manipulate disk quotas

readahead - initiate file readahead into page cache

readdir - read directory entry

readlink, readlinkat - read value of a symbolic link

read - read from a file descriptor

readv, writev, preadv, pwritev, preadv2, pwritev2 - read or write data into multiple buffers

reboot - reboot or enable/disable Ctrl-Alt-Del

recvmmsg - receive multiple messages on a socket

recv, recvfrom, recvmsg - receive a message from a socket

remap_file_pages - create a nonlinear file mapping

rename, renameat, renameat2 - change the name or location of a file

request_key - request a key from the kernel's key management facility

restart_syscall - restart a system call after interruption by a stop signal

rmdir - delete a directory

rt_sigqueueinfo, rt_tgsigqueueinfo - queue a signal and data

s390_pci_mmio_write, s390_pci_mmio_read - transfer data to/from PCI MMIO memory page

s390_runtime_instr - enable/disable s390 CPU run-time instrumentation

s390_sthyi - emulate STHYI instruction

sched_get_priority_max, sched_get_priority_min - get static priority range

sched_rr_get_interval - get the SCHED_RR interval for the named process

sched_setaffinity, sched_getaffinity - set and get a thread's CPU affinity mask

sched_setattr, sched_getattr - set and get scheduling policy and attributes

sched_setparam, sched_getparam - set and get scheduling parameters

sched_setscheduler, sched_getscheduler - set and get scheduling policy/parameters

sched_yield - yield the processor

seccomp - operate on Secure Computing state of the process

select, pselect, FD_CLR, FD_ISSET, FD_SET, FD_ZERO - synchronous I/O multiplexing

semctl - System V semaphore control operations

semget - get a System V semaphore set identifier

semop, semtimedop - System V semaphore operations

sendfile - transfer data between file descriptors

sendmmsg - send multiple messages on a socket

send, sendto, sendmsg - send a message on a socket

seteuid, setegid - set effective user or group ID

setfsgid - set group identity used for filesystem checks

setfsuid - set user identity used for filesystem checks

setgid - set group identity

set_mempolicy - set default NUMA memory policy for a thread and its children

setns - reassociate thread with a namespace

setpgid, getpgid, setpgrp, getpgrp - set/get process group

setresuid, setresgid - set real, effective and saved user or group ID

setreuid, setregid - set real and/or effective user or group ID

setsid - creates a session and sets the process group ID

set_tid_address - set pointer to thread ID

setuid - set user identity

setup - setup devices and filesystems, mount root filesystem

sgetmask, ssetmask - manipulation of signal mask (obsolete)

shmat, shmdt - System V shared memory operations

shmctl - System V shared memory control

shmget - allocates a System V shared memory segment

shutdown - shut down part of a full-duplex connection

sigaction, rt_sigaction - examine and change a signal action

sigaltstack - set and/or get signal stack context

signal - ANSI C signal handling

signalfd - create a file descriptor for accepting signals

sigpending, rt_sigpending - examine pending signals

sigprocmask, rt_sigprocmask - examine and change blocked signals

sigqueue - queue a signal and data to a process

sigreturn, rt_sigreturn - return from signal handler and cleanup stack frame

sigsuspend, rt_sigsuspend - wait for a signal

sigwaitinfo, sigtimedwait, rt_sigtimedwait - synchronously wait for queued signals

socketcall - socket system calls

socket - create an endpoint for communication

socketpair - create a pair of connected sockets

splice - splice data to/from a pipe

spu_create - create a new spu context

spu_run - execute an SPU context

statfs, fstatfs - get filesystem statistics

stat, fstat, lstat, fstatat - get file status

statvfs, fstatvfs - get filesystem statistics

statx - get file status (extended)

stime - set time

subpage_prot - define a subpage protection for an address range

swapon, swapoff - start/stop swapping to file/device

symlink, symlinkat - make a new name for a file

sync_file_range - sync a file segment with disk

sync, syncfs - commit filesystem caches to disk

syscall - indirect system call

_syscall - invoking a system call without library support (OBSOLETE)

syscalls - Linux system calls

sysctl - read/write system parameters

sysfs - get filesystem type information

sysinfo - return system information

syslog, klogctl - read and/or clear kernel message ring buffer; set console_loglevel

tee - duplicating pipe content

time - get time in seconds

timer_create - create a POSIX per-process timer

timer_delete - delete a POSIX per-process timer

timerfd_create, timerfd_settime, timerfd_gettime - timers that notify via file descriptors

timer_getoverrun - get overrun count for a POSIX per-process timer

timer_settime, timer_gettime - arm/disarm and fetch state of POSIX per-process timer

times - get process times

tkill, tgkill - send a signal to a thread

truncate, ftruncate - truncate a file to a specified length

umask - set file mode creation mask

umount, umount2 - unmount filesystem

uname - get name and information about current kernel

unlink, unlinkat - delete a name and possibly the file it refers to

unshare - disassociate parts of the process execution context

uselib - load shared library

userfaultfd - create a file descriptor for handling page faults in user space

ustat - get filesystem statistics

utimensat, futimens - change file timestamps with nanosecond precision

utime, utimes - change file last access and modification times

vfork - create a child process and block parent

vhangup - virtually hangup the current terminal

vm86old, vm86 - enter virtual 8086 mode

vmsplice - splice user pages into a pipe

wait3, wait4 - wait for process to change state, BSD style

wait, waitpid, waitid - wait for process to change state

write - write to a file descriptor

Links:

[edit | edit source]