diff options
| author | Michael Kerrisk <mtk.manpages@gmail.com> | 2012-07-13 08:07:19 +0200 |
|---|---|---|
| committer | Michael Kerrisk <mtk.manpages@gmail.com> | 2012-07-19 12:51:28 +0200 |
| commit | 498a96a2391094f2d137460d007ff2f0e7a2fae6 (patch) | |
| tree | 5379fa37a103cda78fd91baf40bb68ce4b90fd82 | |
| parent | 50cebc04858fe7ad2d3814e9cadb1a58d22db0d3 (diff) | |
| download | man-pages-498a96a2391094f2d137460d007ff2f0e7a2fae6.tar.gz | |
syscall.2: Add some more details to the description of syscall(2)
And add another example of using syscall() to the program example.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
syscall.2: fix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
| -rw-r--r-- | man2/syscall.2 | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/man2/syscall.2 b/man2/syscall.2 index da1c561843..a2faa143c0 100644 --- a/man2/syscall.2 +++ b/man2/syscall.2 @@ -48,11 +48,24 @@ syscall \- indirect system call .fi .SH DESCRIPTION .BR syscall () -performs the system call whose assembly language +is a small library function that invokes +the system call whose assembly language interface has the specified .I number with the specified arguments. -Symbolic constants for system calls can be found in the header file +Employing +.BR syscall () +is useful, for example, +when invoking a system call that has no wrapper function in the C library. + +.BR syscall () +saves CPU registers before making the system call, +restores the registers upon return from the system call, +and stores any error code returned by the system call in +.BR errno (3) +if an error occurs. + +Symbolic constants for system call numbers can be found in the header file .IR <sys/syscall.h> . .SH RETURN VALUE The return value is defined by the system call being invoked. @@ -77,6 +90,7 @@ main(int argc, char *argv[]) pid_t tid; tid = syscall(SYS_gettid); + tid = syscall(SYS_tgkill, getpid(), tid); } .fi .SH SEE ALSO |
