2004-11-03 13:51:07 +00:00
|
|
|
.\" Copyright (c) 1980, 1991, 1993
|
|
|
|
.\" The Regents of the University of California. All rights reserved.
|
|
|
|
.\"
|
accept.2, bind.2, connect.2, getpeername.2, getpriority.2, getsockname.2, getsockopt.2, ioctl.2, killpg.2, listen.2, lseek.2, readlink.2, recv.2, send.2, setpgid.2, setreuid.2, shutdown.2, socket.2, socketpair.2, syscall.2, truncate.2, alloca.3, btree.3, daemon.3, dbopen.3, err.3, exec.3, fclose.3, ferror.3, fflush.3, fopen.3, fread.3, fseek.3, fts.3, hash.3, mpool.3, popen.3, queue.3, rcmd.3, recno.3, rexec.3, scanf.3, setbuf.3, stdarg.3, stdio.3, strtod.3, hostname.7, mdoc.7, mdoc.samples.7: srcfix: LICENSE: s/BSD_4_CLAUSE_FULL/BSD_4_CLAUSE_UCB/
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2013-03-10 16:41:19 +00:00
|
|
|
.\" %%%LICENSE_START(BSD_4_CLAUSE_UCB)
|
2004-11-03 13:51:07 +00:00
|
|
|
.\" Redistribution and use in source and binary forms, with or without
|
|
|
|
.\" modification, are permitted provided that the following conditions
|
|
|
|
.\" are met:
|
|
|
|
.\" 1. Redistributions of source code must retain the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer.
|
|
|
|
.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer in the
|
|
|
|
.\" documentation and/or other materials provided with the distribution.
|
|
|
|
.\" 3. All advertising materials mentioning features or use of this software
|
|
|
|
.\" must display the following acknowledgement:
|
|
|
|
.\" This product includes software developed by the University of
|
|
|
|
.\" California, Berkeley and its contributors.
|
|
|
|
.\" 4. Neither the name of the University nor the names of its contributors
|
|
|
|
.\" may be used to endorse or promote products derived from this software
|
|
|
|
.\" without specific prior written permission.
|
|
|
|
.\"
|
|
|
|
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
|
|
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
.\" SUCH DAMAGE.
|
accept.2, bind.2, connect.2, getpeername.2, getpriority.2, getsockname.2, getsockopt.2, ioctl.2, killpg.2, listen.2, lseek.2, readlink.2, recv.2, send.2, setpgid.2, setreuid.2, shutdown.2, socket.2, socketpair.2, syscall.2, truncate.2, alloca.3, btree.3, daemon.3, dbopen.3, err.3, exec.3, fclose.3, ferror.3, fflush.3, fopen.3, fread.3, fseek.3, fts.3, getloadavg.3, hash.3, mpool.3, openpty.3, popen.3, queue.3, rcmd.3, recno.3, rexec.3, scanf.3, setbuf.3, stdarg.3, stdio.3, strtod.3, hostname.7, mdoc.7, mdoc.samples.7, operator.7, symlink.7: Add LICENSE_START(BSD_[34]_CLAUSE_FULL)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2013-03-10 09:28:48 +00:00
|
|
|
.\" %%%LICENSE_END
|
2004-11-03 13:51:07 +00:00
|
|
|
.\"
|
|
|
|
.\" @(#)syscall.2 8.1 (Berkeley) 6/16/93
|
|
|
|
.\"
|
|
|
|
.\"
|
|
|
|
.\" 2002-03-20 Christoph Hellwig <hch@infradead.org>
|
|
|
|
.\" - adopted for Linux
|
|
|
|
.\"
|
2012-08-13 22:37:33 +00:00
|
|
|
.TH SYSCALL 2 2012-08-14 "Linux" "Linux Programmer's Manual"
|
2007-05-26 14:10:51 +00:00
|
|
|
.SH NAME
|
|
|
|
syscall \- indirect system call
|
|
|
|
.SH SYNOPSIS
|
|
|
|
.nf
|
getresuid.2, mremap.2, poll.2, remap_file_pages.2, setresuid.2, splice.2, sync_file_range.2, syscall.2, tee.2, vmsplice.2, INFINITY.3, aio_init.3, asprintf.3, assert_perror.3, basename.3, bsd_signal.3, canonicalize_file_name.3, clog10.3, crypt.3, dl_iterate_phdr.3, dlopen.3, encrypt.3, exp10.3, fcloseall.3, fenv.3, fopencookie.3, ftw.3, getaddrinfo_a.3, getloadavg.3, getutent.3, grantpt.3, hsearch.3, lseek64.3, memmem.3, mempcpy.3, pow10.3, program_invocation_name.3, ptsname.3, putgrent.3, sched_getcpu.3, sincos.3, strchr.3, strfry.3, strnlen.3, strptime.3, strstr.3, strverscmp.3, swab.3, sysv_signal.3, tsearch.3, unlockpt.3, wcwidth.3: Add reference to feature_test_macros(7)
Some pages simply list feature test macro requirements in
the form:
#define #GNU_SOURCE
#include <someheader.h>
For these pages, add a "See feature_test_macros(7)" comment
on the "#define" line.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2010-10-31 04:31:47 +00:00
|
|
|
.BR "#define _GNU_SOURCE" " /* See feature_test_macros(7) */"
|
2007-05-26 14:10:51 +00:00
|
|
|
.B #include <unistd.h>
|
2007-07-08 12:11:40 +00:00
|
|
|
.BR "#include <sys/syscall.h> " "/* For SYS_xxx definitions */"
|
2007-05-26 14:10:51 +00:00
|
|
|
|
|
|
|
.BI "int syscall(int " number ", ...);"
|
|
|
|
.fi
|
|
|
|
.SH DESCRIPTION
|
|
|
|
.BR syscall ()
|
2012-07-13 06:07:19 +00:00
|
|
|
is a small library function that invokes
|
|
|
|
the system call whose assembly language
|
2004-11-03 13:51:07 +00:00
|
|
|
interface has the specified
|
2007-05-26 14:10:51 +00:00
|
|
|
.I number
|
2004-11-03 13:51:07 +00:00
|
|
|
with the specified arguments.
|
2012-07-13 06:07:19 +00:00
|
|
|
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
|
2007-05-26 14:10:51 +00:00
|
|
|
.IR <sys/syscall.h> .
|
|
|
|
.SH RETURN VALUE
|
2004-11-03 13:51:07 +00:00
|
|
|
The return value is defined by the system call being invoked.
|
|
|
|
In general, a 0 return value indicates success.
|
2005-06-15 14:10:23 +00:00
|
|
|
A \-1 return value indicates an error,
|
2004-11-03 13:51:07 +00:00
|
|
|
and an error code is stored in
|
2007-05-26 14:10:51 +00:00
|
|
|
.IR errno .
|
|
|
|
.SH NOTES
|
|
|
|
.BR syscall ()
|
|
|
|
first appeared in
|
|
|
|
4BSD.
|
|
|
|
.SH EXAMPLE
|
|
|
|
.nf
|
|
|
|
#define _GNU_SOURCE
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <sys/syscall.h>
|
|
|
|
#include <sys/types.h>
|
|
|
|
|
|
|
|
int
|
|
|
|
main(int argc, char *argv[])
|
|
|
|
{
|
|
|
|
pid_t tid;
|
2007-12-25 16:11:05 +00:00
|
|
|
|
2007-07-08 17:00:49 +00:00
|
|
|
tid = syscall(SYS_gettid);
|
2012-07-13 06:07:19 +00:00
|
|
|
tid = syscall(SYS_tgkill, getpid(), tid);
|
2007-05-26 14:10:51 +00:00
|
|
|
}
|
|
|
|
.fi
|
2007-06-25 12:57:55 +00:00
|
|
|
.SH SEE ALSO
|
2007-12-17 11:24:18 +00:00
|
|
|
.BR _syscall (2),
|
2008-07-14 15:52:21 +00:00
|
|
|
.BR intro (2),
|
2007-07-08 12:11:40 +00:00
|
|
|
.BR syscalls (2)
|