1SYSCALL(2) Linux Programmer's Manual SYSCALL(2)
2
3
4
6 syscall - indirect system call
7
9 #define _GNU_SOURCE /* or _BSD_SOURCE or _SVID_SOURCE */
10 #include <unistd.h>
11 #include <sys/syscall.h> /* For SYS_xxx definitions */
12
13 int syscall(int number, ...);
14
16 syscall() performs the system call whose assembly language interface
17 has the specified number with the specified arguments. Symbolic con‐
18 stants for system calls can be found in the header file
19 <sys/syscall.h>.
20
22 The return value is defined by the system call being invoked. In gen‐
23 eral, a 0 return value indicates success. A -1 return value indicates
24 an error, and an error code is stored in errno.
25
27 syscall() first appeared in 4BSD.
28
30 #define _GNU_SOURCE
31 #include <unistd.h>
32 #include <sys/syscall.h>
33 #include <sys/types.h>
34
35 int
36 main(int argc, char *argv[])
37 {
38 pid_t tid;
39
40 tid = syscall(SYS_gettid);
41 }
42
44 _syscall(2), intro(2), syscalls(2)
45
47 This page is part of release 3.22 of the Linux man-pages project. A
48 description of the project, and information about reporting bugs, can
49 be found at http://www.kernel.org/doc/man-pages/.
50
51
52
53Linux 2007-07-26 SYSCALL(2)