ioctl_userfaultfd.2, madvise.2, memfd_create.2, migrate_pages.2, mmap.2, shmget.2...
[man-pages.git] / man2 / syscalls.2
blob2badb24025c054efbf0de7d18568a82bba3e4743
1 .\" Copyright (C) 2007 Michael Kerrisk <mtk.manpages@gmail.com>
2 .\" with some input from Stepan Kasal <kasal@ucw.cz>
3 .\"
4 .\" Some content retained from an earlier version of this page:
5 .\" Copyright (C) 1998 Andries Brouwer (aeb@cwi.nl)
6 .\" Modifications for 2.2 and 2.4 Copyright (C) 2002 Ian Redfern
7 .\" <redferni@logica.com>
8 .\"
9 .\" %%%LICENSE_START(VERBATIM)
10 .\" Permission is granted to make and distribute verbatim copies of this
11 .\" manual provided the copyright notice and this permission notice are
12 .\" preserved on all copies.
13 .\"
14 .\" Permission is granted to copy and distribute modified versions of this
15 .\" manual under the conditions for verbatim copying, provided that the
16 .\" entire resulting derived work is distributed under the terms of a
17 .\" permission notice identical to this one.
18 .\"
19 .\" Since the Linux kernel and libraries are constantly changing, this
20 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
21 .\" responsibility for errors or omissions, or for damages resulting from
22 .\" the use of the information contained herein.  The author(s) may not
23 .\" have taken the same level of care in the production of this manual,
24 .\" which is licensed free of charge, as they might when working
25 .\" professionally.
26 .\"
27 .\" Formatted or processed versions of this manual, if unaccompanied by
28 .\" the source, must acknowledge the copyright and authors of this work.
29 .\" %%%LICENSE_END
30 .\"
31 .TH SYSCALLS 2 2018-02-02 "Linux" "Linux Programmer's Manual"
32 .SH NAME
33 syscalls \- Linux system calls
34 .SH SYNOPSIS
35 Linux system calls.
36 .SH DESCRIPTION
37 The system call is the fundamental interface between an application
38 and the Linux kernel.
39 .SS System calls and library wrapper functions
40 System calls are generally not invoked directly,
41 but rather via wrapper functions in glibc (or perhaps some other library).
42 For details of direct invocation of a system call, see
43 .BR intro (2).
44 Often, but not always, the name of the wrapper function is the same
45 as the name of the system call that it invokes.
46 For example, glibc contains a function
47 .BR chdir ()
48 which invokes the underlying "chdir" system call.
49 .PP
50 Often the glibc wrapper function is quite thin, doing little work
51 other than copying arguments to the right registers
52 before invoking the system call,
53 and then setting
54 .I errno
55 appropriately after the system call has returned.
56 (These are the same steps that are performed by
57 .BR syscall (2),
58 which can be used to invoke system calls
59 for which no wrapper function is provided.)
60 Note: system calls indicate a failure by returning a negative error
61 number to the caller on architectures without a separate error register/flag,
62 as noted in
63 .BR syscall (2);
64 when this happens,
65 the wrapper function negates the returned error number
66 (to make it positive), copies it to
67 .IR errno ,
68 and returns \-1 to the caller of the wrapper.
69 .PP
70 Sometimes, however, the wrapper function does some extra work
71 before invoking the system call.
72 For example, nowadays there are (for reasons described below) two
73 related system calls,
74 .BR truncate (2)
75 and
76 .BR truncate64 (2),
77 and the glibc
78 .BR truncate ()
79 wrapper function checks which of those system calls
80 are provided by the kernel and determines which should be employed.
81 .SS System call list
82 Below is a list of the Linux system calls.
83 In the list, the
84 .I Kernel
85 column indicates the kernel version
86 for those system calls that were new in Linux 2.2,
87 or have appeared since that kernel version.
88 Note the following points:
89 .IP * 3
90 Where no kernel version is indicated,
91 the system call appeared in kernel 1.0 or earlier.
92 .IP *
93 Where a system call is marked "1.2"
94 this means the system call probably appeared in a 1.1.x kernel version,
95 and first appeared in a stable kernel with 1.2.
96 (Development of the 1.2 kernel was initiated from a branch of kernel
97 1.0.6 via the 1.1.x unstable kernel series.)
98 .IP *
99 Where a system call is marked "2.0"
100 this means the system call probably appeared in a 1.3.x kernel version,
101 and first appeared in a stable kernel with 2.0.
102 (Development of the 2.0 kernel was initiated from a branch of kernel
103 1.2.x, somewhere around 1.2.10,
104 via the 1.3.x unstable kernel series.)
105 .\" Was kernel 2.0 started from a branch of 1.2.10?
106 .\" At least from the timestamps of the tarballs of
107 .\" of 1.2.10 and 1.3.0, that's how it looks, but in
108 .\" fact the diff doesn't seem very clear, the
109 .\" 1.3.0 .tar.bz is much bigger (2.0 MB) than the
110 .\" 1.2.10 .tar.bz2 (1.8 MB), and AEB points out the
111 .\" timestamps of some files in 1.3.0 seem to be older
112 .\" than those in 1.2.10.  All of this suggests
113 .\" that there might not have been a clean branch point.
114 .IP *
115 Where a system call is marked "2.2"
116 this means the system call probably appeared in a 2.1.x kernel version,
117 and first appeared in a stable kernel with 2.2.0.
118 (Development of the 2.2 kernel was initiated from a branch of kernel
119 2.0.21 via the 2.1.x unstable kernel series.)
120 .IP *
121 Where a system call is marked "2.4"
122 this means the system call probably appeared in a 2.3.x kernel version,
123 and first appeared in a stable kernel with 2.4.0.
124 (Development of the 2.4 kernel was initiated from a branch of
125 kernel 2.2.8 via the 2.3.x unstable kernel series.)
126 .IP *
127 Where a system call is marked "2.6"
128 this means the system call probably appeared in a 2.5.x kernel version,
129 and first appeared in a stable kernel with 2.6.0.
130 (Development of kernel 2.6 was initiated from a branch
131 of kernel 2.4.15 via the 2.5.x unstable kernel series.)
132 .IP *
133 Starting with kernel 2.6.0, the development model changed,
134 and new system calls may appear in each 2.6.x release.
135 In this case, the exact version number where the system call appeared
136 is shown.
137 This convention continues with the 3.x kernel series,
138 which followed on from kernel 2.6.39, and the 4.x kernel series,
139 which followed on from kernel 3.19.
140 .IP *
141 In some cases, a system call was added to a stable kernel
142 series after it branched from the previous stable kernel
143 series, and then backported into the earlier stable kernel series.
144 For example some system calls that appeared in 2.6.x were also backported
145 into a 2.4.x release after 2.4.15.
146 When this is so, the version where the system call appeared
147 in both of the major kernel series is listed.
149 The list of system calls that are available as at kernel 4.19
150 (or in a few cases only on older kernels) is as follows:
152 .\" Looking at scripts/checksyscalls.sh in the kernel source is
153 .\" instructive about x86 specifics.
155 .ad l
157 l2 le l
159 l l l.
160 \fBSystem call\fP       \fBKernel\fP    \fBNotes\fP
162 \fB_llseek\fP(2)        1.2
163 \fB_newselect\fP(2)     2.0
164 \fB_sysctl\fP(2)        2.0
165 \fBaccept\fP(2) 2.0     See notes on \fBsocketcall\fP(2)
166 \fBaccept4\fP(2)        2.6.28
167 \fBaccess\fP(2) 1.0
168 \fBacct\fP(2)   1.0
169 \fBadd_key\fP(2)        2.6.10
170 \fBadjtimex\fP(2)       1.0
171 \fBalarm\fP(2)  1.0
172 \fBalloc_hugepages\fP(2)        2.5.36  Removed in 2.5.44
173 \fBbdflush\fP(2)        1.2     T{
174 Deprecated (does nothing)
176 since 2.6
178 \fBbind\fP(2)   2.0     See notes on \fBsocketcall\fP(2)
179 \fBbpf\fP(2)    3.18
180 \fBbrk\fP(2)    1.0
181 \fBcacheflush\fP(2)     1.2     Not on x86
182 \fBcapget\fP(2) 2.2
183 \fBcapset\fP(2) 2.2
184 \fBchdir\fP(2)  1.0
185 \fBchmod\fP(2)  1.0
186 \fBchown\fP(2)  2.2     T{
187 See \fBchown\fP(2) for
189 version details
191 \fBchown32\fP(2)        2.4
192 \fBchroot\fP(2) 1.0
193 \fBclock_adjtime\fP(2)  2.6.39
194 \fBclock_getres\fP(2)   2.6
195 \fBclock_gettime\fP(2)  2.6
196 \fBclock_nanosleep\fP(2)        2.6
197 \fBclock_settime\fP(2)  2.6
198 \fBclone\fP(2)  1.0
199 \fBclose\fP(2)  1.0
200 \fBconnect\fP(2)        2.0     See notes on \fBsocketcall\fP(2)
201 \fBcopy_file_range\fP(2)        4.5
202 \fBcreat\fP(2)  1.0
203 \fBcreate_module\fP(2)  1.0     Removed in 2.6
204 \fBdelete_module\fP(2)  1.0
205 \fBdup\fP(2)    1.0
206 \fBdup2\fP(2)   1.0
207 \fBdup3\fP(2)   2.6.27
208 \fBepoll_create\fP(2)   2.6
209 \fBepoll_create1\fP(2)  2.6.27
210 \fBepoll_ctl\fP(2)      2.6
211 \fBepoll_pwait\fP(2)    2.6.19
212 \fBepoll_wait\fP(2)     2.6
213 \fBeventfd\fP(2)        2.6.22
214 \fBeventfd2\fP(2)       2.6.27
215 \fBexecve\fP(2) 1.0
216 \fBexecveat\fP(2)       3.19
217 \fBexit\fP(2)   1.0
218 \fBexit_group\fP(2)     2.6
219 \fBfaccessat\fP(2)      2.6.16
220 \fBfadvise64\fP(2)      2.6
221 .\" Implements \fBposix_fadvise\fP(2)
222 \fBfadvise64_64\fP(2)   2.6
223 \fBfallocate\fP(2)      2.6.23
224 \fBfanotify_init\fP(2)  2.6.37
225 \fBfanotify_mark\fP(2)  2.6.37
226 .\" The fanotify calls were added in Linux 2.6.36,
227 .\" but disabled while the API was finalized.
228 \fBfchdir\fP(2) 1.0
229 \fBfchmod\fP(2) 1.0
230 \fBfchmodat\fP(2)       2.6.16
231 \fBfchown\fP(2) 1.0
232 \fBfchown32\fP(2)       2.4
233 \fBfchownat\fP(2)       2.6.16
234 \fBfcntl\fP(2)  1.0
235 \fBfcntl64\fP(2)        2.4
236 \fBfdatasync\fP(2)      2.0
237 \fBfgetxattr\fP(2)      2.6; 2.4.18
238 \fBfinit_module\fP(2)   3.8
239 \fBflistxattr\fP(2)     2.6; 2.4.18
240 \fBflock\fP(2)  2.0
241 \fBfork\fP(2)   1.0
242 \fBfree_hugepages\fP(2) 2.5.36  Removed in 2.5.44
243 \fBfremovexattr\fP(2)   2.6; 2.4.18
244 \fBfsetxattr\fP(2)      2.6; 2.4.18
245 \fBfstat\fP(2)  1.0
246 \fBfstat64\fP(2)        2.4
247 \fBfstatat64\fP(2)      2.6.16
248 \fBfstatfs\fP(2)        1.0
249 \fBfstatfs64\fP(2)      2.6
250 \fBfsync\fP(2)  1.0
251 \fBftruncate\fP(2)      1.0
252 \fBftruncate64\fP(2)    2.4
253 \fBfutex\fP(2)  2.6
254 \fBfutimesat\fP(2)      2.6.16
255 \fBget_kernel_syms\fP(2)        1.0     Removed in 2.6
256 \fBget_mempolicy\fP(2)  2.6.6
257 \fBget_robust_list\fP(2)        2.6.17
258 \fBget_thread_area\fP(2)        2.6
259 \fBgetcpu\fP(2) 2.6.19
260 \fBgetcwd\fP(2) 2.2
261 \fBgetdents\fP(2)       2.0
262 \fBgetdents64\fP(2)     2.4
263 \fBgetegid\fP(2)        1.0
264 \fBgetegid32\fP(2)      2.4
265 \fBgeteuid\fP(2)        1.0
266 \fBgeteuid32\fP(2)      2.4
267 \fBgetgid\fP(2) 1.0
268 \fBgetgid32\fP(2)       2.4
269 \fBgetgroups\fP(2)      1.0
270 \fBgetgroups32\fP(2)    2.4
271 \fBgetitimer\fP(2)      1.0
272 \fBgetpeername\fP(2)    2.0     See notes on \fBsocketcall\fP(2)
273 \fBgetpagesize\fP(2)    2.0     Not on x86
274 \fBgetpgid\fP(2)        1.0
275 \fBgetpgrp\fP(2)        1.0
276 \fBgetpid\fP(2) 1.0
277 \fBgetppid\fP(2)        1.0
278 \fBgetpriority\fP(2)    1.0
279 \fBgetrandom\fP(2)      3.17
280 \fBgetresgid\fP(2)      2.2
281 \fBgetresgid32\fP(2)    2.4
282 \fBgetresuid\fP(2)      2.2
283 \fBgetresuid32\fP(2)    2.4
284 \fBgetrlimit\fP(2)      1.0
285 \fBgetrusage\fP(2)      1.0
286 \fBgetsid\fP(2) 2.0
287 \fBgetsockname\fP(2)    2.0     See notes on \fBsocketcall\fP(2)
288 \fBgetsockopt\fP(2)     2.0     See notes on \fBsocketcall\fP(2)
289 \fBgettid\fP(2) 2.4.11
290 \fBgettimeofday\fP(2)   1.0
291 \fBgetuid\fP(2) 1.0
292 \fBgetuid32\fP(2)       2.4
293 \fBgetunwind\fP(2)      2.4.8   ia64; deprecated
294 \fBgetxattr\fP(2)       2.6; 2.4.18
295 \fBinit_module\fP(2)    1.0
296 \fBinotify_add_watch\fP(2)      2.6.13
297 \fBinotify_init\fP(2)   2.6.13
298 \fBinotify_init1\fP(2)  2.6.27
299 \fBinotify_rm_watch\fP(2)       2.6.13
300 \fBio_cancel\fP(2)      2.6
301 \fBio_destroy\fP(2)     2.6
302 \fBio_getevents\fP(2)   2.6
303 \fBio_pgetevents\fP(2)  4.18
304 \fBio_setup\fP(2)       2.6
305 \fBio_submit\fP(2)      2.6
306 \fBioctl\fP(2)  1.0
307 \fBioperm\fP(2) 1.0
308 \fBiopl\fP(2)   1.0
309 \fBioprio_get\fP(2)     2.6.13
310 \fBioprio_set\fP(2)     2.6.13
311 \fBipc\fP(2)    1.0
312 .\" Implements System V IPC calls
313 \fBkcmp\fP(2)   3.5
314 \fBkern_features\fP(2)  3.7     Sparc64
315 .\" FIXME . document kern_features():
316 .\" commit 517ffce4e1a03aea979fe3a18a3dd1761a24fafb
317 \fBkexec_file_load\fP(2)        3.17
318 \fBkexec_load\fP(2)     2.6.13
319 .\" The entry in the syscall table was reserved starting in 2.6.7
320 .\" Was named sys_kexec_load() from 2.6.7 to 2.6.16
321 \fBkeyctl\fP(2) 2.6.10
322 \fBkill\fP(2)   1.0
323 \fBlchown\fP(2) 1.0     T{
324 See \fBchown\fP(2) for
326 version details
328 \fBlchown32\fP(2)       2.4
329 \fBlgetxattr\fP(2)      2.6; 2.4.18
330 \fBlink\fP(2)   1.0
331 \fBlinkat\fP(2) 2.6.16
332 \fBlisten\fP(2) 2.0     See notes on \fBsocketcall\fP(2)
333 \fBlistxattr\fP(2)      2.6; 2.4.18
334 \fBllistxattr\fP(2)     2.6; 2.4.18
335 \fBlookup_dcookie\fP(2) 2.6
336 \fBlremovexattr\fP(2)   2.6; 2.4.18
337 \fBlseek\fP(2)  1.0
338 \fBlsetxattr\fP(2)      2.6; 2.4.18
339 \fBlstat\fP(2)  1.0
340 \fBlstat64\fP(2)        2.4
341 \fBmadvise\fP(2)        2.4
342 \fBmbind\fP(2)  2.6.6
343 .\" \fBmemory_ordering\fP(2)    ???     Sparc64
344 \fBmembarrier\fP(2)     3.17
345 \fBmemfd_create\fP(2)   3.17
346 \fBmigrate_pages\fP(2)  2.6.16
347 \fBmincore\fP(2)        2.4
348 \fBmkdir\fP(2)  1.0
349 \fBmkdirat\fP(2)        2.6.16
350 \fBmknod\fP(2)  1.0
351 \fBmknodat\fP(2)        2.6.16
352 \fBmlock\fP(2)  2.0
353 \fBmlock2\fP(2) 4.4
354 \fBmlockall\fP(2)       2.0
355 \fBmmap\fP(2)   1.0
356 \fBmmap2\fP(2)  2.4
357 \fBmodify_ldt\fP(2)     1.0
358 \fBmount\fP(2)  1.0
359 \fBmove_pages\fP(2)     2.6.18
360 \fBmprotect\fP(2)       1.0
361 \fBmq_getsetattr\fP(2)  2.6.6
362 .\" Implements \fBmq_getattr\fP(3) and \fBmq_setattr\fP(3)
363 \fBmq_notify\fP(2)      2.6.6
364 \fBmq_open\fP(2)        2.6.6
365 \fBmq_timedreceive\fP(2)        2.6.6
366 \fBmq_timedsend\fP(2)   2.6.6
367 \fBmq_unlink\fP(2)      2.6.6
368 \fBmremap\fP(2) 2.0
369 \fBmsgctl\fP(2) 2.0     See notes on \fBipc\fP(2)
370 \fBmsgget\fP(2) 2.0     See notes on \fBipc\fP(2)
371 \fBmsgrcv\fP(2) 2.0     See notes on \fBipc\fP(2)
372 \fBmsgsnd\fP(2) 2.0     See notes on \fBipc\fP(2)
373 \fBmsync\fP(2)  2.0
374 .\" \fBmultiplexer\fP(2)        ??      __NR_multiplexer reserved on
375 .\"             PowerPC, but unimplemented?
376 \fBmunlock\fP(2)        2.0
377 \fBmunlockall\fP(2)     2.0
378 \fBmunmap\fP(2) 1.0
379 \fBname_to_handle_at\fP(2)      2.6.39
380 \fBnanosleep\fP(2)      2.0
381 \fBnfsservctl\fP(2)     2.2     Removed in 3.1
382 \fBnice\fP(2)   1.0
383 \fBoldfstat\fP(2)       1.0
384 \fBoldlstat\fP(2)       1.0
385 \fBoldolduname\fP(2)    1.0
386 \fBoldstat\fP(2)        1.0
387 \fBolduname\fP(2)       1.0
388 \fBopen\fP(2)   1.0
389 \fBopen_by_handle_at\fP(2)      2.6.39
390 \fBopenat\fP(2) 2.6.16
391 \fBpause\fP(2)  1.0
392 \fBpciconfig_iobase\fP(2)       2.2.15; 2.4     Not on x86
393 .\" Alpha, PowerPC, ARM; not x86
394 \fBpciconfig_read\fP(2) 2.0.26; 2.2     Not on x86
395 .\" , PowerPC, ARM; not x86
396 \fBpciconfig_write\fP(2)        2.0.26; 2.2     Not on x86
397 .\" , PowerPC, ARM; not x86
398 \fBperf_event_open\fP(2)        2.6.31  T{
399 Was perf_counter_open() in
401 2.6.31; renamed in 2.6.32
403 \fBpersonality\fP(2)    1.2
404 \fBperfctr\fP(2)        2.2     Sparc; removed in 2.6.34
405 .\"     commit c7d5a0050773e98d1094eaa9f2a1a793fafac300 removed perfctr()
406 \fBperfmonctl\fP(2)     2.4     ia64
407 \fBpipe\fP(2)   1.0
408 \fBpipe2\fP(2)  2.6.27
409 \fBpivot_root\fP(2)     2.4
410 \fBpkey_alloc\fP(2)     4.8
411 \fBpkey_free\fP(2)      4.8
412 \fBpkey_mprotect\fP(2)  4.8
413 \fBpoll\fP(2)   2.0.36; 2.2
414 \fBppc_rtas\fP(2)       2.6.2   PowerPC only
415 \fBppc_swapcontext\fP(2)        2.6.3   PowerPC only
416 \fBppoll\fP(2)  2.6.16
417 \fBprctl\fP(2)  2.2
418 \fBpread64\fP(2)                T{
419 Added as "pread" in 2.2;
421 renamed "pread64" in 2.6
423 \fBpreadv\fP(2) 2.6.30
424 \fBpreadv2\fP(2)        4.6
425 \fBprlimit64\fP(2)      2.6.36
426 \fBprocess_vm_readv\fP(2)       3.2
427 \fBprocess_vm_writev\fP(2)      3.2
428 \fBpselect6\fP(2)       2.6.16
429 .\" Implements \fBpselect\fP(2)
430 \fBptrace\fP(2) 1.0
431 \fBpwrite64\fP(2)               T{
432 Added as "pwrite" in 2.2;
434 renamed "pwrite64" in 2.6
436 \fBpwritev\fP(2)        2.6.30
437 \fBpwritev2\fP(2)       4.6
438 \fBquery_module\fP(2)   2.2     Removed in 2.6
439 \fBquotactl\fP(2)       1.0
440 \fBread\fP(2)   1.0
441 \fBreadahead\fP(2)      2.4.13
442 \fBreaddir\fP(2)        1.0
443 .\" Supersedes \fBgetdents\fP(2)
444 \fBreadlink\fP(2)       1.0
445 \fBreadlinkat\fP(2)     2.6.16
446 \fBreadv\fP(2)  2.0
447 \fBreboot\fP(2) 1.0
448 \fBrecv\fP(2)   2.0     See notes on \fBsocketcall\fP(2)
449 \fBrecvfrom\fP(2)       2.0     See notes on \fBsocketcall\fP(2)
450 \fBrecvmsg\fP(2)        2.0     See notes on \fBsocketcall\fP(2)
451 \fBrecvmmsg\fP(2)       2.6.33
452 \fBremap_file_pages\fP(2)       2.6     Deprecated since 3.16
453 \fBremovexattr\fP(2)    2.6; 2.4.18
454 \fBrename\fP(2) 1.0
455 \fBrenameat\fP(2)       2.6.16
456 \fBrenameat2\fP(2)      3.15
457 \fBrequest_key\fP(2)    2.6.10
458 \fBrestart_syscall\fP(2)        2.6
459 \fBrmdir\fP(2)  1.0
460 \fBrseq\fP(2)   4.18
461 \fBrt_sigaction\fP(2)   2.2
462 \fBrt_sigpending\fP(2)  2.2
463 \fBrt_sigprocmask\fP(2) 2.2
464 \fBrt_sigqueueinfo\fP(2)        2.2
465 \fBrt_sigreturn\fP(2)   2.2
466 \fBrt_sigsuspend\fP(2)  2.2
467 \fBrt_sigtimedwait\fP(2)        2.2
468 \fBrt_tgsigqueueinfo\fP(2)      2.6.31
469 \fBs390_runtime_instr\fP(2)     3.7     s390 only
470 \fBs390_pci_mmio_read\fP(2)     3.19    s390 only
471 \fBs390_pci_mmio_write\fP(2)    3.19    s390 only
472 \fBs390_sthyi\fP(2)     4.15    s390 only
473 \fBs390_guarded_storage\fP(2)   4.12    s390 only
474 \fBsched_get_priority_max\fP(2) 2.0
475 \fBsched_get_priority_min\fP(2) 2.0
476 \fBsched_getaffinity\fP(2)      2.6
477 \fBsched_getattr\fP(2)  3.14
478 \fBsched_getparam\fP(2) 2.0
479 \fBsched_getscheduler\fP(2)     2.0
480 \fBsched_rr_get_interval\fP(2)  2.0
481 \fBsched_setaffinity\fP(2)      2.6
482 \fBsched_setattr\fP(2)  3.14
483 \fBsched_setparam\fP(2) 2.0
484 \fBsched_setscheduler\fP(2)     2.0
485 \fBsched_yield\fP(2)    2.0
486 \fBseccomp\fP(2)        3.17
487 \fBselect\fP(2) 1.0
488 \fBsemctl\fP(2) 2.0     See notes on \fBipc\fP(2)
489 \fBsemget\fP(2) 2.0     See notes on \fBipc\fP(2)
490 \fBsemop\fP(2)  2.0     See notes on \fBipc\fP(2)
491 \fBsemtimedop\fP(2)     2.6; 2.4.22
492 \fBsend\fP(2)   2.0     See notes on \fBsocketcall\fP(2)
493 \fBsendfile\fP(2)       2.2
494 \fBsendfile64\fP(2)     2.6; 2.4.19
495 \fBsendmmsg\fP(2)       3.0
496 \fBsendmsg\fP(2)        2.0     See notes on \fBsocketcall\fP(2)
497 \fBsendto\fP(2) 2.0     See notes on \fBsocketcall\fP(2)
498 \fBset_mempolicy\fP(2)  2.6.6
499 \fBset_robust_list\fP(2)        2.6.17
500 \fBset_thread_area\fP(2)        2.6
501 \fBset_tid_address\fP(2)        2.6
502 .\" See http://lkml.org/lkml/2005/8/1/83
503 .\" "[PATCH] remove sys_set_zone_reclaim()"
504 \fBsetdomainname\fP(2)  1.0
505 \fBsetfsgid\fP(2)       1.2
506 \fBsetfsgid32\fP(2)     2.4
507 \fBsetfsuid\fP(2)       1.2
508 \fBsetfsuid32\fP(2)     2.4
509 \fBsetgid\fP(2) 1.0
510 \fBsetgid32\fP(2)       2.4
511 \fBsetgroups\fP(2)      1.0
512 \fBsetgroups32\fP(2)    2.4
513 \fBsethostname\fP(2)    1.0
514 \fBsetitimer\fP(2)      1.0
515 \fBsetns\fP(2)  3.0
516 \fBsetpgid\fP(2)        1.0
517 \fBsetpriority\fP(2)    1.0
518 \fBsetregid\fP(2)       1.0
519 \fBsetregid32\fP(2)     2.4
520 \fBsetresgid\fP(2)      2.2
521 \fBsetresgid32\fP(2)    2.4
522 \fBsetresuid\fP(2)      2.2
523 \fBsetresuid32\fP(2)    2.4
524 \fBsetreuid\fP(2)       1.0
525 \fBsetreuid32\fP(2)     2.4
526 \fBsetrlimit\fP(2)      1.0
527 \fBsetsid\fP(2) 1.0
528 \fBsetsockopt\fP(2)     2.0     See notes on \fBsocketcall\fP(2)
529 \fBsettimeofday\fP(2)   1.0
530 \fBsetuid\fP(2) 1.0
531 \fBsetuid32\fP(2)       2.4
532 \fBsetup\fP(2)  1.0     Removed in 2.2
533 \fBsetxattr\fP(2)       2.6; 2.4.18
534 \fBsgetmask\fP(2)       1.0
535 \fBshmat\fP(2)  2.0     See notes on \fBipc\fP(2)
536 \fBshmctl\fP(2) 2.0     See notes on \fBipc\fP(2)
537 \fBshmdt\fP(2)  2.0     See notes on \fBipc\fP(2)
538 \fBshmget\fP(2) 2.0     See notes on \fBipc\fP(2)
539 \fBshutdown\fP(2)       2.0     See notes on \fBsocketcall\fP(2)
540 \fBsigaction\fP(2)      1.0
541 \fBsigaltstack\fP(2)    2.2
542 \fBsignal\fP(2) 1.0
543 \fBsignalfd\fP(2)       2.6.22
544 \fBsignalfd4\fP(2)      2.6.27
545 \fBsigpending\fP(2)     1.0
546 \fBsigprocmask\fP(2)    1.0
547 \fBsigreturn\fP(2)      1.0
548 \fBsigsuspend\fP(2)     1.0
549 \fBsocket\fP(2) 2.0     See notes on \fBsocketcall\fP(2)
550 \fBsocketcall\fP(2)     1.0
551 .\" Implements BSD socket calls
552 \fBsocketpair\fP(2)     2.0     See notes on \fBsocketcall\fP(2)
553 \fBsplice\fP(2) 2.6.17
554 \fBspu_create\fP(2)     2.6.16  PowerPC only
555 \fBspu_run\fP(2)        2.6.16  PowerPC only
556 \fBssetmask\fP(2)       1.0
557 \fBstat\fP(2)   1.0
558 \fBstat64\fP(2) 2.4
559 \fBstatfs\fP(2) 1.0
560 \fBstatfs64\fP(2)       2.6
561 \fBstatx\fP(2)  4.11
562 \fBstime\fP(2)  1.0
563 \fBsubpage_prot\fP(2)   2.6.25  PowerPC only
564 \fBswapoff\fP(2)        1.0
565 \fBswapon\fP(2) 1.0
566 \fBsymlink\fP(2)        1.0
567 \fBsymlinkat\fP(2)      2.6.16
568 \fBsync\fP(2)   1.0
569 \fBsync_file_range\fP(2)        2.6.17
570 \fBsync_file_range2\fP(2)       2.6.22
571 .\" PowerPC, ARM, tile
572 .\" First appeared on ARM, as arm_sync_file_range(), but later renamed
573 .\" \fBsys_debug_setcontext\fP(2)       ???     PowerPC if CONFIG_PPC32
574 \fBsyncfs\fP(2) 2.6.39
575 \fBsysfs\fP(2)  1.2
576 \fBsysinfo\fP(2)        1.0
577 \fBsyslog\fP(2) 1.0
578 .\" glibc interface is \fBklogctl\fP(3)
579 \fBtee\fP(2)    2.6.17
580 \fBtgkill\fP(2) 2.6
581 \fBtime\fP(2)   1.0
582 \fBtimer_create\fP(2)   2.6
583 \fBtimer_delete\fP(2)   2.6
584 \fBtimer_getoverrun\fP(2)       2.6
585 \fBtimer_gettime\fP(2)  2.6
586 \fBtimer_settime\fP(2)  2.6
587 \fBtimerfd_create\fP(2) 2.6.25
588 \fBtimerfd_gettime\fP(2)        2.6.25
589 \fBtimerfd_settime\fP(2)        2.6.25
590 \fBtimes\fP(2)  1.0
591 \fBtkill\fP(2)  2.6; 2.4.22
592 \fBtruncate\fP(2)       1.0
593 \fBtruncate64\fP(2)     2.4
594 \fBugetrlimit\fP(2)     2.4
595 \fBumask\fP(2)  1.0
596 \fBumount\fP(2) 1.0
597 .\" sys_oldumount() -- __NR_umount
598 \fBumount2\fP(2)        2.2
599 .\" sys_umount() -- __NR_umount2
600 \fBuname\fP(2)  1.0
601 \fBunlink\fP(2) 1.0
602 \fBunlinkat\fP(2)       2.6.16
603 \fBunshare\fP(2)        2.6.16
604 \fBuselib\fP(2) 1.0
605 \fBustat\fP(2)  1.0
606 \fBuserfaultfd\fP(2)    4.3
607 \fButime\fP(2)  1.0
608 \fButimensat\fP(2)      2.6.22
609 \fButimes\fP(2) 2.2
610 \fButrap_install\fP(2)  2.2     Sparc only
611 .\" FIXME . document utrap_install()
612 .\" There's a man page for Solaris 5.11
613 \fBvfork\fP(2)  2.2
614 \fBvhangup\fP(2)        1.0
615 \fBvm86old\fP(2)        1.0     T{
616 Was "vm86"; renamed in
617 2.0.28/2.2
619 \fBvm86\fP(2)   2.0.28; 2.2
620 \fBvmsplice\fP(2)       2.6.17
621 \fBwait4\fP(2)  1.0
622 \fBwaitid\fP(2) 2.6.10
623 \fBwaitpid\fP(2)        1.0
624 \fBwrite\fP(2)  1.0
625 \fBwritev\fP(2) 2.0
629 On many platforms, including x86-32, socket calls are all multiplexed
630 (via glibc wrapper functions) through
631 .BR socketcall (2)
632 and similarly System\ V IPC calls are multiplexed through
633 .BR ipc (2).
635 Although slots are reserved for them in the system call table,
636 the following system calls are not implemented in the standard kernel:
637 .BR afs_syscall (2), \" __NR_afs_syscall is 53 on Linux 2.6.22/i386
638 .BR break (2),       \" __NR_break is 17 on Linux 2.6.22/i386
639 .BR ftime (2),       \" __NR_ftime is 35 on Linux 2.6.22/i386
640 .BR getpmsg (2),     \" __NR_getpmsg is 188 on Linux 2.6.22/i386
641 .BR gtty (2),        \" __NR_gtty is 32 on Linux 2.6.22/i386
642 .BR idle (2),        \" __NR_idle is 112 on Linux 2.6.22/i386
643 .BR lock (2),        \" __NR_lock is 53 on Linux 2.6.22/i386
644 .BR madvise1 (2),    \" __NR_madvise1 is 219 on Linux 2.6.22/i386
645 .BR mpx (2),         \" __NR_mpx is 66 on Linux 2.6.22/i386
646 .BR phys (2),        \" Slot has been reused
647 .BR prof (2),        \" __NR_prof is 44 on Linux 2.6.22/i386
648 .BR profil (2),      \" __NR_profil is 98 on Linux 2.6.22/i386
649 .BR putpmsg (2),     \" __NR_putpmsg is 189 on Linux 2.6.22/i386
650 .\" __NR_security is 223 on Linux 2.4/i386; absent on 2.6/i386, present
651 .\" on a couple of 2.6 architectures
652 .BR security (2),    \" __NR_security is 223 on Linux 2.4/i386
653 .\" The security call is for future use.
654 .BR stty (2),        \" __NR_stty is 31 on Linux 2.6.22/i386
655 .BR tuxcall (2),     \" __NR_tuxcall is 184 on x86_64, also on PPC and alpha
656 .BR ulimit (2),      \" __NR_ulimit is 58 on Linux 2.6.22/i386
658 .BR vserver (2)      \" __NR_vserver is 273 on Linux 2.6.22/i386
659 (see also
660 .BR unimplemented (2)).
661 However,
662 .BR ftime (3),
663 .BR profil (3),
665 .BR ulimit (3)
666 exist as library routines.
667 The slot for
668 .BR phys (2)
669 is in use since kernel 2.1.116 for
670 .BR umount (2);
671 .BR phys (2)
672 will never be implemented.
674 .BR getpmsg (2)
676 .BR putpmsg (2)
677 calls are for kernels patched to support STREAMS,
678 and may never be in the standard kernel.
680 There was briefly
681 .BR set_zone_reclaim (2),
682 added in Linux 2.6.13, and removed in 2.6.16;
683 this system call was never available to user space.
684 .SH NOTES
686 Roughly speaking, the code belonging to the system call
687 with number __NR_xxx defined in
688 .I /usr/include/asm/unistd.h
689 can be found in the Linux kernel source in the routine
690 .IR sys_xxx ().
691 (The dispatch table for i386 can be found in
692 .IR /usr/src/linux/arch/i386/kernel/entry.S .)
693 There are many exceptions, however, mostly because
694 older system calls were superseded by newer ones,
695 and this has been treated somewhat unsystematically.
696 On platforms with
697 proprietary operating-system emulation,
698 such as sparc, sparc64, and alpha,
699 there are many additional system calls; mips64 also contains a full
700 set of 32-bit system calls.
702 Over time, changes to the interfaces of some system calls have been
703 necessary.
704 One reason for such changes was the need to increase the size of
705 structures or scalar values passed to the system call.
706 Because of these changes, certain architectures
707 (notably, longstanding 32-bit architectures such as i386)
708 now have various groups of related system calls (e.g.,
709 .BR truncate (2)
711 .BR truncate64 (2))
712 which perform similar tasks, but which vary in
713 details such as the size of their arguments.
714 (As noted earlier, applications are generally unaware of this:
715 the glibc wrapper functions do some work to ensure that the right
716 system call is invoked, and that ABI compatibility is
717 preserved for old binaries.)
718 Examples of systems calls that exist in multiple versions are
719 the following:
720 .IP * 3
721 By now there are three different versions of
722 .BR stat (2):
723 .IR sys_stat ()
724 (slot
725 .IR __NR_oldstat ),
726 .IR sys_newstat ()
727 (slot
728 .IR __NR_stat ),
730 .IR sys_stat64 ()
731 (slot
732 .IR __NR_stat64 ),
733 with the last being the most current.
734 .\" e.g., on 2.6.22/i386: __NR_oldstat 18, __NR_stat 106, __NR_stat64 195
735 .\" The stat system calls deal with three different data structures,
736 .\" defined in include/asm-i386/stat.h: __old_kernel_stat, stat, stat64
737 A similar story applies for
738 .BR lstat (2)
740 .BR fstat (2).
741 .IP *
742 Similarly, the defines
743 .IR __NR_oldolduname ,
744 .IR __NR_olduname ,
746 .I __NR_uname
747 refer to the routines
748 .IR sys_olduname (),
749 .IR sys_uname ()
751 .IR sys_newuname ().
752 .IP *
753 In Linux 2.0, a new version of
754 .BR vm86 (2)
755 appeared, with the old and the new kernel routines being named
756 .IR sys_vm86old ()
758 .IR sys_vm86 ().
759 .IP *
760 In Linux 2.4, a new version of
761 .BR getrlimit (2)
762 appeared, with the old and the new kernel routines being named
763 .IR sys_old_getrlimit ()
764 (slot
765 .IR __NR_getrlimit )
767 .IR sys_getrlimit ()
768 (slot
769 .IR __NR_ugetrlimit ).
770 .IP *
771 Linux 2.4 increased the size of user and group IDs from 16 to 32 bits.
772 .\" 64-bit off_t changes: ftruncate64, *stat64,
773 .\" fcntl64 (because of the flock structure), getdents64, *statfs64
774 To support this change, a range of system calls were added
775 (e.g.,
776 .BR chown32 (2),
777 .BR getuid32 (2),
778 .BR getgroups32 (2),
779 .BR setresuid32 (2)),
780 superseding earlier calls of the same name without the
781 "32" suffix.
782 .IP *
783 Linux 2.4 added support for applications on 32-bit architectures
784 to access large files (i.e., files for which the sizes and
785 file offsets can't be represented in 32 bits.)
786 To support this change, replacements were required for system calls
787 that deal with file offsets and sizes.
788 Thus the following system calls were added:
789 .BR fcntl64 (2),
790 .BR getdents64 (2),
791 .BR stat64 (2),
792 .BR statfs64 (2),
793 .BR truncate64 (2),
794 and their analogs that work with file descriptors or
795 symbolic links.
796 These system calls supersede the older system calls
797 which, except in the case of the "stat" calls,
798 have the same name without the "64" suffix.
800 On newer platforms that only have 64-bit file access and 32-bit UIDs/GIDs
801 (e.g., alpha, ia64, s390x, x86-64), there is just a single version of
802 the UID/GID and file access system calls.
803 On platforms (typically, 32-bit platforms) where the *64 and *32 calls exist,
804 the other versions are obsolete.
805 .IP *
807 .I rt_sig*
808 calls were added in kernel 2.2 to support the addition
809 of real-time signals (see
810 .BR signal (7)).
811 These system calls supersede the older system calls of the same
812 name without the "rt_" prefix.
813 .IP *
815 .BR select (2)
817 .BR mmap (2)
818 system calls use five or more arguments,
819 which caused problems in the way
820 argument passing on the i386 used to be set up.
821 Thus, while other architectures have
822 .IR sys_select ()
824 .IR sys_mmap ()
825 corresponding to
826 .I __NR_select
828 .IR __NR_mmap ,
829 on i386 one finds
830 .IR old_select ()
832 .IR old_mmap ()
833 (routines that use a pointer to an
834 argument block) instead.
835 These days passing five arguments
836 is not a problem any more, and there is a
837 .I __NR__newselect
838 .\" (used by libc 6)
839 that corresponds directly to
840 .IR sys_select ()
841 and similarly
842 .IR __NR_mmap2 .
843 s390x is the only 64-bit architecture that has
844 .IR old_mmap ().
845 .\" .PP
846 .\" Two system call numbers,
847 .\" .IR __NR__llseek
848 .\" and
849 .\" .IR __NR__sysctl
850 .\" have an additional underscore absent in
851 .\" .IR sys_llseek ()
852 .\" and
853 .\" .IR sys_sysctl ().
855 .\" In kernel 2.1.81,
856 .\" .BR lchown (2)
857 .\" and
858 .\" .BR chown (2)
859 .\" were swapped; that is,
860 .\" .BR lchown (2)
861 .\" was added with the semantics that were then current for
862 .\" .BR chown (2),
863 .\" and the semantics of the latter call were changed to what
864 .\" they are today.
865 .SH SEE ALSO
866 .BR intro (2),
867 .BR syscall (2),
868 .BR unimplemented (2),
869 .BR errno (3),
870 .BR libc (7),
871 .BR vdso (7)