OSDN Git Service

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