491 lines
21 KiB
HTML
491 lines
21 KiB
HTML
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<HTML><HEAD><TITLE>Man page of SYSCALL</TITLE>
|
|
</HEAD><BODY>
|
|
<H1>SYSCALL</H1>
|
|
Section: Linux Programmer's Manual (2)<BR>Updated: 2020-02-09<BR><A HREF="#index">Index</A>
|
|
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
|
|
|
<A NAME="lbAB"> </A>
|
|
<H2>NAME</H2>
|
|
|
|
syscall - indirect system call
|
|
<A NAME="lbAC"> </A>
|
|
<H2>SYNOPSIS</H2>
|
|
|
|
<PRE>
|
|
<B>#include <<A HREF="file:///usr/include/unistd.h">unistd.h</A>></B>
|
|
<B>#include <<A HREF="file:///usr/include/sys/syscall.h">sys/syscall.h</A>> </B>/* For SYS_xxx definitions */
|
|
|
|
<B>long syscall(long </B><I>number</I><B>, ...);</B>
|
|
</PRE>
|
|
|
|
<P>
|
|
|
|
|
|
Feature Test Macro Requirements for glibc (see
|
|
<B><A HREF="/cgi-bin/man/man2html?7+feature_test_macros">feature_test_macros</A></B>(7)):
|
|
|
|
|
|
<B>syscall</B>():
|
|
|
|
|
|
|
|
<DL COMPACT><DT id="1"><DD>
|
|
<DL COMPACT>
|
|
<DT id="2">Since glibc 2.19:<DD>
|
|
_DEFAULT_SOURCE
|
|
<DT id="3">Before glibc 2.19:<DD>
|
|
_BSD_SOURCE || _SVID_SOURCE
|
|
</DL>
|
|
</DL>
|
|
|
|
|
|
|
|
<A NAME="lbAD"> </A>
|
|
<H2>DESCRIPTION</H2>
|
|
|
|
<B>syscall</B>()
|
|
|
|
is a small library function that invokes
|
|
the system call whose assembly language
|
|
interface has the specified
|
|
<I>number</I>
|
|
|
|
with the specified arguments.
|
|
Employing
|
|
<B>syscall</B>()
|
|
|
|
is useful, for example,
|
|
when invoking a system call that has no wrapper function in the C library.
|
|
<P>
|
|
|
|
<B>syscall</B>()
|
|
|
|
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
|
|
<B><A HREF="/cgi-bin/man/man2html?3+errno">errno</A></B>(3)
|
|
|
|
if an error occurs.
|
|
<P>
|
|
|
|
Symbolic constants for system call numbers can be found in the header file
|
|
<I><<A HREF="file:///usr/include/sys/syscall.h">sys/syscall.h</A>></I>.
|
|
|
|
<A NAME="lbAE"> </A>
|
|
<H2>RETURN VALUE</H2>
|
|
|
|
The return value is defined by the system call being invoked.
|
|
In general, a 0 return value indicates success.
|
|
A -1 return value indicates an error,
|
|
and an error code is stored in
|
|
<I>errno</I>.
|
|
|
|
<A NAME="lbAF"> </A>
|
|
<H2>NOTES</H2>
|
|
|
|
<B>syscall</B>()
|
|
|
|
first appeared in
|
|
4BSD.
|
|
<A NAME="lbAG"> </A>
|
|
<H3>Architecture-specific requirements</H3>
|
|
|
|
Each architecture ABI has its own requirements on how
|
|
system call arguments are passed to the kernel.
|
|
For system calls that have a glibc wrapper (e.g., most system calls),
|
|
glibc handles the details of copying arguments to the right registers
|
|
in a manner suitable for the architecture.
|
|
However, when using
|
|
<B>syscall</B>()
|
|
|
|
to make a system call,
|
|
the caller might need to handle architecture-dependent details;
|
|
this requirement is most commonly encountered on certain 32-bit architectures.
|
|
<P>
|
|
|
|
For example, on the ARM architecture Embedded ABI (EABI), a
|
|
64-bit value (e.g.,
|
|
<I>long long</I>)
|
|
|
|
must be aligned to an even register pair.
|
|
Thus, using
|
|
<B>syscall</B>()
|
|
|
|
instead of the wrapper provided by glibc,
|
|
the
|
|
<B>readahead</B>()
|
|
|
|
system call would be invoked as follows on the ARM architecture with the EABI
|
|
in little endian mode:
|
|
<P>
|
|
|
|
|
|
|
|
syscall(SYS_readahead, fd, 0,
|
|
<BR> (unsigned int) (offset & 0xFFFFFFFF),
|
|
<BR> (unsigned int) (offset >> 32),
|
|
<BR> count);
|
|
|
|
|
|
<P>
|
|
|
|
Since the offset argument is 64 bits, and the first argument
|
|
(<I>fd</I>)
|
|
|
|
is passed in
|
|
<I>r0</I>,
|
|
|
|
the caller must manually split and align the 64-bit value
|
|
so that it is passed in the
|
|
<I>r2</I>/<I>r3</I>
|
|
|
|
register pair.
|
|
That means inserting a dummy value into
|
|
<I>r1</I>
|
|
|
|
(the second argument of 0).
|
|
Care also must be taken so that the split follows endian conventions
|
|
(according to the C ABI for the platform).
|
|
<P>
|
|
|
|
Similar issues can occur on MIPS with the O32 ABI,
|
|
on PowerPC and parisc with the 32-bit ABI, and on Xtensa.
|
|
|
|
|
|
<P>
|
|
|
|
|
|
Note that while the parisc C ABI also uses aligned register pairs,
|
|
it uses a shim layer to hide the issue from user space.
|
|
<P>
|
|
|
|
The affected system calls are
|
|
<B><A HREF="/cgi-bin/man/man2html?2+fadvise64_64">fadvise64_64</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+ftruncate64">ftruncate64</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+posix_fadvise">posix_fadvise</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+pread64">pread64</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+pwrite64">pwrite64</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+readahead">readahead</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+sync_file_range">sync_file_range</A></B>(2),
|
|
|
|
and
|
|
<B><A HREF="/cgi-bin/man/man2html?2+truncate64">truncate64</A></B>(2).
|
|
|
|
<P>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
This does not affect syscalls that manually split and assemble 64-bit values
|
|
such as
|
|
<B><A HREF="/cgi-bin/man/man2html?2+_llseek">_llseek</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+preadv">preadv</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+preadv2">preadv2</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+pwritev">pwritev</A></B>(2),
|
|
|
|
and
|
|
<B><A HREF="/cgi-bin/man/man2html?2+pwritev2">pwritev2</A></B>(2).
|
|
|
|
Welcome to the wonderful world of historical baggage.
|
|
<A NAME="lbAH"> </A>
|
|
<H3>Architecture calling conventions</H3>
|
|
|
|
Every architecture has its own way of invoking and passing arguments to the
|
|
kernel.
|
|
The details for various architectures are listed in the two tables below.
|
|
<P>
|
|
|
|
The first table lists the instruction used to transition to kernel mode
|
|
(which might not be the fastest or best way to transition to the kernel,
|
|
so you might have to refer to
|
|
<B><A HREF="/cgi-bin/man/man2html?7+vdso">vdso</A></B>(7)),
|
|
|
|
the register used to indicate the system call number,
|
|
the register(s) used to return the system call result,
|
|
and the register used to signal an error.
|
|
|
|
<TABLE>
|
|
<TR VALIGN=top><TD>Arch/ABI </TD><TD>Instruction </TD><TD>System </TD><TD>Ret </TD><TD>Ret </TD><TD>Error </TD><TD>Notes<BR></TD></TR>
|
|
<TR VALIGN=top><TD> </TD><TD> </TD><TD>call # </TD><TD>val </TD><TD>val2 </TD><TD> </TD><TD><BR></TD></TR>
|
|
<TR VALIGN=top><TD COLSPAN=7><HR></TD></TR>
|
|
<TR VALIGN=top><TD>alpha </TD><TD>callsys </TD><TD>v0 </TD><TD>v0 </TD><TD>a4 </TD><TD>a3 </TD><TD>1, 6<BR></TD></TR>
|
|
<TR VALIGN=top><TD>arc </TD><TD>trap0 </TD><TD>r8 </TD><TD>r0 </TD><TD>- </TD><TD>- </TD><TD><BR></TD></TR>
|
|
<TR VALIGN=top><TD>arm/OABI </TD><TD>swi NR </TD><TD>- </TD><TD>a1 </TD><TD>- </TD><TD>- </TD><TD>2<BR></TD></TR>
|
|
<TR VALIGN=top><TD>arm/EABI </TD><TD>swi 0x0 </TD><TD>r7 </TD><TD>r0 </TD><TD>r1 </TD><TD>- </TD><TD><BR></TD></TR>
|
|
<TR VALIGN=top><TD>arm64 </TD><TD>svc #0 </TD><TD>x8 </TD><TD>x0 </TD><TD>x1 </TD><TD>- </TD><TD><BR></TD></TR>
|
|
<TR VALIGN=top><TD>blackfin </TD><TD>excpt 0x0 </TD><TD>P0 </TD><TD>R0 </TD><TD>- </TD><TD>- </TD><TD><BR></TD></TR>
|
|
<TR VALIGN=top><TD>i386 </TD><TD>int $0x80 </TD><TD>eax </TD><TD>eax </TD><TD>edx </TD><TD>- </TD><TD><BR></TD></TR>
|
|
<TR VALIGN=top><TD>ia64 </TD><TD>break 0x100000 </TD><TD>r15 </TD><TD>r8 </TD><TD>r9 </TD><TD>r10 </TD><TD>1, 6<BR></TD></TR>
|
|
<TR VALIGN=top><TD>m68k </TD><TD>trap #0 </TD><TD>d0 </TD><TD>d0 </TD><TD>- </TD><TD>- </TD><TD><BR></TD></TR>
|
|
<TR VALIGN=top><TD>microblaze </TD><TD>brki r14,8 </TD><TD>r12 </TD><TD>r3 </TD><TD>- </TD><TD>- </TD><TD><BR></TD></TR>
|
|
<TR VALIGN=top><TD>mips </TD><TD>syscall </TD><TD>v0 </TD><TD>v0 </TD><TD>v1 </TD><TD>a3 </TD><TD>1, 6<BR></TD></TR>
|
|
<TR VALIGN=top><TD>nios2 </TD><TD>trap </TD><TD>r2 </TD><TD>r2 </TD><TD>- </TD><TD>r7 </TD><TD><BR></TD></TR>
|
|
<TR VALIGN=top><TD>parisc </TD><TD>ble 0x100(%sr2, %r0) </TD><TD>r20 </TD><TD>r28 </TD><TD>- </TD><TD>- </TD><TD><BR></TD></TR>
|
|
<TR VALIGN=top><TD>powerpc </TD><TD>sc </TD><TD>r0 </TD><TD>r3 </TD><TD>- </TD><TD>r0 </TD><TD>1<BR></TD></TR>
|
|
<TR VALIGN=top><TD>powerpc64 </TD><TD>sc </TD><TD>r0 </TD><TD>r3 </TD><TD>- </TD><TD>cr0.SO </TD><TD>1<BR></TD></TR>
|
|
<TR VALIGN=top><TD>riscv </TD><TD>ecall </TD><TD>a7 </TD><TD>a0 </TD><TD>a1 </TD><TD>- </TD><TD><BR></TD></TR>
|
|
<TR VALIGN=top><TD>s390 </TD><TD>svc 0 </TD><TD>r1 </TD><TD>r2 </TD><TD>r3 </TD><TD>- </TD><TD>3<BR></TD></TR>
|
|
<TR VALIGN=top><TD>s390x </TD><TD>svc 0 </TD><TD>r1 </TD><TD>r2 </TD><TD>r3 </TD><TD>- </TD><TD>3<BR></TD></TR>
|
|
<TR VALIGN=top><TD>superh </TD><TD>trap #0x17 </TD><TD>r3 </TD><TD>r0 </TD><TD>r1 </TD><TD>- </TD><TD>4, 6<BR></TD></TR>
|
|
<TR VALIGN=top><TD>sparc/32 </TD><TD>t 0x10 </TD><TD>g1 </TD><TD>o0 </TD><TD>o1 </TD><TD>psr/csr </TD><TD>1, 6<BR></TD></TR>
|
|
<TR VALIGN=top><TD>sparc/64 </TD><TD>t 0x6d </TD><TD>g1 </TD><TD>o0 </TD><TD>o1 </TD><TD>psr/csr </TD><TD>1, 6<BR></TD></TR>
|
|
<TR VALIGN=top><TD>tile </TD><TD>swint1 </TD><TD>R10 </TD><TD>R00 </TD><TD>- </TD><TD>R01 </TD><TD>1<BR></TD></TR>
|
|
<TR VALIGN=top><TD>x86-64 </TD><TD>syscall </TD><TD>rax </TD><TD>rax </TD><TD>rdx </TD><TD>- </TD><TD>5<BR></TD></TR>
|
|
<TR VALIGN=top><TD>x32 </TD><TD>syscall </TD><TD>rax </TD><TD>rax </TD><TD>rdx </TD><TD>- </TD><TD>5<BR></TD></TR>
|
|
<TR VALIGN=top><TD>xtensa </TD><TD>syscall </TD><TD>a2 </TD><TD>a2 </TD><TD>- </TD><TD>- </TD><TD><BR></TD></TR>
|
|
</TABLE>
|
|
|
|
<P>
|
|
|
|
Notes:
|
|
<DL COMPACT>
|
|
<DT id="4">[1]<DD>
|
|
On a few architectures,
|
|
a register is used as a boolean
|
|
(0 indicating no error, and -1 indicating an error) to signal that the
|
|
system call failed.
|
|
The actual error value is still contained in the return register.
|
|
On sparc, the carry bit
|
|
(<I>csr</I>)
|
|
|
|
in the processor status register
|
|
(<I>psr</I>)
|
|
|
|
is used instead of a full register.
|
|
On powerpc64, the summary overflow bit
|
|
(<I>SO</I>)
|
|
|
|
in field 0 of the condition register
|
|
(<I>cr0</I>)
|
|
|
|
is used.
|
|
<DT id="5">[2]<DD>
|
|
<I>NR</I>
|
|
|
|
is the system call number.
|
|
<DT id="6">[3]<DD>
|
|
For s390 and s390x,
|
|
<I>NR</I>
|
|
|
|
(the system call number) may be passed directly with
|
|
<I>svc NR</I>
|
|
|
|
if it is less than 256.
|
|
<DT id="7">[4]<DD>
|
|
On SuperH, the trap number controls the maximum number of arguments passed.
|
|
A
|
|
<I>trap #0x10</I>
|
|
|
|
can be used with only 0-argument system calls, a
|
|
<I>trap #0x11</I>
|
|
|
|
can be used with 0- or 1-argument system calls,
|
|
and so on up to
|
|
<I>trap #0x17</I>
|
|
|
|
for 7-argument system calls.
|
|
<DT id="8">[5]<DD>
|
|
The x32 ABI shares syscall table with x86-64 ABI, but there are some
|
|
nuances:
|
|
<DL COMPACT><DT id="9"><DD>
|
|
<DL COMPACT>
|
|
<DT id="10">•<DD>
|
|
In order to indicate that a system call is called under the x32 ABI,
|
|
an additional bit,
|
|
<B>__X32_SYSCALL_BIT</B>,
|
|
|
|
is bitwise-ORed with the system call number.
|
|
The ABI used by a process affects some process behaviors,
|
|
including signal handling or system call restarting.
|
|
<DT id="11">•<DD>
|
|
Since x32 has different sizes for
|
|
<I>long</I>
|
|
|
|
and pointer types, layouts of some (but not all;
|
|
<I>struct timeval</I>
|
|
|
|
or
|
|
<I>struct rlimit</I>
|
|
|
|
are 64-bit, for example) structures are different.
|
|
In order to handle this,
|
|
additional system calls are added to the system call table,
|
|
starting from number 512
|
|
(without the
|
|
<B>__X32_SYSCALL_BIT</B>).
|
|
|
|
For example,
|
|
<B>__NR_readv</B>
|
|
|
|
is defined as 19 for the x86-64 ABI and as
|
|
<I>__X32_SYSCALL_BIT</I> | <I></I><B>515</B>
|
|
|
|
for the x32 ABI.
|
|
Most of these additional system calls are actually identical
|
|
to the system calls used for providing i386 compat.
|
|
There are some notable exceptions, however, such as
|
|
<B><A HREF="/cgi-bin/man/man2html?2+preadv2">preadv2</A></B>(2),
|
|
|
|
which uses
|
|
<I>struct iovec</I>
|
|
|
|
entities with 4-byte pointers and sizes ("compat_iovec" in kernel terms),
|
|
but passes an 8-byte
|
|
<I>pos</I>
|
|
|
|
argument in a single register and not two, as is done in every other ABI.
|
|
</DL>
|
|
</DL>
|
|
|
|
<DT id="12">[6]<DD>
|
|
Some architectures
|
|
(namely, Alpha, IA-64, MIPS, SuperH, sparc/32, and sparc/64)
|
|
use an additional register ("Retval2" in the above table)
|
|
to pass back a second return value from the
|
|
<B><A HREF="/cgi-bin/man/man2html?2+pipe">pipe</A></B>(2)
|
|
|
|
system call;
|
|
Alpha uses this technique in the architecture-specific
|
|
<B><A HREF="/cgi-bin/man/man2html?2+getxpid">getxpid</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+getxuid">getxuid</A></B>(2),
|
|
|
|
and
|
|
<B><A HREF="/cgi-bin/man/man2html?2+getxgid">getxgid</A></B>(2)
|
|
|
|
system calls as well.
|
|
Other architectures do not use the second return value register
|
|
in the system call interface, even if it is defined in the System V ABI.
|
|
|
|
</DL>
|
|
<P>
|
|
|
|
The second table shows the registers used to pass the system call arguments.
|
|
|
|
<TABLE>
|
|
<TR VALIGN=top><TD>Arch/ABI</TD><TD>arg1 </TD><TD>arg2 </TD><TD>arg3 </TD><TD>arg4 </TD><TD>arg5 </TD><TD>arg6 </TD><TD>arg7 </TD><TD>Notes<BR></TD></TR>
|
|
<TR VALIGN=top><TD COLSPAN=9><HR></TD></TR>
|
|
<TR VALIGN=top><TD>alpha</TD><TD>a0 </TD><TD>a1 </TD><TD>a2 </TD><TD>a3 </TD><TD>a4 </TD><TD>a5 </TD><TD>- </TD><TD><BR></TD></TR>
|
|
<TR VALIGN=top><TD>arc</TD><TD>r0 </TD><TD>r1 </TD><TD>r2 </TD><TD>r3 </TD><TD>r4 </TD><TD>r5 </TD><TD>- </TD><TD><BR></TD></TR>
|
|
<TR VALIGN=top><TD>arm/OABI</TD><TD>a1 </TD><TD>a2 </TD><TD>a3 </TD><TD>a4 </TD><TD>v1 </TD><TD>v2 </TD><TD>v3 </TD><TD><BR></TD></TR>
|
|
<TR VALIGN=top><TD>arm/EABI</TD><TD>r0 </TD><TD>r1 </TD><TD>r2 </TD><TD>r3 </TD><TD>r4 </TD><TD>r5 </TD><TD>r6 </TD><TD><BR></TD></TR>
|
|
<TR VALIGN=top><TD>arm64</TD><TD>x0 </TD><TD>x1 </TD><TD>x2 </TD><TD>x3 </TD><TD>x4 </TD><TD>x5 </TD><TD>- </TD><TD><BR></TD></TR>
|
|
<TR VALIGN=top><TD>blackfin</TD><TD>R0 </TD><TD>R1 </TD><TD>R2 </TD><TD>R3 </TD><TD>R4 </TD><TD>R5 </TD><TD>- </TD><TD><BR></TD></TR>
|
|
<TR VALIGN=top><TD>i386</TD><TD>ebx </TD><TD>ecx </TD><TD>edx </TD><TD>esi </TD><TD>edi </TD><TD>ebp </TD><TD>- </TD><TD><BR></TD></TR>
|
|
<TR VALIGN=top><TD>ia64</TD><TD>out0 </TD><TD>out1 </TD><TD>out2 </TD><TD>out3 </TD><TD>out4 </TD><TD>out5 </TD><TD>- </TD><TD><BR></TD></TR>
|
|
<TR VALIGN=top><TD>m68k</TD><TD>d1 </TD><TD>d2 </TD><TD>d3 </TD><TD>d4 </TD><TD>d5 </TD><TD>a0 </TD><TD>- </TD><TD><BR></TD></TR>
|
|
<TR VALIGN=top><TD>microblaze</TD><TD>r5 </TD><TD>r6 </TD><TD>r7 </TD><TD>r8 </TD><TD>r9 </TD><TD>r10 </TD><TD>- </TD><TD><BR></TD></TR>
|
|
<TR VALIGN=top><TD>mips/o32</TD><TD>a0 </TD><TD>a1 </TD><TD>a2 </TD><TD>a3 </TD><TD>- </TD><TD>- </TD><TD>- </TD><TD>1<BR></TD></TR>
|
|
<TR VALIGN=top><TD>mips/n32,64</TD><TD>a0 </TD><TD>a1 </TD><TD>a2 </TD><TD>a3 </TD><TD>a4 </TD><TD>a5 </TD><TD>- </TD><TD><BR></TD></TR>
|
|
<TR VALIGN=top><TD>nios2</TD><TD>r4 </TD><TD>r5 </TD><TD>r6 </TD><TD>r7 </TD><TD>r8 </TD><TD>r9 </TD><TD>- </TD><TD><BR></TD></TR>
|
|
<TR VALIGN=top><TD>parisc</TD><TD>r26 </TD><TD>r25 </TD><TD>r24 </TD><TD>r23 </TD><TD>r22 </TD><TD>r21 </TD><TD>- </TD><TD><BR></TD></TR>
|
|
<TR VALIGN=top><TD>powerpc</TD><TD>r3 </TD><TD>r4 </TD><TD>r5 </TD><TD>r6 </TD><TD>r7 </TD><TD>r8 </TD><TD>r9 </TD><TD><BR></TD></TR>
|
|
<TR VALIGN=top><TD>powerpc64</TD><TD>r3 </TD><TD>r4 </TD><TD>r5 </TD><TD>r6 </TD><TD>r7 </TD><TD>r8 </TD><TD>- </TD><TD><BR></TD></TR>
|
|
<TR VALIGN=top><TD>riscv</TD><TD>a0 </TD><TD>a1 </TD><TD>a2 </TD><TD>a3 </TD><TD>a4 </TD><TD>a5 </TD><TD>- </TD><TD><BR></TD></TR>
|
|
<TR VALIGN=top><TD>s390</TD><TD>r2 </TD><TD>r3 </TD><TD>r4 </TD><TD>r5 </TD><TD>r6 </TD><TD>r7 </TD><TD>- </TD><TD><BR></TD></TR>
|
|
<TR VALIGN=top><TD>s390x</TD><TD>r2 </TD><TD>r3 </TD><TD>r4 </TD><TD>r5 </TD><TD>r6 </TD><TD>r7 </TD><TD>- </TD><TD><BR></TD></TR>
|
|
<TR VALIGN=top><TD>superh</TD><TD>r4 </TD><TD>r5 </TD><TD>r6 </TD><TD>r7 </TD><TD>r0 </TD><TD>r1 </TD><TD>r2 </TD><TD><BR></TD></TR>
|
|
<TR VALIGN=top><TD>sparc/32</TD><TD>o0 </TD><TD>o1 </TD><TD>o2 </TD><TD>o3 </TD><TD>o4 </TD><TD>o5 </TD><TD>- </TD><TD><BR></TD></TR>
|
|
<TR VALIGN=top><TD>sparc/64</TD><TD>o0 </TD><TD>o1 </TD><TD>o2 </TD><TD>o3 </TD><TD>o4 </TD><TD>o5 </TD><TD>- </TD><TD><BR></TD></TR>
|
|
<TR VALIGN=top><TD>tile</TD><TD>R00 </TD><TD>R01 </TD><TD>R02 </TD><TD>R03 </TD><TD>R04 </TD><TD>R05 </TD><TD>- </TD><TD><BR></TD></TR>
|
|
<TR VALIGN=top><TD>x86-64</TD><TD>rdi </TD><TD>rsi </TD><TD>rdx </TD><TD>r10 </TD><TD>r8 </TD><TD>r9 </TD><TD>- </TD><TD><BR></TD></TR>
|
|
<TR VALIGN=top><TD>x32</TD><TD>rdi </TD><TD>rsi </TD><TD>rdx </TD><TD>r10 </TD><TD>r8 </TD><TD>r9 </TD><TD>- </TD><TD><BR></TD></TR>
|
|
<TR VALIGN=top><TD>xtensa</TD><TD>a6 </TD><TD>a3 </TD><TD>a4 </TD><TD>a5 </TD><TD>a8 </TD><TD>a9 </TD><TD>- </TD><TD><BR></TD></TR>
|
|
</TABLE>
|
|
|
|
<P>
|
|
|
|
Notes:
|
|
<DL COMPACT>
|
|
<DT id="13">[1]<DD>
|
|
The mips/o32 system call convention passes
|
|
arguments 5 through 8 on the user stack.
|
|
|
|
</DL>
|
|
<P>
|
|
|
|
Note that these tables don't cover the entire calling convention---some
|
|
architectures may indiscriminately clobber other registers not listed here.
|
|
<A NAME="lbAI"> </A>
|
|
<H2>EXAMPLE</H2>
|
|
|
|
|
|
#define _GNU_SOURCE
|
|
#include <<A HREF="file:///usr/include/unistd.h">unistd.h</A>>
|
|
#include <<A HREF="file:///usr/include/sys/syscall.h">sys/syscall.h</A>>
|
|
#include <<A HREF="file:///usr/include/sys/types.h">sys/types.h</A>>
|
|
#include <<A HREF="file:///usr/include/signal.h">signal.h</A>>
|
|
<P>
|
|
int
|
|
main(int argc, char *argv[])
|
|
{
|
|
<BR> pid_t tid;
|
|
<P>
|
|
<BR> tid = syscall(SYS_gettid);
|
|
<BR> syscall(SYS_tgkill, getpid(), tid, SIGHUP);
|
|
}
|
|
|
|
<A NAME="lbAJ"> </A>
|
|
<H2>SEE ALSO</H2>
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+_syscall">_syscall</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+intro">intro</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+syscalls">syscalls</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?3+errno">errno</A></B>(3),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?7+vdso">vdso</A></B>(7)
|
|
|
|
<A NAME="lbAK"> </A>
|
|
<H2>COLOPHON</H2>
|
|
|
|
This page is part of release 5.05 of the Linux
|
|
<I>man-pages</I>
|
|
|
|
project.
|
|
A description of the project,
|
|
information about reporting bugs,
|
|
and the latest version of this page,
|
|
can be found at
|
|
<A HREF="https://www.kernel.org/doc/man-pages/.">https://www.kernel.org/doc/man-pages/.</A>
|
|
<P>
|
|
|
|
<HR>
|
|
<A NAME="index"> </A><H2>Index</H2>
|
|
<DL>
|
|
<DT id="14"><A HREF="#lbAB">NAME</A><DD>
|
|
<DT id="15"><A HREF="#lbAC">SYNOPSIS</A><DD>
|
|
<DT id="16"><A HREF="#lbAD">DESCRIPTION</A><DD>
|
|
<DT id="17"><A HREF="#lbAE">RETURN VALUE</A><DD>
|
|
<DT id="18"><A HREF="#lbAF">NOTES</A><DD>
|
|
<DL>
|
|
<DT id="19"><A HREF="#lbAG">Architecture-specific requirements</A><DD>
|
|
<DT id="20"><A HREF="#lbAH">Architecture calling conventions</A><DD>
|
|
</DL>
|
|
<DT id="21"><A HREF="#lbAI">EXAMPLE</A><DD>
|
|
<DT id="22"><A HREF="#lbAJ">SEE ALSO</A><DD>
|
|
<DT id="23"><A HREF="#lbAK">COLOPHON</A><DD>
|
|
</DL>
|
|
<HR>
|
|
This document was created by
|
|
<A HREF="/cgi-bin/man/man2html">man2html</A>,
|
|
using the manual pages.<BR>
|
|
Time: 00:05:35 GMT, March 31, 2021
|
|
</BODY>
|
|
</HTML>
|