share/mk/: build-html: Don't build mbind.2 and set_mempolicy.2
[man-pages.git] / man2 / intro.2
blob3986bb0a1edd72ca3fe3051160d6d7d268114b96
1 .\" Copyright (C) 2007 Michael Kerrisk <mtk.manpages@gmail.com>
2 .\"
3 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
4 .\"
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.
8 .\"
9 .TH intro 2 (date) "Linux man-pages (unreleased)"
10 .SH NAME
11 intro \- introduction to system calls
12 .SH DESCRIPTION
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
19 the system call.
20 Thus, making a system call looks the same as invoking a normal
21 library function.
23 In many cases, the C library wrapper function does nothing more than:
24 .IP \[bu] 3
25 copying arguments and the unique system call number to the
26 registers where the kernel expects them;
27 .IP \[bu]
28 trapping to kernel mode,
29 at which point the kernel does the real work of the system call;
30 .IP \[bu]
31 setting
32 .I errno
33 if the system call returns an error number when the kernel returns the
34 CPU to user mode.
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
47 .BR syscalls (2).
48 .SH RETURN VALUE
49 On error, most system calls return a negative error number
50 (i.e., the negated value of one of the constants described in
51 .BR errno (3)).
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
55 .I errno
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.
63 In some cases,
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
68 .I any
69 header files.)
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).
73 .SH STANDARDS
74 Certain terms and abbreviations are used to indicate UNIX variants
75 and standards to which calls in this section conform.
76 See
77 .BR standards (7).
78 .SH NOTES
79 .SS Calling directly
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
84 .BR syscall (2).
85 Historically, this was also possible using one of the _syscall macros
86 described in
87 .BR _syscall (2).
88 .SS Authors and copyright conditions
89 Look at the header of the manual page source for the author(s) and copyright
90 conditions.
91 Note that these can be different from page to page!
92 .SH SEE ALSO
93 .ad l
94 .nh
95 .BR _syscall (2),
96 .BR syscall (2),
97 .BR syscalls (2),
98 .BR errno (3),
99 .BR intro (3),
100 .BR capabilities (7),
101 .BR credentials (7),
102 .BR feature_test_macros (7),
103 .BR mq_overview (7),
104 .BR path_resolution (7),
105 .BR pipe (7),
106 .BR pty (7),
107 .BR sem_overview (7),
108 .BR shm_overview (7),
109 .BR signal (7),
110 .BR socket (7),
111 .BR standards (7),
112 .BR symlink (7),
113 .BR system_data_types (7),
114 .BR sysvipc (7),
115 .BR time (7)