mirror of https://github.com/mkerrisk/man-pages
syscall.2: Minor fix-ups to Changhee Han's patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
parent
638fd4bfda
commit
9525301640
|
@ -37,7 +37,7 @@
|
||||||
.\" 2002-03-20 Christoph Hellwig <hch@infradead.org>
|
.\" 2002-03-20 Christoph Hellwig <hch@infradead.org>
|
||||||
.\" - adopted for Linux
|
.\" - adopted for Linux
|
||||||
.\"
|
.\"
|
||||||
.TH SYSCALL 2 2012-08-14 "Linux" "Linux Programmer's Manual"
|
.TH SYSCALL 2 2013-04-01 "Linux" "Linux Programmer's Manual"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
syscall \- indirect system call
|
syscall \- indirect system call
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
|
@ -80,8 +80,11 @@ and an error code is stored in
|
||||||
first appeared in
|
first appeared in
|
||||||
4BSD.
|
4BSD.
|
||||||
|
|
||||||
Each architecture ABI has its own requirements on how system call arguments are passed to the kernel.
|
Each architecture ABI has its own requirements on how
|
||||||
For system calls that have a glibc wrapper (i.g., most system calls) glibc handles the details of copy arguments to the right registers in a manner suitable for the architecture.
|
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 copyiing arguments to the right registers
|
||||||
|
in a manner suitable for the architecture.
|
||||||
However, when using
|
However, when using
|
||||||
.BR syscall ()
|
.BR syscall ()
|
||||||
to make a system call,
|
to make a system call,
|
||||||
|
@ -90,25 +93,24 @@ For example, on ARM architecture, a
|
||||||
.I "long long"
|
.I "long long"
|
||||||
argument is considered to be 8-byte aligned and to be split into two 4-byte arguments.
|
argument is considered to be 8-byte aligned and to be split into two 4-byte arguments.
|
||||||
|
|
||||||
|
For example, the
|
||||||
.BR readahead ()
|
.BR readahead ()
|
||||||
system call could be called like below in ARM architecture.
|
system call would be invoked as follows on the ARM architecture:
|
||||||
|
|
||||||
syscall(__NR_readahead, fd,
|
|
||||||
.I 0
|
|
||||||
, (unsigned int)(
|
|
||||||
.I offset
|
|
||||||
>> 32), (unsigned int)(
|
|
||||||
.I offset
|
|
||||||
& 0xFFFFFFFF), count)
|
|
||||||
|
|
||||||
|
.in +4n
|
||||||
|
.nf
|
||||||
|
syscall(__NR_readahead, fd, 0, (unsigned int)(offset >> 32),
|
||||||
|
(unsigned int)(offset & 0xFFFFFFFF), count);
|
||||||
|
.fi
|
||||||
|
.in
|
||||||
|
.PP
|
||||||
.I offset
|
.I offset
|
||||||
is 64 bit and should be 8-byte aligned.
|
is 64 bit and should be 8-byte aligned.
|
||||||
Thus, a padding is inserted before
|
Thus, a padding is inserted before
|
||||||
.I offset
|
.I offset
|
||||||
and
|
and
|
||||||
.I offset
|
.I offset
|
||||||
is split into two 32 bit arguments.
|
is split into two 32-bit arguments.
|
||||||
|
|
||||||
.SH EXAMPLE
|
.SH EXAMPLE
|
||||||
.nf
|
.nf
|
||||||
#define _GNU_SOURCE
|
#define _GNU_SOURCE
|
||||||
|
|
Loading…
Reference in New Issue