SYSCALLS(2) Linux Programmer's Manual SYSCALLS(2)
syscalls - Linux system calls
Linux system calls.
The system call is the fundamental interface between an application and the Linux kernel.
System calls and library wrapper functions
System calls are generally not invoked directly, but rather via wrapper functions in glibc (or perhaps some other library). For
details of direct invocation of a system call, see intro(2). Often, but not always, the name of the wrapper function is the same
as the name of the system call that it invokes. For example, glibc contains a function truncate() which invokes the underlying
"truncate" system call.
Often the glibc wrapper function is quite thin, doing little work other than copying arguments to the right registers before
invoking the system call, and then setting errno appropriately after the system call has returned. (These are the same steps
that are performed by syscall(2), which can be used to invoke system calls for which no wrapper function is provided.) Note:
system calls indicate a failure by returning a negative error number to the caller; when this happens, the wrapper function
negates the returned error number (to make it positive), copies it to errno, and returns -1 to the caller of the wrapper.
Sometimes, however, the wrapper function does some extra work before invoking the system call. For example, nowadays there are
(for reasons described below) two related system calls, truncate(2) and truncate64(2), and the glibc truncate() wrapper function
checks which of those system calls are provided by the kernel and determines which should be employed.
System call list
Below is a list of the Linux system calls. In the list, the Kernel column indicates the kernel version for those system calls
that were new in Linux 2.2, or have appeared since that kernel version. Note the following points:
* Where no kernel version is indicated, the system call appeared in kernel 1.0 or earlier.
* Where a system call is marked "1.2" this means the system call probably appeared in a 1.1.x kernel version, and first appeared
in a stable kernel with 1.2. (Development of the 1.2 kernel was initiated from a branch of kernel 1.0.6 via the 1.1.x unsta‐
ble kernel series.)
* Where a system call is marked "2.0" this means the system call probably appeared in a 1.3.x kernel version, and first appeared
in a stable kernel with 2.0. (Development of the 2.0 kernel was initiated from a branch of kernel 1.2.x, somewhere around
1.2.10, via the 1.3.x unstable kernel series.)
* Where a system call is marked "2.2" this means the system call probably appeared in a 2.1.x kernel version, and first appeared
in a stable kernel with 2.2.0. (Development of the 2.2 kernel was initiated from a branch of kernel 2.0.21 via the 2.1.x