1 .\" Copyright (C) 2007 Michael Kerrisk <mtk.manpages@gmail.com>
3 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
5 .\" 2007-10-23 mtk: moved the _syscallN specific material to the
6 .\" new _syscall(2) page, and substantially enhanced and rewrote
7 .\" the remaining material on this page.
9 .TH INTRO 2 2022-09-09 "Linux man-pages (unreleased)"
11 intro \- introduction to system calls
13 Section 2 of the manual describes the Linux system calls.
14 A system call is an entry point into the Linux kernel.
15 Usually, system calls are not invoked directly:
16 instead, most system calls have corresponding C library
17 wrapper functions which perform the steps required
18 (e.g., trapping to kernel mode) in order to invoke
20 Thus, making a system call looks the same as invoking a normal
23 In many cases, the C library wrapper function does nothing more than:
25 copying arguments and the unique system call number to the
26 registers where the kernel expects them;
28 trapping to kernel mode,
29 at which point the kernel does the real work of the system call;
33 if the system call returns an error number when the kernel returns the
36 However, in a few cases, a wrapper function may do rather more than this,
37 for example, performing some preprocessing
38 of the arguments before trapping to kernel mode,
39 or postprocessing of values returned by the system call.
40 Where this is the case, the manual pages in Section 2 generally
41 try to note the details of both the (usually GNU) C library API
42 interface and the raw system call.
43 Most commonly, the main DESCRIPTION will focus on the C library interface,
44 and differences for the system call are covered in the NOTES section.
46 For a list of the Linux system calls, see
49 On error, most system calls return a negative error number
50 (i.e., the negated value of one of the constants described in
52 The C library wrapper hides this detail from the caller: when a
53 system call returns a negative value, the wrapper copies the
54 absolute value into the
56 variable, and returns \-1 as the return value of the wrapper.
58 The value returned by a successful system call depends on the call.
59 Many system calls return 0 on success, but some can return nonzero
60 values from a successful call.
61 The details are described in the individual manual pages.
64 the programmer must define a feature test macro in order to obtain
65 the declaration of a system call from the header file specified
66 in the man page SYNOPSIS section.
67 (Where required, these feature test macros must be defined before including
70 In such cases, the required macro is described in the man page.
71 For further information on feature test macros, see
72 .BR feature_test_macros (7).
74 Certain terms and abbreviations are used to indicate UNIX variants
75 and standards to which calls in this section conform.
80 In most cases, it is unnecessary to invoke a system call directly,
81 but there are times when the Standard C library does not implement
82 a nice wrapper function for you.
83 In this case, the programmer must manually invoke the system call using
85 Historically, this was also possible using one of the _syscall macros
88 .SS Authors and copyright conditions
89 Look at the header of the manual page source for the author(s) and copyright
91 Note that these can be different from page to page!
100 .BR capabilities (7),
102 .BR feature_test_macros (7),
104 .BR path_resolution (7),
107 .BR sem_overview (7),
108 .BR shm_overview (7),
113 .BR system_data_types (7),