Wrapped long lines, wrapped at sentence boundaries; stripped trailing

white space.
This commit is contained in:
Michael Kerrisk 2007-04-12 22:42:49 +00:00
parent 4174ff5658
commit c13182efa3
834 changed files with 13253 additions and 10447 deletions

View File

@ -8,6 +8,8 @@ Contributors
The following people contributed notes, ideas, or patches that have The following people contributed notes, ideas, or patches that have
been incorporated in changes in this release: been incorporated in changes in this release:
Andi Kleen <andi@firstfloor.org>
John Heffner <jheffner@psc.edu>
Apologies if I missed anyone! Apologies if I missed anyone!
@ -15,9 +17,6 @@ Apologies if I missed anyone!
New pages New pages
--------- ---------
Andi Kleen <andi@firstfloor.org>
John Heffner <jheffner@psc.edu>
Global changes Global changes
-------------- --------------

View File

@ -5476,7 +5476,7 @@ Samuel Thibault <samuel.thibault@ens-lyon.org>
Serge E. Hallyn <serge@hallyn.com> Serge E. Hallyn <serge@hallyn.com>
Thomas Huriaux <thomas.huriaux@gmail.com> Thomas Huriaux <thomas.huriaux@gmail.com>
Timo Sirainen <tss@iki.fi> Timo Sirainen <tss@iki.fi>
Val Henson <val_henson@linux.interl.com> Val Henson <val_henson@linux.intel.com>
Apologies if I missed anyone! Apologies if I missed anyone!

View File

@ -11,7 +11,7 @@
.\" manual under the conditions for verbatim copying, provided that the .\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a .\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one. .\" permission notice identical to this one.
.\" .\"
.\" Since the Linux kernel and libraries are constantly changing, this .\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no .\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" responsibility for errors or omissions, or for damages resulting from .\" responsibility for errors or omissions, or for damages resulting from
@ -19,7 +19,7 @@
.\" have taken the same level of care in the production of this manual, .\" have taken the same level of care in the production of this manual,
.\" which is licensed free of charge, as they might when working .\" which is licensed free of charge, as they might when working
.\" professionally. .\" professionally.
.\" .\"
.\" Formatted or processed versions of this manual, if unaccompanied by .\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work. .\" the source, must acknowledge the copyright and authors of this work.
.\" .\"
@ -40,9 +40,10 @@ _exit, _Exit \- terminate the current process
.SH DESCRIPTION .SH DESCRIPTION
The function The function
.BR _exit () .BR _exit ()
terminates the calling process "immediately". Any open file descriptors terminates the calling process "immediately".
Any open file descriptors
belonging to the process are closed; any children of the process are belonging to the process are closed; any children of the process are
inherited by process 1, inherited by process 1,
.IR init , .IR init ,
and the process's parent is sent a and the process's parent is sent a
.B SIGCHLD .B SIGCHLD
@ -74,7 +75,7 @@ The function
is like \fBexit\fP(), but does not call any is like \fBexit\fP(), but does not call any
functions registered with functions registered with
.BR atexit () .BR atexit ()
or or
.BR on_exit (). .BR on_exit ().
Whether it flushes Whether it flushes
standard I/O buffers and removes temporary files created with standard I/O buffers and removes temporary files created with
@ -83,11 +84,12 @@ is implementation dependent.
On the other hand, On the other hand,
.BR _exit () .BR _exit ()
does close open file descriptors, and this may cause an unknown delay, does close open file descriptors, and this may cause an unknown delay,
waiting for pending output to finish. If the delay is undesired, waiting for pending output to finish.
If the delay is undesired,
it may be useful to call functions like \fItcflush\fP() before it may be useful to call functions like \fItcflush\fP() before
calling \fB_exit\fP(). calling \fB_exit\fP().
Whether any pending I/O is cancelled, and which pending I/O may be Whether any pending I/O is cancelled, and which pending I/O may be
cancelled upon \fB_exit\fP(), is implementation-dependent. cancelled upon \fB_exit\fP(), is implementation-dependent.
.SH "SEE ALSO" .SH "SEE ALSO"
.BR execve (2), .BR execve (2),
.BR exit_group (2), .BR exit_group (2),

View File

@ -69,7 +69,7 @@ and is listening for connections after a
The argument The argument
.I addr .I addr
is a pointer to a is a pointer to a
.I sockaddr .I sockaddr
structure. structure.
This structure is filled in with the address of the peer socket, This structure is filled in with the address of the peer socket,
@ -77,7 +77,7 @@ as known to the communications layer.
The exact format of the address returned The exact format of the address returned
.I addr .I addr
is determined by the socket's address family (see is determined by the socket's address family (see
.BR socket (2) .BR socket (2)
and the respective protocol man pages). and the respective protocol man pages).
The The
.I addrlen .I addrlen
@ -85,7 +85,8 @@ argument is a value-result argument: it should initially contain the
size of the structure pointed to by size of the structure pointed to by
.IR addr ; .IR addr ;
on return it will contain the actual length (in bytes) of the address on return it will contain the actual length (in bytes) of the address
returned. When returned.
When
.I addr .I addr
is NULL nothing is filled in. is NULL nothing is filled in.
.PP .PP
@ -93,10 +94,11 @@ If no pending
connections are present on the queue, and the socket is not marked as connections are present on the queue, and the socket is not marked as
non-blocking, non-blocking,
.BR accept () .BR accept ()
blocks the caller until a connection is present. If the socket is marked blocks the caller until a connection is present.
If the socket is marked
non-blocking and no pending connections are present on the queue, non-blocking and no pending connections are present on the queue,
.BR accept () .BR accept ()
fails with the error EAGAIN. fails with the error EAGAIN.
.PP .PP
In order to be notified of incoming connections on a socket, you can use In order to be notified of incoming connections on a socket, you can use
.BR select (2) .BR select (2)
@ -105,8 +107,8 @@ or
A readable event will be delivered when a new connection is attempted and you A readable event will be delivered when a new connection is attempted and you
may then call may then call
.BR accept () .BR accept ()
to get a socket for that connection. Alternatively, you can set the socket to get a socket for that connection.
to deliver Alternatively, you can set the socket to deliver
.B SIGIO .B SIGIO
when activity occurs on a socket; see when activity occurs on a socket; see
.BR socket (7) .BR socket (7)
@ -117,11 +119,13 @@ such as
DECNet, DECNet,
.BR accept () .BR accept ()
can be thought of as merely dequeuing the next connection request and not can be thought of as merely dequeuing the next connection request and not
implying confirmation. Confirmation can be implied by implying confirmation.
Confirmation can be implied by
a normal read or write on the new file descriptor, and rejection can be a normal read or write on the new file descriptor, and rejection can be
implied by closing the new socket. Currently only implied by closing the new socket.
DECNet Currently only
has these semantics on Linux. DECNet
has these semantics on Linux.
.SH NOTES .SH NOTES
There may not always be a connection waiting after a There may not always be a connection waiting after a
.B SIGIO .B SIGIO
@ -152,19 +156,21 @@ On error, \-1 is returned, and
.I errno .I errno
is set appropriately. is set appropriately.
.SH "ERROR HANDLING" .SH "ERROR HANDLING"
Linux Linux
.BR accept () .BR accept ()
passes already-pending network errors on the new socket passes already-pending network errors on the new socket
as an error code from as an error code from
.BR accept (). .BR accept ().
This behaviour differs from other BSD socket This behaviour differs from other BSD socket
implementations. For reliable operation the application should detect implementations.
the network errors defined for the protocol after For reliable operation the application should detect
the network errors defined for the protocol after
.BR accept () .BR accept ()
and treat and treat
them like them like
.BR EAGAIN .BR EAGAIN
by retrying. In case of TCP/IP these are by retrying.
In case of TCP/IP these are
.BR ENETDOWN , .BR ENETDOWN ,
.BR EPROTO , .BR EPROTO ,
.BR ENOPROTOOPT , .BR ENOPROTOOPT ,
@ -190,7 +196,7 @@ A connection has been aborted.
.TP .TP
.B EINTR .B EINTR
The system call was interrupted by a signal that was caught The system call was interrupted by a signal that was caught
before a valid connection arrived. before a valid connection arrived.
.TP .TP
.B EINVAL .B EINVAL
Socket is not listening for connections, or Socket is not listening for connections, or
@ -208,7 +214,7 @@ The descriptor references a file, not a socket.
.TP .TP
.B EOPNOTSUPP .B EOPNOTSUPP
The referenced socket is not of type The referenced socket is not of type
.BR SOCK_STREAM . .BR SOCK_STREAM .
.PP .PP
.BR accept () .BR accept ()
may fail if: may fail if:
@ -219,7 +225,7 @@ The
argument is not in a writable part of the user address space. argument is not in a writable part of the user address space.
.TP .TP
.B ENOBUFS, ENOMEM .B ENOBUFS, ENOMEM
Not enough free memory. Not enough free memory.
This often means that the memory allocation is limited by the socket buffer This often means that the memory allocation is limited by the socket buffer
limits, not by the system memory. limits, not by the system memory.
.TP .TP
@ -234,7 +240,8 @@ may fail if:
Firewall rules forbid connection. Firewall rules forbid connection.
.PP .PP
In addition, network errors for the new socket and as defined In addition, network errors for the new socket and as defined
for the protocol may be returned. Various Linux kernels can for the protocol may be returned.
Various Linux kernels can
return other errors such as return other errors such as
.BR ENOSR , .BR ENOSR ,
.BR ESOCKTNOSUPPORT , .BR ESOCKTNOSUPPORT ,
@ -244,18 +251,18 @@ The value
.B ERESTARTSYS .B ERESTARTSYS
may be seen during a trace. may be seen during a trace.
.SH "CONFORMING TO" .SH "CONFORMING TO"
SVr4, 4.4BSD, SVr4, 4.4BSD,
.RB ( accept () .RB ( accept ()
first appeared in 4.2BSD), POSIX.1-2001. first appeared in 4.2BSD), POSIX.1-2001.
.\" The BSD man page documents five possible error returns .\" The BSD man page documents five possible error returns
.\" (EBADF, ENOTSOCK, EOPNOTSUPP, EWOULDBLOCK, EFAULT). .\" (EBADF, ENOTSOCK, EOPNOTSUPP, EWOULDBLOCK, EFAULT).
.\" POSIX.1-2001 documents errors .\" POSIX.1-2001 documents errors
.\" EAGAIN, EBADF, ECONNABORTED, EINTR, EINVAL, EMFILE, .\" EAGAIN, EBADF, ECONNABORTED, EINTR, EINVAL, EMFILE,
.\" ENFILE, ENOBUFS, ENOMEM, ENOTSOCK, EOPNOTSUPP, EPROTO, EWOULDBLOCK. .\" ENFILE, ENOBUFS, ENOMEM, ENOTSOCK, EOPNOTSUPP, EPROTO, EWOULDBLOCK.
.\" In addition, SUSv2 documents EFAULT and ENOSR. .\" In addition, SUSv2 documents EFAULT and ENOSR.
.LP .LP
On Linux, the new socket returned by On Linux, the new socket returned by
.BR accept () .BR accept ()
does \fInot\fP inherit file status flags such as does \fInot\fP inherit file status flags such as
.BR O_NONBLOCK .BR O_NONBLOCK
and and
@ -264,9 +271,9 @@ from the listening socket.
This behaviour differs from the canonical BSD sockets implementation. This behaviour differs from the canonical BSD sockets implementation.
.\" Some testing seems to show that Tru64 5.1 and HP-UX 11 also .\" Some testing seems to show that Tru64 5.1 and HP-UX 11 also
.\" do not inherit file status flags -- MTK Jun 05 .\" do not inherit file status flags -- MTK Jun 05
Portable programs should not rely on inheritance or non-inheritance Portable programs should not rely on inheritance or non-inheritance
of file status flags and always explicitly set all required flags on of file status flags and always explicitly set all required flags on
the socket returned from the socket returned from
.BR accept (). .BR accept ().
.SH NOTE .SH NOTE
The third argument of The third argument of
@ -281,14 +288,16 @@ Quoting Linus Torvalds:
.\" .I fails: only italicizes a single line .\" .I fails: only italicizes a single line
"_Any_ sane library _must_ have "socklen_t" be the same size "_Any_ sane library _must_ have "socklen_t" be the same size
as int. Anything else breaks any BSD socket layer stuff. as int.
Anything else breaks any BSD socket layer stuff.
POSIX initially \fIdid\fP make it a size_t, and I (and hopefully others, but POSIX initially \fIdid\fP make it a size_t, and I (and hopefully others, but
obviously not too many) complained to them very loudly indeed. Making obviously not too many) complained to them very loudly indeed.
it a size_t is completely broken, exactly because size_t very seldom is Making it a size_t is completely broken, exactly because size_t very
the same size as "int" on 64-bit architectures, for example. And it seldom is the same size as "int" on 64-bit architectures, for example.
And it
\fIhas\fP to be the same size as "int" because that's what the BSD socket \fIhas\fP to be the same size as "int" because that's what the BSD socket
interface is. interface is.
Anyway, the POSIX people eventually got a clue, and created "socklen_t". Anyway, the POSIX people eventually got a clue, and created "socklen_t".
They shouldn't have touched it in the first place, but once they did They shouldn't have touched it in the first place, but once they did
they felt it had to have a named type for some unfathomable reason they felt it had to have a named type for some unfathomable reason
(probably somebody didn't like losing face over having done the original (probably somebody didn't like losing face over having done the original

View File

@ -11,7 +11,7 @@
.\" manual under the conditions for verbatim copying, provided that the .\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a .\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one. .\" permission notice identical to this one.
.\" .\"
.\" Since the Linux kernel and libraries are constantly changing, this .\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no .\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" responsibility for errors or omissions, or for damages resulting from .\" responsibility for errors or omissions, or for damages resulting from
@ -19,7 +19,7 @@
.\" have taken the same level of care in the production of this manual, .\" have taken the same level of care in the production of this manual,
.\" which is licensed free of charge, as they might when working .\" which is licensed free of charge, as they might when working
.\" professionally. .\" professionally.
.\" .\"
.\" Formatted or processed versions of this manual, if unaccompanied by .\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work. .\" the source, must acknowledge the copyright and authors of this work.
.\" .\"
@ -81,17 +81,19 @@ actually attempting an operation.
This is to allow set-user-ID programs to This is to allow set-user-ID programs to
easily determine the invoking user's authority. easily determine the invoking user's authority.
Only access bits are checked, not the file type or contents. Therefore, if Only access bits are checked, not the file type or contents.
Therefore, if
a directory is found to be "writable," it probably means that files can be a directory is found to be "writable," it probably means that files can be
created in the directory, and not that the directory can be written as a created in the directory, and not that the directory can be written as a
file. Similarly, a DOS file may be found to be "executable," but the file.
Similarly, a DOS file may be found to be "executable," but the
.BR execve (2) .BR execve (2)
call will still fail. call will still fail.
If the process has appropriate privileges, an implementation may If the process has appropriate privileges, an implementation may
indicate success for indicate success for
.B X_OK .B X_OK
even if none of the execute file permission bits are set. even if none of the execute file permission bits are set.
.SH "RETURN VALUE" .SH "RETURN VALUE"
On success (all requested permissions granted), zero is returned. On success (all requested permissions granted), zero is returned.
On error (at least one bit in On error (at least one bit in
@ -155,7 +157,7 @@ executed.
.SH "LINUX NOTES" .SH "LINUX NOTES"
In kernels before 2.6.20, In kernels before 2.6.20,
.BR access () .BR access ()
ignored the effect of the ignored the effect of the
.B MS_NOEXEC .B MS_NOEXEC
flag if it was used to flag if it was used to
.BR mount (2) .BR mount (2)

View File

@ -43,10 +43,11 @@ acct \- switch process accounting on or off
.SH DESCRIPTION .SH DESCRIPTION
When called with the name of an existing file as argument, accounting is When called with the name of an existing file as argument, accounting is
turned on, records for each terminating process are appended to turned on, records for each terminating process are appended to
\fIfilename\fP as it terminates. An argument of NULL causes \fIfilename\fP as it terminates.
accounting to be turned off. An argument of NULL causes accounting to be turned off.
.SH "RETURN VALUE" .SH "RETURN VALUE"
On success, zero is returned. On error, \-1 is returned, and On success, zero is returned.
On error, \-1 is returned, and
.I errno .I errno
is set appropriately. is set appropriately.
.SH ERRORS .SH ERRORS
@ -71,11 +72,11 @@ Error writing to the file
.IR filename . .IR filename .
.TP .TP
.B EISDIR .B EISDIR
.I filename .I filename
is a directory. is a directory.
.TP .TP
.B ELOOP .B ELOOP
Too many symbolic links were encountered in resolving Too many symbolic links were encountered in resolving
.IR filename . .IR filename .
.TP .TP
.B ENAMETOOLONG .B ENAMETOOLONG
@ -98,8 +99,8 @@ The kernel configuration parameter controlling this feature is
CONFIG_BSD_PROCESS_ACCT. CONFIG_BSD_PROCESS_ACCT.
.TP .TP
.B ENOTDIR .B ENOTDIR
A component used as a directory in A component used as a directory in
.I filename .I filename
is not in fact a directory. is not in fact a directory.
.TP .TP
.B EPERM .B EPERM
@ -109,20 +110,20 @@ On Linux the
capability is required. capability is required.
.TP .TP
.B EROFS .B EROFS
.I filename .I filename
refers to a file on a read-only file system. refers to a file on a read-only file system.
.TP .TP
.B EUSERS .B EUSERS
There are no more free file structures or we ran out of memory. There are no more free file structures or we ran out of memory.
.SH "CONFORMING TO" .SH "CONFORMING TO"
SVr4, 4.3BSD (but not POSIX). SVr4, 4.3BSD (but not POSIX).
.\" SVr4 documents an EBUSY error condition, but no EISDIR or ENOSYS. .\" SVr4 documents an EBUSY error condition, but no EISDIR or ENOSYS.
.\" Also AIX and HP-UX document EBUSY (attempt is made .\" Also AIX and HP-UX document EBUSY (attempt is made
.\" to enable accounting when it is already enabled), as does Solaris .\" to enable accounting when it is already enabled), as does Solaris
.\" (attempt is made to enable accounting using the same file that is .\" (attempt is made to enable accounting using the same file that is
.\" currently being used). .\" currently being used).
.SH NOTES .SH NOTES
No accounting is produced for programs running when a crash occurs. In No accounting is produced for programs running when a crash occurs.
particular, nonterminating processes are never accounted for. In particular, nonterminating processes are never accounted for.
.SH "SEE ALSO" .SH "SEE ALSO"
.BR acct (5). .BR acct (5).

View File

@ -39,7 +39,7 @@ The system call
.BR adjtimex () .BR adjtimex ()
reads and optionally sets adjustment parameters for this algorithm. reads and optionally sets adjustment parameters for this algorithm.
It takes a pointer to a It takes a pointer to a
.I timex .I timex
structure, updates kernel parameters from field values, structure, updates kernel parameters from field values,
and returns the same structure with current kernel values. and returns the same structure with current kernel values.
This structure is declared as follows: This structure is declared as follows:
@ -123,9 +123,9 @@ or to set
to a value other than those listed above, to a value other than those listed above,
or to set or to set
.I buf.tick .I buf.tick
to a value outside the range to a value outside the range
.RB 900000/ HZ .RB 900000/ HZ
to to
.RB 1100000/ HZ , .RB 1100000/ HZ ,
where where
.B HZ .B HZ
@ -142,7 +142,7 @@ capability is required.
intended to be portable. intended to be portable.
See See
.BR adjtime (3) .BR adjtime (3)
for a more portable, but less flexible, for a more portable, but less flexible,
method of adjusting the system clock. method of adjusting the system clock.
.SH "SEE ALSO" .SH "SEE ALSO"
.BR settimeofday (2), .BR settimeofday (2),

View File

@ -11,7 +11,7 @@
.\" manual under the conditions for verbatim copying, provided that the .\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a .\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one. .\" permission notice identical to this one.
.\" .\"
.\" Since the Linux kernel and libraries are constantly changing, this .\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no .\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" responsibility for errors or omissions, or for damages resulting from .\" responsibility for errors or omissions, or for damages resulting from
@ -19,7 +19,7 @@
.\" have taken the same level of care in the production of this manual, .\" have taken the same level of care in the production of this manual,
.\" which is licensed free of charge, as they might when working .\" which is licensed free of charge, as they might when working
.\" professionally. .\" professionally.
.\" .\"
.\" Formatted or processed versions of this manual, if unaccompanied by .\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work. .\" the source, must acknowledge the copyright and authors of this work.
.\" .\"
@ -37,8 +37,8 @@ alarm \- set an alarm clock for delivery of a signal
.BI "unsigned int alarm(unsigned int " seconds ); .BI "unsigned int alarm(unsigned int " seconds );
.fi .fi
.SH DESCRIPTION .SH DESCRIPTION
.BR alarm () .BR alarm ()
arranges for a arranges for a
.B SIGALRM .B SIGALRM
signal to be delivered to the process in signal to be delivered to the process in
.I seconds .I seconds
@ -60,7 +60,7 @@ alarm was due to be delivered, or zero if there was no previously
scheduled alarm. scheduled alarm.
.SH NOTES .SH NOTES
.BR alarm () .BR alarm ()
and and
.BR setitimer () .BR setitimer ()
share the same timer; calls to one will interfere with use of the share the same timer; calls to one will interfere with use of the
other. other.

View File

@ -10,7 +10,7 @@
.\" manual under the conditions for verbatim copying, provided that the .\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a .\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one. .\" permission notice identical to this one.
.\" .\"
.\" Since the Linux kernel and libraries are constantly changing, this .\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no .\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" responsibility for errors or omissions, or for damages resulting from .\" responsibility for errors or omissions, or for damages resulting from
@ -18,7 +18,7 @@
.\" have taken the same level of care in the production of this manual, .\" have taken the same level of care in the production of this manual,
.\" which is licensed free of charge, as they might when working .\" which is licensed free of charge, as they might when working
.\" professionally. .\" professionally.
.\" .\"
.\" Formatted or processed versions of this manual, if unaccompanied by .\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work. .\" the source, must acknowledge the copyright and authors of this work.
.\" .\"
@ -27,7 +27,7 @@
alloc_hugepages, free_hugepages \- allocate or free huge pages alloc_hugepages, free_hugepages \- allocate or free huge pages
.SH SYNOPSIS .SH SYNOPSIS
.nf .nf
.BI "void *alloc_hugepages(int " key ", void *" addr ", size_t " len , .BI "void *alloc_hugepages(int " key ", void *" addr ", size_t " len ,
.BI " int " prot ", int " flag ); .BI " int " prot ", int " flag );
.\" asmlinkage unsigned long sys_alloc_hugepages(int key, unsigned long addr, .\" asmlinkage unsigned long sys_alloc_hugepages(int key, unsigned long addr,
.\" unsigned long len, int prot, int flag); .\" unsigned long len, int prot, int flag);
@ -45,14 +45,17 @@ They existed only on i386 and ia64 (when built with CONFIG_HUGETLB_PAGE).
In Linux 2.4.20 the syscall numbers exist, but the calls return ENOSYS. In Linux 2.4.20 the syscall numbers exist, but the calls return ENOSYS.
.LP .LP
On i386 the memory management hardware knows about ordinary pages (4 KiB) On i386 the memory management hardware knows about ordinary pages (4 KiB)
and huge pages (2 or 4 MiB). Similarly ia64 knows about huge pages of and huge pages (2 or 4 MiB).
several sizes. These system calls serve to map huge pages into the Similarly ia64 knows about huge pages of
several sizes.
These system calls serve to map huge pages into the
process' memory or to free them again. process' memory or to free them again.
Huge pages are locked into memory, and are not swapped. Huge pages are locked into memory, and are not swapped.
.LP .LP
The The
.I key .I key
parameter is an identifier. When zero the pages are private, and parameter is an identifier.
When zero the pages are private, and
not inherited by children. not inherited by children.
When positive the pages are shared with other applications using the same When positive the pages are shared with other applications using the same
.IR key , .IR key ,
@ -75,8 +78,8 @@ Addresses must be properly aligned.
.LP .LP
The The
.I len .I len
parameter is the length of the required segment. It must be parameter is the length of the required segment.
a multiple of the huge page size. It must be a multiple of the huge page size.
.LP .LP
The The
.I prot .I prot
@ -87,18 +90,21 @@ The
.I flag .I flag
parameter is ignored, unless parameter is ignored, unless
.I key .I key
is positive. In that case, if is positive.
In that case, if
.I flag .I flag
is IPC_CREAT, then a new huge page segment is created when none is IPC_CREAT, then a new huge page segment is created when none
with the given key existed. If this flag is not set, then ENOENT with the given key existed.
If this flag is not set, then ENOENT
is returned when no segment with the given key exists. is returned when no segment with the given key exists.
.IR .IR
.SH "RETURN VALUE" .SH "RETURN VALUE"
On success, On success,
.BR alloc_hugepages () .BR alloc_hugepages ()
returns the allocated virtual address, and returns the allocated virtual address, and
.BR free_hugepages () .BR free_hugepages ()
returns zero. On error, \-1 is returned, and returns zero.
On error, \-1 is returned, and
.I errno .I errno
is set appropriately. is set appropriately.
.SH ERRORS .SH ERRORS
@ -108,7 +114,8 @@ The system call is not supported on this kernel.
.SH "CONFORMING TO" .SH "CONFORMING TO"
These calls existed only in Linux 2.5.36 through to 2.5.54. These calls existed only in Linux 2.5.36 through to 2.5.54.
These calls are specific to Linux on Intel processors, and should not be These calls are specific to Linux on Intel processors, and should not be
used in programs intended to be portable. Indeed, the system call numbers used in programs intended to be portable.
Indeed, the system call numbers
are marked for reuse, so programs using these may do something random are marked for reuse, so programs using these may do something random
on a future kernel. on a future kernel.
.SH FILES .SH FILES
@ -120,7 +127,8 @@ This can be read and written.
Gives info on the number of configured hugetlb pages and on their size Gives info on the number of configured hugetlb pages and on their size
in the three variables HugePages_Total, HugePages_Free, Hugepagesize. in the three variables HugePages_Total, HugePages_Free, Hugepagesize.
.SH NOTES .SH NOTES
The system calls are gone. Now the hugetlbfs filesystem can be used instead. The system calls are gone.
Now the hugetlbfs filesystem can be used instead.
Memory backed by huge pages (if the CPU supports them) is obtained by Memory backed by huge pages (if the CPU supports them) is obtained by
using using
.BR mmap () .BR mmap ()

View File

@ -10,7 +10,7 @@
.\" manual under the conditions for verbatim copying, provided that the .\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a .\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one. .\" permission notice identical to this one.
.\" .\"
.\" Since the Linux kernel and libraries are constantly changing, this .\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no .\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" responsibility for errors or omissions, or for damages resulting from .\" responsibility for errors or omissions, or for damages resulting from
@ -18,7 +18,7 @@
.\" have taken the same level of care in the production of this manual, .\" have taken the same level of care in the production of this manual,
.\" which is licensed free of charge, as they might when working .\" which is licensed free of charge, as they might when working
.\" professionally. .\" professionally.
.\" .\"
.\" Formatted or processed versions of this manual, if unaccompanied by .\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work. .\" the source, must acknowledge the copyright and authors of this work.
.TH ARCH_PRCTL 2 2003-02-02 "Linux 2.4.20" "Linux Programmer's Manual" .TH ARCH_PRCTL 2 2003-02-02 "Linux 2.4.20" "Linux Programmer's Manual"
@ -36,13 +36,13 @@ function sets architecture specific process or thread state.
.I code .I code
selects a subfunction selects a subfunction
and passes argument and passes argument
.I addr .I addr
to it. to it.
.LP .LP
Sub functions for x86-64 are: Sub functions for x86-64 are:
.TP .TP
.B ARCH_SET_FS .B ARCH_SET_FS
Set the 64bit base for the Set the 64bit base for the
.I FS .I FS
register to register to
.IR addr . .IR addr .
@ -50,14 +50,14 @@ register to
.B ARCH_GET_FS .B ARCH_GET_FS
Return the 64bit base value for the Return the 64bit base value for the
.I FS .I FS
register of the current thread in the register of the current thread in the
.I unsigned long .I unsigned long
pointed to by the pointed to by the
.I address .I address
parameter parameter
.TP .TP
.B ARCH_SET_GS .B ARCH_SET_GS
Set the 64bit base for the Set the 64bit base for the
.I GS .I GS
register to register to
.IR addr . .IR addr .
@ -65,10 +65,10 @@ register to
.B ARCH_GET_GS .B ARCH_GET_GS
Return the 64bit base value for the Return the 64bit base value for the
.I GS .I GS
register of the current thread in the register of the current thread in the
.I unsigned long .I unsigned long
pointed to by the pointed to by the
.I address .I address
parameter. parameter.
.SH NOTES .SH NOTES
.BR arch_prctl () .BR arch_prctl ()
@ -79,13 +79,14 @@ The 64bit base changes when a new 32bit segment selector is loaded.
.B ARCH_SET_GS .B ARCH_SET_GS
is disabled in some kernels. is disabled in some kernels.
Context switches for 64bit segment bases are rather expensive. It may be a Context switches for 64bit segment bases are rather expensive.
It may be a
faster alternative to set a 32bit base using a segment selector by setting up faster alternative to set a 32bit base using a segment selector by setting up
an LDT with an LDT with
.BR modify_ldt (2) .BR modify_ldt (2)
or using the or using the
.BR set_thread_area (2) .BR set_thread_area (2)
system call in a 2.5 kernel. system call in a 2.5 kernel.
.BR arch_prctl () .BR arch_prctl ()
is only needed when you want to set bases that are larger than 4GB. is only needed when you want to set bases that are larger than 4GB.
Memory in the first 2GB of address space can be allocated by using Memory in the first 2GB of address space can be allocated by using
@ -99,16 +100,16 @@ As of version 2.3.5, glibc provides no prototype for
You have to declare it yourself for now. You have to declare it yourself for now.
This may be fixed in future glibc versions. This may be fixed in future glibc versions.
.I FS .I FS
may be already used by the threading library. may be already used by the threading library.
.SH ERRORS .SH ERRORS
.TP .TP
.B EFAULT .B EFAULT
.I addr .I addr
points to an unmapped address or is outside the process address space. points to an unmapped address or is outside the process address space.
.TP .TP
.B EINVAL .B EINVAL
.I code .I code
is not a valid subcommand. is not a valid subcommand.
.TP .TP
.B EPERM .B EPERM
@ -118,7 +119,7 @@ is outside the process address space.
Man page written by Andi Kleen. Man page written by Andi Kleen.
.SH "CONFORMING TO" .SH "CONFORMING TO"
.BR arch_prctl () .BR arch_prctl ()
is a Linux/x86-64 extension and should not be used in programs intended is a Linux/x86-64 extension and should not be used in programs intended
to be portable. to be portable.
.SH "SEE ALSO" .SH "SEE ALSO"
.BR mmap (2), .BR mmap (2),

View File

@ -12,7 +12,7 @@
.\" manual under the conditions for verbatim copying, provided that the .\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a .\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one. .\" permission notice identical to this one.
.\" .\"
.\" Since the Linux kernel and libraries are constantly changing, this .\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no .\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" responsibility for errors or omissions, or for damages resulting from .\" responsibility for errors or omissions, or for damages resulting from
@ -20,7 +20,7 @@
.\" have taken the same level of care in the production of this manual, .\" have taken the same level of care in the production of this manual,
.\" which is licensed free of charge, as they might when working .\" which is licensed free of charge, as they might when working
.\" professionally. .\" professionally.
.\" .\"
.\" Formatted or processed versions of this manual, if unaccompanied by .\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work. .\" the source, must acknowledge the copyright and authors of this work.
.\" .\"
@ -96,8 +96,9 @@ before a
socket may receive connections (see socket may receive connections (see
.BR accept (2)). .BR accept (2)).
The rules used in name binding vary between address families. Consult The rules used in name binding vary between address families.
the manual entries in Section 7 for detailed information. For Consult the manual entries in Section 7 for detailed information.
For
.B AF_INET .B AF_INET
see see
.BR ip (7), .BR ip (7),
@ -127,7 +128,7 @@ see
.BR netlink (7). .BR netlink (7).
The actual structure passed for the The actual structure passed for the
.I my_addr .I my_addr
argument will depend on the address family. argument will depend on the address family.
The The
.I sockaddr .I sockaddr
@ -142,12 +143,12 @@ struct sockaddr {
.fi .fi
.in -0.25in .in -0.25in
The only purpose of this structure is to cast the structure The only purpose of this structure is to cast the structure
pointer passed in pointer passed in
.I my_addr .I my_addr
in order to avoid compiler warnings. in order to avoid compiler warnings.
The following example shows how this is done when binding a socket The following example shows how this is done when binding a socket
in the Unix in the Unix
.RB ( AF_UNIX ) .RB ( AF_UNIX )
domain: domain:
@ -166,30 +167,31 @@ main(int argc, char *argv[])
{ {
int sfd; int sfd;
struct sockaddr_un addr; struct sockaddr_un addr;
sfd = socket(AF_UNIX, SOCK_STREAM, 0); sfd = socket(AF_UNIX, SOCK_STREAM, 0);
if (sfd == -1) { if (sfd == -1) {
perror("socket"); perror("socket");
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
memset(&addr, 0, sizeof(struct sockaddr_un)); memset(&addr, 0, sizeof(struct sockaddr_un));
/* Clear structure */ /* Clear structure */
addr.sun_family = AF_UNIX; addr.sun_family = AF_UNIX;
strncpy(addr.sun_path, MY_SOCK_PATH, strncpy(addr.sun_path, MY_SOCK_PATH,
sizeof(addr.sun_path) - 1); sizeof(addr.sun_path) - 1);
if (bind(sfd, (struct sockaddr *) &addr, if (bind(sfd, (struct sockaddr *) &addr,
sizeof(struct sockaddr_un)) == -1) { sizeof(struct sockaddr_un)) == -1) {
perror("bind"); perror("bind");
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
... ...
} }
.fi .fi
.in -0.25in .in -0.25in
.SH "RETURN VALUE" .SH "RETURN VALUE"
On success, zero is returned. On error, \-1 is returned, and On success, zero is returned.
On error, \-1 is returned, and
.I errno .I errno
is set appropriately. is set appropriately.
.SH ERRORS .SH ERRORS
@ -213,8 +215,8 @@ The socket is already bound to an address.
.I sockfd .I sockfd
is a descriptor for a file, not a socket. is a descriptor for a file, not a socket.
.PP .PP
The following errors are specific to UNIX domain The following errors are specific to UNIX domain
.RB ( AF_UNIX ) .RB ( AF_UNIX )
sockets: sockets:
.TP .TP
.B EACCES .B EACCES
@ -223,7 +225,7 @@ Search permission is denied on a component of the path prefix.
.BR path_resolution (2).) .BR path_resolution (2).)
.TP .TP
.B EADDRNOTAVAIL .B EADDRNOTAVAIL
A non-existent interface was requested or the requested A non-existent interface was requested or the requested
address was not local. address was not local.
.TP .TP
.B EFAULT .B EFAULT
@ -261,11 +263,11 @@ The transparent proxy options are not described.
.SH "CONFORMING TO" .SH "CONFORMING TO"
SVr4, 4.4BSD, POSIX.1-2001 (the SVr4, 4.4BSD, POSIX.1-2001 (the
.BR bind () .BR bind ()
function first appeared in 4.2BSD). function first appeared in 4.2BSD).
.\" SVr4 documents an additional .\" SVr4 documents an additional
.\" .B ENOSR .\" .B ENOSR
.\" general error condition, and .\" general error condition, and
.\" additional .\" additional
.\" .B EIO .\" .B EIO
.\" and .\" and
.\" .B EISDIR .\" .B EISDIR
@ -276,7 +278,7 @@ The third argument of
is in reality an is in reality an
.I int .I int
(and this is what 4.x BSD and libc4 and libc5 have). (and this is what 4.x BSD and libc4 and libc5 have).
Some POSIX confusion resulted in the present Some POSIX confusion resulted in the present
.IR socklen_t , .IR socklen_t ,
also used by glibc. also used by glibc.
See also See also

View File

@ -66,7 +66,7 @@ is set to
On success, On success,
.BR sbrk () .BR sbrk ()
returns a pointer to the start of the new area. returns a pointer to the start of the new area.
On error, \-1 is returned, and On error, \-1 is returned, and
.I errno .I errno
is set to is set to
@ -75,7 +75,7 @@ is set to
4.3BSD; SUSv1, marked LEGACY in SUSv2, removed in POSIX.1-2001. 4.3BSD; SUSv1, marked LEGACY in SUSv2, removed in POSIX.1-2001.
.BR brk () .BR brk ()
and and
.BR sbrk () .BR sbrk ()
are not defined in the C Standard and are deliberately excluded from the are not defined in the C Standard and are deliberately excluded from the
POSIX.1 standard (see paragraphs B.1.1.1.3 and B.8.3.3). POSIX.1 standard (see paragraphs B.1.1.1.3 and B.8.3.3).
@ -94,24 +94,24 @@ The return value described above for
.BR brk () .BR brk ()
is the behaviour provided by the glibc wrapper function for the Linux is the behaviour provided by the glibc wrapper function for the Linux
.BR brk () .BR brk ()
system call. system call.
(On most other implementations, the return value from (On most other implementations, the return value from
.BR brk () .BR brk ()
is the same.) is the same.)
However, However,
the actual Linux system call returns the new program break on success. the actual Linux system call returns the new program break on success.
On failure, the system call returns the current break On failure, the system call returns the current break
(thus for example, the call (thus for example, the call
.I brk(0) .I brk(0)
can be used to obtain the current break). can be used to obtain the current break).
The glibc wrapper function does some work to provide the 0 The glibc wrapper function does some work to provide the 0
and \-1 return values described above. and \-1 return values described above.
On Linux, On Linux,
.BR sbrk () .BR sbrk ()
is implemented as a library function that uses the is implemented as a library function that uses the
.BR brk () .BR brk ()
system call, and does some internal bookkeeping so that it can system call, and does some internal bookkeeping so that it can
return the old break value. return the old break value.
.SH "SEE ALSO" .SH "SEE ALSO"
.BR execve (2), .BR execve (2),

View File

@ -33,7 +33,8 @@ cacheflush \- flush contents of instruction and/or data cache
.SH DESCRIPTION .SH DESCRIPTION
.BR cacheflush () .BR cacheflush ()
flushes contents of indicated cache(s) for user addresses in the range flushes contents of indicated cache(s) for user addresses in the range
addr to (addr+nbytes-1). Cache may be one of: addr to (addr+nbytes-1).
Cache may be one of:
.TP .TP
.B ICACHE .B ICACHE
Flush the instruction cache. Flush the instruction cache.
@ -42,12 +43,14 @@ Flush the instruction cache.
Write back to memory and invalidate the affected valid cache lines. Write back to memory and invalidate the affected valid cache lines.
.TP .TP
.B BCACHE .B BCACHE
Same as Same as
.BR (ICACHE|DCACHE) . .BR (ICACHE|DCACHE) .
.SH "RETURN VALUE" .SH "RETURN VALUE"
.BR cacheflush () .BR cacheflush ()
returns 0 on success or \-1 on error. If errors are detected, returns 0 on success or \-1 on error.
errno will indicate the error. If errors are detected,
.I errno
will indicate the error.
.SH ERRORS .SH ERRORS
.TP .TP
.B EFAULT .B EFAULT
@ -56,12 +59,12 @@ Some or all of the address range addr to (addr+nbytes-1) is not accessible.
.B EINVAL .B EINVAL
cache parameter is not one of ICACHE, DCACHE, or BCACHE. cache parameter is not one of ICACHE, DCACHE, or BCACHE.
.SH BUGS .SH BUGS
The current implementation ignores the The current implementation ignores the
.I addr .I addr
and and
.I nbytes .I nbytes
arguments. arguments.
Therefore, the whole cache is always flushed. Therefore, the whole cache is always flushed.
.SH NOTE .SH NOTE
This system call is only available on MIPS based systems. It should This system call is only available on MIPS based systems.
not be used in programs intended to be portable. It should not be used in programs intended to be portable.

View File

@ -29,7 +29,8 @@ call, and a set of permitted capabilities
that it can make effective or inheritable. that it can make effective or inheritable.
.PP .PP
These two functions are the raw kernel interface for getting and These two functions are the raw kernel interface for getting and
setting capabilities. Not only are these system calls specific to Linux, setting capabilities.
Not only are these system calls specific to Linux,
but the kernel API is likely to change and use of but the kernel API is likely to change and use of
these functions (in particular the format of the these functions (in particular the format of the
.B cap_user_*_t .B cap_user_*_t
@ -43,7 +44,7 @@ if possible you should use those interfaces in applications.
If you wish to use the Linux extensions in applications, you should If you wish to use the Linux extensions in applications, you should
use the easier-to-use interfaces use the easier-to-use interfaces
.BR capsetp (3) .BR capsetp (3)
and and
.BR capgetp (3). .BR capgetp (3).
.SS "Current details" .SS "Current details"
Now that you have been warned, some current kernel details. Now that you have been warned, some current kernel details.
@ -66,46 +67,48 @@ typedef struct __user_cap_data_struct {
.fi .fi
.in -4n .in -4n
.sp .sp
The calls will return EINVAL, and set the The calls will return EINVAL, and set the
.I version .I version
field of field of
.I hdr .I hdr
to _LINUX_CAPABILITY_VERSION when another version was specified. to _LINUX_CAPABILITY_VERSION when another version was specified.
The calls operate on the capabilities of the thread specified by the The calls operate on the capabilities of the thread specified by the
.I pid .I pid
field of field of
.I hdr .I hdr
when that is non-zero, or on the capabilities of the calling thread if when that is non-zero, or on the capabilities of the calling thread if
.I pid .I pid
is 0. is 0.
If If
.I pid .I pid
refers to a single-threaded process, then refers to a single-threaded process, then
.I pid .I pid
can be specified as a traditional process ID; can be specified as a traditional process ID;
operating on a thread of a multithreaded process requires a thread ID operating on a thread of a multithreaded process requires a thread ID
of the type returned by of the type returned by
.BR gettid (2). .BR gettid (2).
For For
.BR capset (), .BR capset (),
.I pid .I pid
can also be: \-1, meaning perform the change on all threads except the can also be: \-1, meaning perform the change on all threads except the
caller and caller and
.IR init (8); .IR init (8);
or a value less than \-1, in which case the change is applied or a value less than \-1, in which case the change is applied
to all members of the process group whose ID is \-\fIpid\fP. to all members of the process group whose ID is \-\fIpid\fP.
For details on the data, see For details on the data, see
.BR capabilities (7). .BR capabilities (7).
.SH "RETURN VALUE" .SH "RETURN VALUE"
On success, zero is returned. On error, \-1 is returned, and On success, zero is returned.
On error, \-1 is returned, and
.I errno .I errno
is set appropriately. is set appropriately.
.SH ERRORS .SH ERRORS
.TP .TP
.B EFAULT .B EFAULT
Bad memory address. Neither of Bad memory address.
Neither of
.I hdrp .I hdrp
and and
.I datap .I datap
@ -126,12 +129,12 @@ to modify the capabilities of a thread other than itself,
but lacked sufficient privilege; the but lacked sufficient privilege; the
.B CAP_SETPCAP .B CAP_SETPCAP
capability is required. capability is required.
(A bug in kernels before 2.6.11 meant that this error could also (A bug in kernels before 2.6.11 meant that this error could also
occur if a thread without this capability tried to change its occur if a thread without this capability tried to change its
own capabilities by specifying the own capabilities by specifying the
.I pid .I pid
field as a non-zero value (i.e., the value returned by field as a non-zero value (i.e., the value returned by
.BR getpid (2)) .BR getpid (2))
instead of 0.) instead of 0.)
.TP .TP
.B ESRCH .B ESRCH
@ -147,5 +150,5 @@ library and is available from here:
.B ftp://ftp.kernel.org/pub/linux/libs/security/linux-privs .B ftp://ftp.kernel.org/pub/linux/libs/security/linux-privs
.SH "SEE ALSO" .SH "SEE ALSO"
.BR clone (2), .BR clone (2),
.BR gettid (2), .BR gettid (2),
.BR capabilities (7) .BR capabilities (7)

View File

@ -10,7 +10,7 @@
.\" manual under the conditions for verbatim copying, provided that the .\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a .\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one. .\" permission notice identical to this one.
.\" .\"
.\" Since the Linux kernel and libraries are constantly changing, this .\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no .\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" responsibility for errors or omissions, or for damages resulting from .\" responsibility for errors or omissions, or for damages resulting from
@ -18,7 +18,7 @@
.\" have taken the same level of care in the production of this manual, .\" have taken the same level of care in the production of this manual,
.\" which is licensed free of charge, as they might when working .\" which is licensed free of charge, as they might when working
.\" professionally. .\" professionally.
.\" .\"
.\" Formatted or processed versions of this manual, if unaccompanied by .\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work. .\" the source, must acknowledge the copyright and authors of this work.
.\" .\"
@ -50,17 +50,19 @@ is identical to
the only difference is that the directory is given as an the only difference is that the directory is given as an
open file descriptor. open file descriptor.
.SH "RETURN VALUE" .SH "RETURN VALUE"
On success, zero is returned. On error, \-1 is returned, and On success, zero is returned.
On error, \-1 is returned, and
.I errno .I errno
is set appropriately. is set appropriately.
.SH ERRORS .SH ERRORS
Depending on the file system, other errors can be returned. The more Depending on the file system, other errors can be returned.
The more
general errors for general errors for
.BR chdir () .BR chdir ()
are listed below: are listed below:
.TP .TP
.B EACCES .B EACCES
Search permission is denied for one of the directories Search permission is denied for one of the directories
in the path prefix of in the path prefix of
.IR path . .IR path .
(See also (See also
@ -113,7 +115,7 @@ The current working directory is left unchanged by
The prototype for The prototype for
.BR fchdir () .BR fchdir ()
is only available if is only available if
.B _BSD_SOURCE .B _BSD_SOURCE
is defined, or is defined, or
.B _XOPEN_SOURCE .B _XOPEN_SOURCE
is defined with the value 500. is defined with the value 500.

View File

@ -10,7 +10,7 @@
.\" manual under the conditions for verbatim copying, provided that the .\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a .\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one. .\" permission notice identical to this one.
.\" .\"
.\" Since the Linux kernel and libraries are constantly changing, this .\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no .\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" responsibility for errors or omissions, or for damages resulting from .\" responsibility for errors or omissions, or for damages resulting from
@ -18,7 +18,7 @@
.\" have taken the same level of care in the production of this manual, .\" have taken the same level of care in the production of this manual,
.\" which is licensed free of charge, as they might when working .\" which is licensed free of charge, as they might when working
.\" professionally. .\" professionally.
.\" .\"
.\" Formatted or processed versions of this manual, if unaccompanied by .\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work. .\" the source, must acknowledge the copyright and authors of this work.
.\" .\"
@ -114,15 +114,17 @@ directories, see
On NFS file systems, restricting the permissions will immediately influence On NFS file systems, restricting the permissions will immediately influence
already open files, because the access control is done on the server, but already open files, because the access control is done on the server, but
open files are maintained by the client. Widening the permissions may be open files are maintained by the client.
Widening the permissions may be
delayed for other clients if attribute caching is enabled on them. delayed for other clients if attribute caching is enabled on them.
.SH "RETURN VALUE" .SH "RETURN VALUE"
On success, zero is returned. On error, \-1 is returned, and On success, zero is returned.
On error, \-1 is returned, and
.I errno .I errno
is set appropriately. is set appropriately.
.SH ERRORS .SH ERRORS
Depending on the file system, other errors can be returned. The more Depending on the file system, other errors can be returned.
general errors for The more general errors for
.BR chmod () .BR chmod ()
are listed below: are listed below:
.TP .TP

View File

@ -11,7 +11,7 @@
.\" manual under the conditions for verbatim copying, provided that the .\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a .\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one. .\" permission notice identical to this one.
.\" .\"
.\" Since the Linux kernel and libraries are constantly changing, this .\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no .\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" responsibility for errors or omissions, or for damages resulting from .\" responsibility for errors or omissions, or for damages resulting from
@ -19,7 +19,7 @@
.\" have taken the same level of care in the production of this manual, .\" have taken the same level of care in the production of this manual,
.\" which is licensed free of charge, as they might when working .\" which is licensed free of charge, as they might when working
.\" professionally. .\" professionally.
.\" .\"
.\" Formatted or processed versions of this manual, if unaccompanied by .\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work. .\" the source, must acknowledge the copyright and authors of this work.
.\" .\"
@ -64,7 +64,8 @@ or
is specified as \-1, then that ID is not changed. is specified as \-1, then that ID is not changed.
When the owner or group of an executable file are changed by a non-superuser, When the owner or group of an executable file are changed by a non-superuser,
the S_ISUID and S_ISGID mode bits are cleared. POSIX does not specify whether the S_ISUID and S_ISGID mode bits are cleared.
POSIX does not specify whether
this also should happen when root does the this also should happen when root does the
.BR chown (); .BR chown ();
the Linux behaviour depends on the kernel version. the Linux behaviour depends on the kernel version.
@ -76,12 +77,13 @@ the S_ISGID bit indicates mandatory locking, and is not cleared
by a by a
.BR chown (). .BR chown ().
.SH "RETURN VALUE" .SH "RETURN VALUE"
On success, zero is returned. On error, \-1 is returned, and On success, zero is returned.
On error, \-1 is returned, and
.I errno .I errno
is set appropriately. is set appropriately.
.SH ERRORS .SH ERRORS
Depending on the file system, other errors can be returned. The more Depending on the file system, other errors can be returned.
general errors for The more general errors for
.BR chown () .BR chown ()
are listed below. are listed below.
.TP .TP
@ -166,13 +168,15 @@ used by the superuser (that is, ordinary users cannot give away files).
.\" SVr4 documents EINVAL, EINTR, ENOLINK and EMULTIHOP returns, but no .\" SVr4 documents EINVAL, EINTR, ENOLINK and EMULTIHOP returns, but no
.\" ENOMEM. POSIX.1 does not document ENOMEM or ELOOP error conditions. .\" ENOMEM. POSIX.1 does not document ENOMEM or ELOOP error conditions.
.\" fchown(): .\" fchown():
.\" SVr4 documents additional EINVAL, EIO, EINTR, and ENOLINK .\" SVr4 documents additional EINVAL, EIO, EINTR, and ENOLINK
.\" error conditions. .\" error conditions.
.SH RESTRICTIONS .SH RESTRICTIONS
The \fBchown\fP() semantics are deliberately violated on NFS file systems The \fBchown\fP() semantics are deliberately violated on NFS file systems
which have UID mapping enabled. Additionally, the semantics of all system which have UID mapping enabled.
Additionally, the semantics of all system
calls which access the file contents are violated, because \fBchown\fP() calls which access the file contents are violated, because \fBchown\fP()
may cause immediate access revocation on already open files. Client side may cause immediate access revocation on already open files.
Client side
caching may lead to a delay between the time where ownership have caching may lead to a delay between the time where ownership have
been changed to allow access for a user and the time where the file can been changed to allow access for a user and the time where the file can
actually be accessed by the user on other clients. actually be accessed by the user on other clients.

View File

@ -10,7 +10,7 @@
.\" manual under the conditions for verbatim copying, provided that the .\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a .\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one. .\" permission notice identical to this one.
.\" .\"
.\" Since the Linux kernel and libraries are constantly changing, this .\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no .\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" responsibility for errors or omissions, or for damages resulting from .\" responsibility for errors or omissions, or for damages resulting from
@ -18,7 +18,7 @@
.\" have taken the same level of care in the production of this manual, .\" have taken the same level of care in the production of this manual,
.\" which is licensed free of charge, as they might when working .\" which is licensed free of charge, as they might when working
.\" professionally. .\" professionally.
.\" .\"
.\" Formatted or processed versions of this manual, if unaccompanied by .\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work. .\" the source, must acknowledge the copyright and authors of this work.
.\" .\"
@ -41,8 +41,8 @@ chroot \- change root directory
.BR chroot () .BR chroot ()
changes the root directory to that specified in changes the root directory to that specified in
.IR path . .IR path .
This directory will be used for pathnames beginning with /. The root This directory will be used for pathnames beginning with /.
directory is inherited by all children of the current process. The root directory is inherited by all children of the current process.
Only a privileged process (Linux: one with the Only a privileged process (Linux: one with the
.B CAP_SYS_CHROOT .B CAP_SYS_CHROOT
@ -60,12 +60,13 @@ by doing `mkdir foo; chroot foo; cd ..'.
This call does not close open file descriptors, and such file This call does not close open file descriptors, and such file
descriptors may allow access to files outside the chroot tree. descriptors may allow access to files outside the chroot tree.
.SH "RETURN VALUE" .SH "RETURN VALUE"
On success, zero is returned. On error, \-1 is returned, and On success, zero is returned.
On error, \-1 is returned, and
.I errno .I errno
is set appropriately. is set appropriately.
.SH ERRORS .SH ERRORS
Depending on the file system, other errors can be returned. The more Depending on the file system, other errors can be returned.
general errors are listed below: The more general errors are listed below:
.TP .TP
.B EACCES .B EACCES
Search permission is denied on a component of the path prefix. Search permission is denied on a component of the path prefix.
@ -103,7 +104,7 @@ is not a directory.
.B EPERM .B EPERM
The caller has insufficient privilege. The caller has insufficient privilege.
.SH "CONFORMING TO" .SH "CONFORMING TO"
SVr4, 4.4BSD, SUSv2 (marked LEGACY). SVr4, 4.4BSD, SUSv2 (marked LEGACY).
This function is not part of POSIX.1-2001. This function is not part of POSIX.1-2001.
.\" SVr4 documents additional EINTR, ENOLINK and EMULTIHOP error conditions. .\" SVr4 documents additional EINTR, ENOLINK and EMULTIHOP error conditions.
.\" X/OPEN does not document EIO, ENOMEM or EFAULT error conditions. .\" X/OPEN does not document EIO, ENOMEM or EFAULT error conditions.
@ -117,7 +118,7 @@ The root directory is left unchanged by
FreeBSD has a stronger FreeBSD has a stronger
.BR jail () .BR jail ()
system call. system call.
.\" FIXME -- eventually say something about containers, .\" FIXME -- eventually say something about containers,
.\" virtual servers, etc.? .\" virtual servers, etc.?
.SH "SEE ALSO" .SH "SEE ALSO"
.BR chdir (2), .BR chdir (2),

View File

@ -13,7 +13,7 @@
.\" Mostly upgraded to 2.4.x .\" Mostly upgraded to 2.4.x
.\" Added prototype for sys_clone() plus description .\" Added prototype for sys_clone() plus description
.\" Added CLONE_THREAD with a brief description of thread groups .\" Added CLONE_THREAD with a brief description of thread groups
.\" Added CLONE_PARENT and revised entire page remove ambiguity .\" Added CLONE_PARENT and revised entire page remove ambiguity
.\" between "calling process" and "parent process" .\" between "calling process" and "parent process"
.\" Added CLONE_PTRACE and CLONE_VFORK .\" Added CLONE_PTRACE and CLONE_VFORK
.\" Added EPERM and EINVAL error codes .\" Added EPERM and EINVAL error codes
@ -57,7 +57,7 @@ creates a new process, in a manner similar to
.BR fork (2). .BR fork (2).
.BR clone () .BR clone ()
is a library function layered on top is a library function layered on top
of the underlying of the underlying
.BR clone () .BR clone ()
system call, hereinafter referred to as system call, hereinafter referred to as
.BR sys_clone . .BR sys_clone .
@ -67,13 +67,14 @@ is given towards the end of this page.
Unlike Unlike
.BR fork (2), .BR fork (2),
these calls these calls
allow the child process to share parts of its execution context with allow the child process to share parts of its execution context with
the calling process, such as the memory space, the table of file the calling process, such as the memory space, the table of file
descriptors, and the table of signal handlers. (Note that on this manual descriptors, and the table of signal handlers.
page, "calling process" normally corresponds to "parent process". But see (Note that on this manual
the description of page, "calling process" normally corresponds to "parent process".
.B CLONE_PARENT But see the description of
.B CLONE_PARENT
below.) below.)
The main use of The main use of
@ -82,15 +83,15 @@ is to implement threads: multiple threads of control in a program that
run concurrently in a shared memory space. run concurrently in a shared memory space.
When the child process is created with When the child process is created with
.BR clone (), .BR clone (),
it executes the function it executes the function
application application
.IR fn ( arg ). .IR fn ( arg ).
(This differs from (This differs from
.BR fork (2), .BR fork (2),
where execution continues in the child from the point where execution continues in the child from the point
of the of the
.BR fork (2) .BR fork (2)
call.) call.)
The The
.I fn .I fn
@ -102,22 +103,23 @@ argument is passed to the
.I fn .I fn
function. function.
When the When the
.IR fn ( arg ) .IR fn ( arg )
function application returns, the child process terminates. The function application returns, the child process terminates.
integer returned by The integer returned by
.I fn .I fn
is the exit code for the child process. The child process may also is the exit code for the child process.
terminate explicitly by calling The child process may also terminate explicitly by calling
.BR exit (2) .BR exit (2)
or after receiving a fatal signal. or after receiving a fatal signal.
The The
.I child_stack .I child_stack
argument specifies the location of the stack used by the child argument specifies the location of the stack used by the child process.
process. Since the child and calling process may share memory, Since the child and calling process may share memory,
it is not possible for the child process to execute in the it is not possible for the child process to execute in the
same stack as the calling process. The calling process must therefore same stack as the calling process.
The calling process must therefore
set up memory space for the child stack and pass a pointer to this set up memory space for the child stack and pass a pointer to this
space to space to
.BR clone (). .BR clone ().
@ -135,11 +137,11 @@ sent to the parent when the child dies.
If this signal is specified as anything other than If this signal is specified as anything other than
.BR SIGCHLD , .BR SIGCHLD ,
then the parent process must specify the then the parent process must specify the
.B __WALL .B __WALL
or or
.B __WCLONE .B __WCLONE
options when waiting for the child with options when waiting for the child with
.BR wait (2). .BR wait (2).
If no signal is specified, then the parent process is not signaled If no signal is specified, then the parent process is not signaled
when the child terminates. when the child terminates.
@ -161,20 +163,22 @@ is not set, then (as with
.BR fork (2)) .BR fork (2))
the child's parent is the calling process. the child's parent is the calling process.
Note that it is the parent process, as returned by Note that it is the parent process, as returned by
.BR getppid (2), .BR getppid (2),
which is signaled when the child terminates, so that which is signaled when the child terminates, so that
if if
.B CLONE_PARENT .B CLONE_PARENT
is set, then the parent of the calling process, rather than the is set, then the parent of the calling process, rather than the
calling process itself, will be signaled. calling process itself, will be signaled.
.TP .TP
.B CLONE_FS .B CLONE_FS
If If
.B CLONE_FS .B CLONE_FS
is set, the caller and the child processes share the same file system is set, the caller and the child processes share the same file system
information. This includes the root of the file system, the current information.
working directory, and the umask. Any call to This includes the root of the file system, the current
working directory, and the umask.
Any call to
.BR chroot (2), .BR chroot (2),
.BR chdir (2), .BR chdir (2),
or or
@ -182,7 +186,7 @@ or
performed by the calling process or the child process also affects the performed by the calling process or the child process also affects the
other process. other process.
If If
.B CLONE_FS .B CLONE_FS
is not set, the child process works on a copy of the file system is not set, the child process works on a copy of the file system
information of the calling process at the time of the information of the calling process at the time of the
@ -199,7 +203,7 @@ If
.B CLONE_FILES .B CLONE_FILES
is set, the calling process and the child processes share the same file is set, the calling process and the child processes share the same file
descriptor table. descriptor table.
Any file descriptor created by the calling process or by the child Any file descriptor created by the calling process or by the child
process is also valid in the other process. process is also valid in the other process.
Similarly, if one of the processes closes a file descriptor, Similarly, if one of the processes closes a file descriptor,
or changes its associated flags (using the or changes its associated flags (using the
@ -213,21 +217,23 @@ is not set, the child process inherits a copy of all file descriptors
opened in the calling process at the time of opened in the calling process at the time of
.BR clone (). .BR clone ().
(The duplicated file descriptors in the child refer to the (The duplicated file descriptors in the child refer to the
same open file descriptions (see same open file descriptions (see
.BR open (2)) .BR open (2))
as the corresponding file descriptors in the calling process.) as the corresponding file descriptors in the calling process.)
Subsequent operations that open or close file descriptors, Subsequent operations that open or close file descriptors,
or change file descriptor flags, or change file descriptor flags,
performed by either the calling performed by either the calling
process or the child process do not affect the other process. process or the child process do not affect the other process.
.TP .TP
.BR CLONE_NEWNS " (since Linux 2.4.19)" .BR CLONE_NEWNS " (since Linux 2.4.19)"
Start the child in a new namespace. Start the child in a new namespace.
Every process lives in a namespace. The Every process lives in a namespace.
The
.I namespace .I namespace
of a process is the data (the set of mounts) describing the file hierarchy of a process is the data (the set of mounts) describing the file hierarchy
as seen by that process. After a as seen by that process.
After a
.BR fork (2) .BR fork (2)
or or
.BR clone (2) .BR clone (2)
@ -265,12 +271,15 @@ call.
If If
.B CLONE_SIGHAND .B CLONE_SIGHAND
is set, the calling process and the child processes share the same table of is set, the calling process and the child processes share the same table of
signal handlers. If the calling process or child process calls signal handlers.
If the calling process or child process calls
.BR sigaction (2) .BR sigaction (2)
to change the behavior associated with a signal, the behavior is to change the behavior associated with a signal, the behavior is
changed in the other process as well. However, the calling process and child changed in the other process as well.
However, the calling process and child
processes still have distinct signal masks and sets of pending processes still have distinct signal masks and sets of pending
signals. So, one of them may block or unblock some signals using signals.
So, one of them may block or unblock some signals using
.BR sigprocmask (2) .BR sigprocmask (2)
without affecting the other process. without affecting the other process.
@ -279,7 +288,8 @@ If
is not set, the child process inherits a copy of the signal handlers is not set, the child process inherits a copy of the signal handlers
of the calling process at the time of the calling process at the time
.BR clone () .BR clone ()
is called. Calls to is called.
Calls to
.BR sigaction (2) .BR sigaction (2)
performed later by one of the processes have no effect on the other performed later by one of the processes have no effect on the other
process. process.
@ -293,14 +303,14 @@ if
is specified is specified
.TP .TP
.B CLONE_PTRACE .B CLONE_PTRACE
If If
.B CLONE_PTRACE .B CLONE_PTRACE
is specified, and the calling process is being traced, is specified, and the calling process is being traced,
then trace the child also (see then trace the child also (see
.BR ptrace (2)). .BR ptrace (2)).
.TP .TP
.BR CLONE_UNTRACED " (since Linux 2.5.46)" .BR CLONE_UNTRACED " (since Linux 2.5.46)"
If If
.B CLONE_UNTRACED .B CLONE_UNTRACED
is specified, then a tracing process cannot force is specified, then a tracing process cannot force
.B CLONE_PTRACE .B CLONE_PTRACE
@ -324,10 +334,10 @@ resources via a call to
.BR execve (2) .BR execve (2)
or or
.BR _exit (2) .BR _exit (2)
(as with (as with
.BR vfork (2)). .BR vfork (2)).
If If
.B CLONE_VFORK .B CLONE_VFORK
is not set then both the calling process and the child are schedulable is not set then both the calling process and the child are schedulable
after the call, and an application should not rely on execution occurring after the call, and an application should not rely on execution occurring
@ -337,7 +347,8 @@ in any particular order.
If If
.B CLONE_VM .B CLONE_VM
is set, the calling process and the child processes run in the same memory is set, the calling process and the child processes run in the same memory
space. In particular, memory writes performed by the calling process space.
In particular, memory writes performed by the calling process
or by the child process are also visible in the other process. or by the child process are also visible in the other process.
Moreover, any memory mapping or unmapping performed with Moreover, any memory mapping or unmapping performed with
.BR mmap (2) .BR mmap (2)
@ -357,9 +368,11 @@ processes do not affect the other, as with
.BR CLONE_PID " (obsolete)" .BR CLONE_PID " (obsolete)"
If If
.B CLONE_PID .B CLONE_PID
is set, the child process is created with the same process ID as is set, the child process is created with the same process ID as
the calling process. This is good for hacking the system, but otherwise the calling process.
of not much use. Since 2.3.21 this flag can be This is good for hacking the system, but otherwise
of not much use.
Since 2.3.21 this flag can be
specified only by the system boot process (PID 0). specified only by the system boot process (PID 0).
It disappeared in Linux 2.5.16. It disappeared in Linux 2.5.16.
.TP .TP
@ -376,7 +389,7 @@ Thread groups were a feature added in Linux 2.4 to support the
POSIX threads notion of a set of threads that share a single PID. POSIX threads notion of a set of threads that share a single PID.
Internally, this shared PID is the so-called Internally, this shared PID is the so-called
thread group identifier (TGID) for the thread group. thread group identifier (TGID) for the thread group.
Since Linux 2.4, calls to Since Linux 2.4, calls to
.BR getpid (2) .BR getpid (2)
return the TGID of the caller. return the TGID of the caller.
@ -389,7 +402,7 @@ and a thread can obtain
its own TID using its own TID using
.BR gettid (2). .BR gettid (2).
When a call is made to When a call is made to
.BR clone () .BR clone ()
without specifying without specifying
.BR CLONE_THREAD , .BR CLONE_THREAD ,
@ -403,13 +416,13 @@ A new thread created with
.B CLONE_THREAD .B CLONE_THREAD
has the same parent process as the caller of has the same parent process as the caller of
.BR clone () .BR clone ()
(i.e., like (i.e., like
.BR CLONE_PARENT ), .BR CLONE_PARENT ),
so that calls to so that calls to
.BR getppid (2) .BR getppid (2)
return the same value for all of the threads in a thread group. return the same value for all of the threads in a thread group.
When a When a
.B CLONE_THREAD .B CLONE_THREAD
thread terminates, the thread that created it using thread terminates, the thread that created it using
.BR clone () .BR clone ()
is not sent a is not sent a
@ -468,16 +481,16 @@ A call to
returns a signal set that is the union of the signals pending for the returns a signal set that is the union of the signals pending for the
whole process and the signals that are pending for the calling thread. whole process and the signals that are pending for the calling thread.
If If
.BR kill (2) .BR kill (2)
is used to send a signal to a thread group, is used to send a signal to a thread group,
and the thread group has installed a handler for the signal, then and the thread group has installed a handler for the signal, then
the handler will be invoked in exactly one, arbitrarily selected the handler will be invoked in exactly one, arbitrarily selected
member of the thread group that has not blocked the signal. member of the thread group that has not blocked the signal.
If multiple threads in a group are waiting to accept the same signal using If multiple threads in a group are waiting to accept the same signal using
.BR sigwaitinfo (2), .BR sigwaitinfo (2),
the kernel will arbitrarily select one of these threads the kernel will arbitrarily select one of these threads
to receive a signal sent using to receive a signal sent using
.BR kill (2). .BR kill (2).
.TP .TP
.BR CLONE_SYSVSEM " (since Linux 2.5.10)" .BR CLONE_SYSVSEM " (since Linux 2.5.10)"
@ -514,31 +527,34 @@ in child memory when the child exits, and do a wakeup on the futex
at that address. at that address.
The address involved may be changed by the The address involved may be changed by the
.BR set_tid_address (2) .BR set_tid_address (2)
system call. This is used by threading libraries. system call.
This is used by threading libraries.
.SS "sys_clone" .SS "sys_clone"
The The
.B sys_clone .B sys_clone
system call corresponds more closely to system call corresponds more closely to
.BR fork (2) .BR fork (2)
in that execution in the child continues from the point of the in that execution in the child continues from the point of the
call. Thus, call.
Thus,
.B sys_clone .B sys_clone
only requires the only requires the
.I flags .I flags
and and
.I child_stack .I child_stack
arguments, which have the same meaning as for arguments, which have the same meaning as for
.BR clone (). .BR clone ().
(Note that the order of these arguments differs from (Note that the order of these arguments differs from
.BR clone ().) .BR clone ().)
Another difference for Another difference for
.B sys_clone .B sys_clone
is that the is that the
.I child_stack .I child_stack
argument may be zero, in which case copy-on-write semantics ensure that the argument may be zero, in which case copy-on-write semantics ensure that the
child gets separate copies of stack pages when either process modifies child gets separate copies of stack pages when either process modifies
the stack. In this case, for correct operation, the the stack.
In this case, for correct operation, the
.B CLONE_VM .B CLONE_VM
option should not be specified. option should not be specified.
@ -555,7 +571,8 @@ will be written in case CLONE_CHILD_SETTID was specified.
.\" gettid() returns current->pid; .\" gettid() returns current->pid;
.\" getpid() returns current->tgid; .\" getpid() returns current->tgid;
On success, the thread ID of the child process is returned On success, the thread ID of the child process is returned
in the caller's thread of execution. On failure, a \-1 will be returned in the caller's thread of execution.
On failure, a \-1 will be returned
in the caller's context, no child process will be created, and in the caller's context, no child process will be created, and
.I errno .I errno
will be set appropriately. will be set appropriately.
@ -592,9 +609,9 @@ were specified in
.IR flags . .IR flags .
.TP .TP
.B EINVAL .B EINVAL
Returned by Returned by
.BR clone () .BR clone ()
when a zero value is specified for when a zero value is specified for
.IR child_stack . .IR child_stack .
.TP .TP
.B ENOMEM .B ENOMEM
@ -623,16 +640,16 @@ as the parent of the calling process.
However, for kernel versions 2.4.7 to 2.4.18 the However, for kernel versions 2.4.7 to 2.4.18 the
.B CLONE_THREAD .B CLONE_THREAD
flag implied the flag implied the
.B CLONE_PARENT .B CLONE_PARENT
flag (as in kernel 2.6). flag (as in kernel 2.6).
For a while there was For a while there was
.B CLONE_DETACHED .B CLONE_DETACHED
(introduced in 2.5.32): (introduced in 2.5.32):
parent wants no child-exit signal. parent wants no child-exit signal.
In 2.6.2 the need to give this In 2.6.2 the need to give this
together with together with
.B CLONE_THREAD .B CLONE_THREAD
disappeared. disappeared.
This flag is still defined, but has no effect. This flag is still defined, but has no effect.
@ -641,7 +658,7 @@ On x86,
should not be called through vsyscall, but directly through should not be called through vsyscall, but directly through
.IR "int $0x80" . .IR "int $0x80" .
On IA-64, a different system call is used: On IA-64, a different system call is used:
.nf .nf
.BI "int clone2(int (*" "fn" ")(void *), " .BI "int clone2(int (*" "fn" ")(void *), "
@ -653,7 +670,7 @@ On IA-64, a different system call is used:
.PP .PP
The The
.BR clone2 () .BR clone2 ()
system call operates in the same way as system call operates in the same way as
.BR clone (), .BR clone (),
except that except that
.I child_stack_base .I child_stack_base
@ -671,10 +688,10 @@ calls are Linux specific and should not be used in programs
intended to be portable. intended to be portable.
.SH BUGS .SH BUGS
Versions of the GNU C library that include the NPTL threading library Versions of the GNU C library that include the NPTL threading library
contain a wrapper function for contain a wrapper function for
.BR getpid () .BR getpid ()
that performs caching of PIDs. that performs caching of PIDs.
In programs linked against such libraries, calls to In programs linked against such libraries, calls to
.BR getpid () .BR getpid ()
may return the same value, even when the threads were not created using may return the same value, even when the threads were not created using
.B CLONE_THREAD .B CLONE_THREAD

View File

@ -11,7 +11,7 @@
.\" manual under the conditions for verbatim copying, provided that the .\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a .\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one. .\" permission notice identical to this one.
.\" .\"
.\" Since the Linux kernel and libraries are constantly changing, this .\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no .\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" responsibility for errors or omissions, or for damages resulting from .\" responsibility for errors or omissions, or for damages resulting from
@ -19,7 +19,7 @@
.\" have taken the same level of care in the production of this manual, .\" have taken the same level of care in the production of this manual,
.\" which is licensed free of charge, as they might when working .\" which is licensed free of charge, as they might when working
.\" professionally. .\" professionally.
.\" .\"
.\" Formatted or processed versions of this manual, if unaccompanied by .\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work. .\" the source, must acknowledge the copyright and authors of this work.
.\" .\"
@ -79,24 +79,28 @@ call was interrupted by a signal.
.B EIO .B EIO
An I/O error occurred. An I/O error occurred.
.SH "CONFORMING TO" .SH "CONFORMING TO"
SVr4, 4.3BSD, POSIX.1-2001. SVr4, 4.3BSD, POSIX.1-2001.
.\" SVr4 documents an additional ENOLINK error condition. .\" SVr4 documents an additional ENOLINK error condition.
.SH NOTES .SH NOTES
Not checking the return value of Not checking the return value of
.BR close () .BR close ()
is a common but nevertheless is a common but nevertheless
serious programming error. It is quite possible that errors on a serious programming error.
It is quite possible that errors on a
previous previous
.BR write (2) .BR write (2)
operation are first reported at the final operation are first reported at the final
.BR close (). .BR close ().
Not checking the return value when closing the file may lead to Not checking the return value when closing the file may lead to
silent loss of data. This can especially be observed with NFS silent loss of data.
This can especially be observed with NFS
and with disk quota. and with disk quota.
.PP .PP
A successful close does not guarantee that the data has been successfully A successful close does not guarantee that the data has been successfully
saved to disk, as the kernel defers writes. It is not common for a filesystem saved to disk, as the kernel defers writes.
to flush the buffers when the stream is closed. If you need to be sure that It is not common for a filesystem
to flush the buffers when the stream is closed.
If you need to be sure that
the data is physically stored use the data is physically stored use
.BR fsync (2). .BR fsync (2).
(It will depend on the disk hardware at this point.) (It will depend on the disk hardware at this point.)

View File

@ -12,7 +12,7 @@
.\" manual under the conditions for verbatim copying, provided that the .\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a .\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one. .\" permission notice identical to this one.
.\" .\"
.\" Since the Linux kernel and libraries are constantly changing, this .\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no .\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" responsibility for errors or omissions, or for damages resulting from .\" responsibility for errors or omissions, or for damages resulting from
@ -20,7 +20,7 @@
.\" have taken the same level of care in the production of this manual, .\" have taken the same level of care in the production of this manual,
.\" which is licensed free of charge, as they might when working .\" which is licensed free of charge, as they might when working
.\" professionally. .\" professionally.
.\" .\"
.\" Formatted or processed versions of this manual, if unaccompanied by .\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work. .\" the source, must acknowledge the copyright and authors of this work.
.\" .\"
@ -82,7 +82,7 @@ system call connects the socket referred to by the file descriptor
to the address specified by to the address specified by
.IR serv_addr . .IR serv_addr .
The The
.IR addrlen .IR addrlen
argument specifies the size of argument specifies the size of
.IR serv_addr . .IR serv_addr .
The format of the address in The format of the address in
@ -100,7 +100,8 @@ is of type
then then
.I serv_addr .I serv_addr
is the address to which datagrams are sent by default, and the only is the address to which datagrams are sent by default, and the only
address from which datagrams are received. If the socket is of type address from which datagrams are received.
If the socket is of type
.B SOCK_STREAM .B SOCK_STREAM
or or
.BR SOCK_SEQPACKET , .BR SOCK_SEQPACKET ,
@ -112,21 +113,22 @@ Generally, connection-based protocol sockets may successfully
.BR connect () .BR connect ()
only once; connectionless protocol sockets may use only once; connectionless protocol sockets may use
.BR connect () .BR connect ()
multiple times to change their association. Connectionless sockets may multiple times to change their association.
dissolve the association by connecting to an address with the Connectionless sockets may
dissolve the association by connecting to an address with the
.I sa_family .I sa_family
member of member of
.B sockaddr .B sockaddr
set to set to
.BR AF_UNSPEC . .BR AF_UNSPEC .
.SH "RETURN VALUE" .SH "RETURN VALUE"
If the connection or binding succeeds, zero is returned. On error, \-1 is If the connection or binding succeeds, zero is returned.
returned, and On error, \-1 is returned, and
.I errno .I errno
is set appropriately. is set appropriately.
.SH ERRORS .SH ERRORS
The following are general socket errors only. There may be other The following are general socket errors only.
domain-specific error codes. There may be other domain-specific error codes.
.TP .TP
.B EACCES .B EACCES
For Unix domain sockets, which are identified by pathname: For Unix domain sockets, which are identified by pathname:
@ -137,7 +139,7 @@ in the path prefix.
.BR path_resolution (2).) .BR path_resolution (2).)
.TP .TP
.B EACCES, EPERM .B EACCES, EPERM
The user tried to connect to a broadcast address without having the socket The user tried to connect to a broadcast address without having the socket
broadcast flag enabled or the connection request failed because of a local broadcast flag enabled or the connection request failed because of a local
firewall rule. firewall rule.
.TP .TP
@ -145,17 +147,18 @@ firewall rule.
Local address is already in use. Local address is already in use.
.TP .TP
.B EAFNOSUPPORT .B EAFNOSUPPORT
The passed address didn't have the correct address family in its The passed address didn't have the correct address family in its
.I sa_family .I sa_family
field. field.
.TP .TP
.B EAGAIN .B EAGAIN
No more free local ports or insufficient entries in the routing cache. For No more free local ports or insufficient entries in the routing cache.
For
.B PF_INET .B PF_INET
see the see the
.B net.ipv4.ip_local_port_range .B net.ipv4.ip_local_port_range
sysctl in sysctl in
.BR ip (7) .BR ip (7)
on how to increase the number of local ports. on how to increase the number of local ports.
.TP .TP
.B EALREADY .B EALREADY
@ -173,25 +176,27 @@ The socket structure address is outside the user's address space.
.TP .TP
.B EINPROGRESS .B EINPROGRESS
The socket is non-blocking and the connection cannot be completed The socket is non-blocking and the connection cannot be completed
immediately. It is possible to immediately.
It is possible to
.BR select (2) .BR select (2)
or or
.BR poll (2) .BR poll (2)
for completion by selecting the socket for writing. After for completion by selecting the socket for writing.
After
.BR select (2) .BR select (2)
indicates writability, use indicates writability, use
.BR getsockopt (2) .BR getsockopt (2)
to read the to read the
.B SO_ERROR .B SO_ERROR
option at level option at level
.B SOL_SOCKET .B SOL_SOCKET
to determine whether to determine whether
.BR connect () .BR connect ()
completed successfully completed successfully
.RB ( SO_ERROR .RB ( SO_ERROR
is zero) or unsuccessfully is zero) or unsuccessfully
.RB ( SO_ERROR .RB ( SO_ERROR
is one of the usual error codes listed here, is one of the usual error codes listed here,
explaining the reason for the failure). explaining the reason for the failure).
.TP .TP
.B EINTR .B EINTR
@ -209,23 +214,25 @@ Network is unreachable.
The file descriptor is not associated with a socket. The file descriptor is not associated with a socket.
.TP .TP
.B ETIMEDOUT .B ETIMEDOUT
Timeout while attempting connection. The server may be too Timeout while attempting connection.
busy to accept new connections. Note that for IP sockets the timeout may The server may be too
busy to accept new connections.
Note that for IP sockets the timeout may
be very long when syncookies are enabled on the server. be very long when syncookies are enabled on the server.
.SH "CONFORMING TO" .SH "CONFORMING TO"
SVr4, 4.4BSD, (the SVr4, 4.4BSD, (the
.BR connect () .BR connect ()
function first appeared in 4.2BSD), POSIX.1-2001. function first appeared in 4.2BSD), POSIX.1-2001.
.\" SVr4 documents the additional .\" SVr4 documents the additional
.\" general error codes .\" general error codes
.\" .BR EADDRNOTAVAIL , .\" .BR EADDRNOTAVAIL ,
.\" .BR EINVAL , .\" .BR EINVAL ,
.\" .BR EAFNOSUPPORT , .\" .BR EAFNOSUPPORT ,
.\" .BR EALREADY , .\" .BR EALREADY ,
.\" .BR EINTR , .\" .BR EINTR ,
.\" .BR EPROTOTYPE , .\" .BR EPROTOTYPE ,
.\" and .\" and
.\" .BR ENOSR . .\" .BR ENOSR .
.\" It also .\" It also
.\" documents many additional error conditions not described here. .\" documents many additional error conditions not described here.
.SH NOTE .SH NOTE
@ -234,7 +241,7 @@ The third argument of
is in reality an is in reality an
.I int .I int
(and this is what 4.x BSD and libc4 and libc5 have). (and this is what 4.x BSD and libc4 and libc5 have).
Some POSIX confusion resulted in the present Some POSIX confusion resulted in the present
.IR socklen_t , .IR socklen_t ,
also used by glibc. also used by glibc.
See also See also

View File

@ -2,7 +2,7 @@
.\" This file is distributed according to the GNU General Public License. .\" This file is distributed according to the GNU General Public License.
.\" See the file COPYING in the top level source directory for details. .\" See the file COPYING in the top level source directory for details.
.\" .\"
.\" 2006-02-09, some reformatting by Luc Van Oostenryck; some .\" 2006-02-09, some reformatting by Luc Van Oostenryck; some
.\" reformatting and rewordings by mtk .\" reformatting and rewordings by mtk
.\" .\"
.TH CREATE_MODULE 2 "2002" Linux "Linux Module Support" .TH CREATE_MODULE 2 "2002" Linux "Linux Module Support"
@ -49,7 +49,7 @@ capability).
.BR create_module () .BR create_module ()
is Linux specific. is Linux specific.
.SH NOTES .SH NOTES
This system call is only present on Linux up until kernel 2.4; This system call is only present on Linux up until kernel 2.4;
it was removed in Linux 2.6. it was removed in Linux 2.6.
.\" Removed in Linux-2.5.48 .\" Removed in Linux-2.5.48
.SH "SEE ALSO" .SH "SEE ALSO"

View File

@ -2,7 +2,7 @@
.\" This file is distributed according to the GNU General Public License. .\" This file is distributed according to the GNU General Public License.
.\" See the file COPYING in the top level source directory for details. .\" See the file COPYING in the top level source directory for details.
.\" .\"
.\" 2006-02-09, some reformatting by Luc Van Oostenryck; some .\" 2006-02-09, some reformatting by Luc Van Oostenryck; some
.\" reformatting and rewordings by mtk .\" reformatting and rewordings by mtk
.\" .\"
.TH DELETE_MODULE 2 "2002" Linux "Linux Module Support" .TH DELETE_MODULE 2 "2002" Linux "Linux Module Support"
@ -23,7 +23,8 @@ is NULL,
all unused modules marked auto-clean will be removed. all unused modules marked auto-clean will be removed.
This system call requires privilege. This system call requires privilege.
.SH "RETURN VALUE" .SH "RETURN VALUE"
On success, zero is returned. On error, \-1 is returned and On success, zero is returned.
On error, \-1 is returned and
.I errno .I errno
is set appropriately. is set appropriately.
.SH ERRORS .SH ERRORS

View File

@ -11,7 +11,7 @@
.\" manual under the conditions for verbatim copying, provided that the .\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a .\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one. .\" permission notice identical to this one.
.\" .\"
.\" Since the Linux kernel and libraries are constantly changing, this .\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no .\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" responsibility for errors or omissions, or for damages resulting from .\" responsibility for errors or omissions, or for damages resulting from
@ -19,7 +19,7 @@
.\" have taken the same level of care in the production of this manual, .\" have taken the same level of care in the production of this manual,
.\" which is licensed free of charge, as they might when working .\" which is licensed free of charge, as they might when working
.\" professionally. .\" professionally.
.\" .\"
.\" Formatted or processed versions of this manual, if unaccompanied by .\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work. .\" the source, must acknowledge the copyright and authors of this work.
.\" .\"
@ -40,8 +40,8 @@ dup, dup2 \- duplicate a file descriptor
.BI "int dup2(int " oldfd ", int " newfd ); .BI "int dup2(int " oldfd ", int " newfd );
.fi .fi
.SH DESCRIPTION .SH DESCRIPTION
.BR dup () .BR dup ()
and and
.BR dup2 () .BR dup2 ()
create a copy of the file descriptor create a copy of the file descriptor
.IR oldfd . .IR oldfd .
@ -57,8 +57,8 @@ on one of the descriptors, the offset is also changed for the other.
The two descriptors do not share file descriptor flags The two descriptors do not share file descriptor flags
(the close-on-exec flag). (the close-on-exec flag).
The close-on-exec flag The close-on-exec flag
.RB ( FD_CLOEXEC ; .RB ( FD_CLOEXEC ;
see see
.BR fcntl (2)) .BR fcntl (2))
for the duplicate descriptor is off. for the duplicate descriptor is off.
@ -70,8 +70,8 @@ uses the lowest-numbered unused descriptor for the new descriptor.
.RI "makes " newfd " be the copy of " oldfd ", closing " newfd .RI "makes " newfd " be the copy of " oldfd ", closing " newfd
first if necessary. first if necessary.
.SH "RETURN VALUE" .SH "RETURN VALUE"
.BR dup () .BR dup ()
and and
.BR dup2 () .BR dup2 ()
return the new descriptor, or \-1 if an error occurred (in which case, return the new descriptor, or \-1 if an error occurred (in which case,
.I errno .I errno
@ -88,8 +88,8 @@ is out of the allowed range for file descriptors.
(Linux only) This may be returned by (Linux only) This may be returned by
.BR dup2 () .BR dup2 ()
during a race condition with during a race condition with
.BR open () .BR open ()
and and
.BR dup (). .BR dup ().
.TP .TP
.B EINTR .B EINTR
@ -107,7 +107,8 @@ is different from that returned by
.BR fcntl( "..., " F_DUPFD ", ..." ) .BR fcntl( "..., " F_DUPFD ", ..." )
when when
.I newfd .I newfd
is out of range. On some systems is out of range.
On some systems
.BR dup2 () .BR dup2 ()
also sometimes returns also sometimes returns
.B EINVAL .B EINVAL
@ -118,13 +119,14 @@ If
.I newfd .I newfd
was open, any errors that would have been reported at was open, any errors that would have been reported at
.BR close () .BR close ()
time, are lost. A careful programmer will not use time, are lost.
A careful programmer will not use
.BR dup2 () .BR dup2 ()
without closing without closing
.I newfd .I newfd
first. first.
.SH "CONFORMING TO" .SH "CONFORMING TO"
SVr4, 4.3BSD, POSIX.1-2001. SVr4, 4.3BSD, POSIX.1-2001.
.\" SVr4 documents additional .\" SVr4 documents additional
.\" EINTR and ENOLINK error conditions. POSIX.1 adds EINTR. .\" EINTR and ENOLINK error conditions. POSIX.1 adds EINTR.
.\" The EBUSY return is Linux specific. .\" The EBUSY return is Linux specific.

View File

@ -34,13 +34,15 @@ Open an
file descriptor by requesting the kernel allocate file descriptor by requesting the kernel allocate
an event backing store dimensioned for an event backing store dimensioned for
.I size .I size
descriptors. The descriptors.
The
.I size .I size
is not the maximum size of the backing store but is not the maximum size of the backing store but
just a hint to the kernel about how to dimension internal structures. just a hint to the kernel about how to dimension internal structures.
The returned file descriptor will be used for all the subsequent calls to the The returned file descriptor will be used for all the subsequent calls to the
.B epoll .B epoll
interface. The file descriptor returned by interface.
The file descriptor returned by
.BR epoll_create (2) .BR epoll_create (2)
must be closed by using must be closed by using
.BR close (2). .BR close (2).
@ -48,7 +50,7 @@ must be closed by using
When successful, When successful,
.BR epoll_create (2) .BR epoll_create (2)
returns a non-negative integer identifying the descriptor. returns a non-negative integer identifying the descriptor.
When an error occurs, When an error occurs,
.BR epoll_create (2) .BR epoll_create (2)
returns \-1 and returns \-1 and
.I errno .I errno

View File

@ -74,9 +74,9 @@ The associated file is available for
operations. operations.
.TP .TP
.BR EPOLLRDHUP " (since kernel 2.6.17)" .BR EPOLLRDHUP " (since kernel 2.6.17)"
Stream socket peer closed connection, Stream socket peer closed connection,
or shut down writing half of connection. or shut down writing half of connection.
(This flag is especially useful for writing simple code to detect (This flag is especially useful for writing simple code to detect
peer shutdown when using Edge Triggered monitoring.) peer shutdown when using Edge Triggered monitoring.)
.TP .TP
.B EPOLLPRI .B EPOLLPRI
@ -100,7 +100,8 @@ will always wait for this event; it is not necessary to set it in
Sets the Edge Triggered behaviour for the associated file descriptor. Sets the Edge Triggered behaviour for the associated file descriptor.
The default behaviour for The default behaviour for
.B epoll .B epoll
is Level Triggered. See is Level Triggered.
See
.BR epoll (7) .BR epoll (7)
for more detailed information about Edge and Level Triggered event for more detailed information about Edge and Level Triggered event
distribution architectures. distribution architectures.
@ -112,7 +113,8 @@ This means that after an event is pulled out with
the associated file descriptor is internally disabled and no other events the associated file descriptor is internally disabled and no other events
will be reported by the will be reported by the
.B epoll .B epoll
interface. The user must call interface.
The user must call
.BR epoll_ctl (2) .BR epoll_ctl (2)
with with
.B EPOLL_CTL_MOD .B EPOLL_CTL_MOD
@ -157,9 +159,10 @@ The
is ignored and can be NULL (but see BUGS below). is ignored and can be NULL (but see BUGS below).
.RE .RE
.SH "RETURN VALUE" .SH "RETURN VALUE"
When successful, When successful,
.BR epoll_ctl (2) .BR epoll_ctl (2)
returns zero. When an error occurs, returns zero.
When an error occurs,
.BR epoll_ctl (2) .BR epoll_ctl (2)
returns \-1 and returns \-1 and
.I errno .I errno
@ -180,12 +183,12 @@ is already in
.IR epfd . .IR epfd .
.TP .TP
.B EINVAL .B EINVAL
.IR epfd .IR epfd
is not an is not an
.B epoll .B epoll
file descriptor, file descriptor,
or or
.IR fd .IR fd
is the same as is the same as
.IR epfd , .IR epfd ,
or the requested operation or the requested operation
@ -216,13 +219,13 @@ is Linux specific, and was introduced in kernel 2.5.44.
.SH BUGS .SH BUGS
In kernel versions before 2.6.9, the In kernel versions before 2.6.9, the
.B EPOLL_CTL_DEL .B EPOLL_CTL_DEL
operation required a non-NULL pointer in operation required a non-NULL pointer in
.IR event , .IR event ,
even though this argument is ignored. even though this argument is ignored.
Since kernel 2.6.9, Since kernel 2.6.9,
.I event .I event
can be specified as NULL can be specified as NULL
when using when using
.BR EPOLL_CTL_DEL . .BR EPOLL_CTL_DEL .
.SH "SEE ALSO" .SH "SEE ALSO"
.BR epoll_create (2), .BR epoll_create (2),

View File

@ -19,7 +19,7 @@
.\" Davide Libenzi <davidel@xmailserver.org> .\" Davide Libenzi <davidel@xmailserver.org>
.\" .\"
.\" .\"
.\" FIXME 2.6.19-rc5 has epoll_pwait(); this should be documented .\" FIXME 2.6.19-rc5 has epoll_pwait(); this should be documented
.\" on this page. .\" on this page.
.\" .\"
.TH EPOLL_WAIT 2 "23 October 2002" Linux "Linux Programmer's Manual" .TH EPOLL_WAIT 2 "23 October 2002" Linux "Linux Programmer's Manual"
@ -29,7 +29,7 @@ epoll_wait \- wait for an I/O event on an epoll file descriptor
.nf .nf
.B #include <sys/epoll.h> .B #include <sys/epoll.h>
.sp .sp
.BI "int epoll_wait(int " epfd ", struct epoll_event *" events , .BI "int epoll_wait(int " epfd ", struct epoll_event *" events ,
.BI " int " maxevents ", int " timeout); .BI " int " maxevents ", int " timeout);
.fi .fi
.SH DESCRIPTION .SH DESCRIPTION
@ -39,7 +39,8 @@ file descriptor
.I epfd .I epfd
for a maximum time of for a maximum time of
.I timeout .I timeout
milliseconds. The memory area pointed to by milliseconds.
The memory area pointed to by
.I events .I events
will contain the events that will be available for the caller. will contain the events that will be available for the caller.
Up to Up to
@ -48,7 +49,8 @@ are returned by
.BR epoll_wait (2). .BR epoll_wait (2).
The The
.I maxevents .I maxevents
parameter must be greater than zero. Specifying a parameter must be greater than zero.
Specifying a
.I timeout .I timeout
of \-1 makes of \-1 makes
.BR epoll_wait (2) .BR epoll_wait (2)
@ -56,7 +58,7 @@ wait indefinitely, while specifying a
.I timeout .I timeout
equal to zero makes equal to zero makes
.BR epoll_wait (2) .BR epoll_wait (2)
to return immediately even if no events are available to return immediately even if no events are available
(return code equal to zero). (return code equal to zero).
The The
.I struct epoll_event .I struct epoll_event
@ -87,12 +89,13 @@ while the
.I events .I events
member will contain the returned event bit field. member will contain the returned event bit field.
.SH "RETURN VALUE" .SH "RETURN VALUE"
When successful, When successful,
.BR epoll_wait (2) .BR epoll_wait (2)
returns the number of file descriptors ready for the requested I/O, or zero returns the number of file descriptors ready for the requested I/O, or zero
if no file descriptor became ready during the requested if no file descriptor became ready during the requested
.I timeout .I timeout
milliseconds. When an error occurs, milliseconds.
When an error occurs,
.BR epoll_wait (2) .BR epoll_wait (2)
returns \-1 and returns \-1 and
.I errno .I errno
@ -115,7 +118,7 @@ requested events occurred or the
expired. expired.
.TP .TP
.B EINVAL .B EINVAL
.IR epfd .IR epfd
is not an is not an
.B epoll .B epoll
file descriptor, or file descriptor, or

View File

@ -11,7 +11,7 @@
.\" manual under the conditions for verbatim copying, provided that the .\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a .\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one. .\" permission notice identical to this one.
.\" .\"
.\" Since the Linux kernel and libraries are constantly changing, this .\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no .\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" responsibility for errors or omissions, or for damages resulting from .\" responsibility for errors or omissions, or for damages resulting from
@ -19,7 +19,7 @@
.\" have taken the same level of care in the production of this manual, .\" have taken the same level of care in the production of this manual,
.\" which is licensed free of charge, as they might when working .\" which is licensed free of charge, as they might when working
.\" professionally. .\" professionally.
.\" .\"
.\" Formatted or processed versions of this manual, if unaccompanied by .\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work. .\" the source, must acknowledge the copyright and authors of this work.
.\" .\"
@ -51,15 +51,15 @@ executable which is not itself a script, which will be invoked as
\fIargv\fP is an array of argument strings passed to the new program. \fIargv\fP is an array of argument strings passed to the new program.
\fIenvp\fP is an array of strings, conventionally of the form \fIenvp\fP is an array of strings, conventionally of the form
\fBkey=value\fR, which are passed as environment to the new \fBkey=value\fR, which are passed as environment to the new program.
program. Both \fIargv\fP and \fIenvp\fP must be terminated by a null Both \fIargv\fP and \fIenvp\fP must be terminated by a null pointer.
pointer. The argument vector and environment can be accessed by the The argument vector and environment can be accessed by the
called program's main function, when it is defined as \fBint main(int called program's main function, when it is defined as \fBint main(int
argc, char *argv[], char *envp[])\fR. argc, char *argv[], char *envp[])\fR.
\fBexecve\fP() does not return on success, and the text, data, bss, and \fBexecve\fP() does not return on success, and the text, data, bss, and
stack of the calling process are overwritten by that of the program stack of the calling process are overwritten by that of the program
loaded. loaded.
If the current program is being ptraced, a \fBSIGTRAP\fP is sent to it If the current program is being ptraced, a \fBSIGTRAP\fP is sent to it
after a successful \fBexecve\fP(). after a successful \fBexecve\fP().
@ -74,20 +74,21 @@ process is set to the group of the program file.
The effective user ID of the process is copied to the saved set-user-ID; The effective user ID of the process is copied to the saved set-user-ID;
similarly, the effective group ID is copied to the saved set-group-ID. similarly, the effective group ID is copied to the saved set-group-ID.
This copying takes place after any effective ID changes that occur This copying takes place after any effective ID changes that occur
because of the set-user-ID and set-group-ID permission bits. because of the set-user-ID and set-group-ID permission bits.
If the executable is an a.out dynamically-linked If the executable is an a.out dynamically-linked
binary executable containing binary executable containing
shared-library stubs, the Linux dynamic linker shared-library stubs, the Linux dynamic linker
.BR ld.so (8) .BR ld.so (8)
is called at the start of execution to bring is called at the start of execution to bring
needed shared libraries into memory needed shared libraries into memory
and link the executable with them. and link the executable with them.
If the executable is a dynamically-linked ELF executable, the If the executable is a dynamically-linked ELF executable, the
interpreter named in the PT_INTERP segment is used to load the needed interpreter named in the PT_INTERP segment is used to load the needed
shared libraries. This interpreter is typically shared libraries.
This interpreter is typically
\fI/lib/ld-linux.so.1\fR for binaries linked with the Linux libc \fI/lib/ld-linux.so.1\fR for binaries linked with the Linux libc
version 5, or \fI/lib/ld-linux.so.2\fR for binaries linked with the version 5, or \fI/lib/ld-linux.so.2\fR for binaries linked with the
GNU libc version 2. GNU libc version 2.
@ -106,7 +107,7 @@ in
The set of pending signals is cleared The set of pending signals is cleared
.RB ( sigpending (2)). .RB ( sigpending (2)).
.IP * 4 .IP * 4
The dispositions of any signals that are being caught are The dispositions of any signals that are being caught are
reset to being ignored. reset to being ignored.
.IP * 4 .IP * 4
Any alternate signal stack is not preserved Any alternate signal stack is not preserved
@ -141,27 +142,27 @@ Exit handlers are not preserved
.RB ( atexit (3), .RB ( atexit (3),
.BR on_exit (3)). .BR on_exit (3)).
.PP .PP
The process attributes in the preceding list are all specified The process attributes in the preceding list are all specified
in POSIX.1-2001. in POSIX.1-2001.
The following Linux-specific process attributes are also The following Linux-specific process attributes are also
not preserved during an not preserved during an
.BR execve (): .BR execve ():
.IP * 4 .IP * 4
The The
.BR prctl (2) .BR prctl (2)
.B PR_SET_DUMPABLE .B PR_SET_DUMPABLE
flag is set, flag is set,
unless a set-user-ID or set-group ID program is being executed, unless a set-user-ID or set-group ID program is being executed,
in which case it is cleared. in which case it is cleared.
.IP * 4 .IP * 4
The The
.BR prctl (2) .BR prctl (2)
.B PR_SET_KEEPCAPS .B PR_SET_KEEPCAPS
flag is cleared. flag is cleared.
.IP * 4 .IP * 4
The process name, as set by The process name, as set by
.BR prctl (2) .BR prctl (2)
.BR PR_SET_NAME .BR PR_SET_NAME
(and displayed by (and displayed by
.IR "ps -o comm" ), .IR "ps -o comm" ),
is reset to the name of the new executable file. is reset to the name of the new executable file.
@ -179,17 +180,17 @@ Mutexes, condition variables, and other pthreads objects are not preserved.
The equivalent of \fIsetlocale(LC_ALL, "C")\fP The equivalent of \fIsetlocale(LC_ALL, "C")\fP
is executed at program start-up. is executed at program start-up.
.IP * 4 .IP * 4
POSIX.1-2001 specifies that the dispositions of any signals that POSIX.1-2001 specifies that the dispositions of any signals that
are ignored or set to the default are left unchanged. are ignored or set to the default are left unchanged.
POSIX.1-2001 specifies one exception: if SIGCHLD is being ignored, POSIX.1-2001 specifies one exception: if SIGCHLD is being ignored,
then an implementation may leave the disposition unchanged or then an implementation may leave the disposition unchanged or
reset it to the default; Linux does the former. reset it to the default; Linux does the former.
.IP * 4 .IP * 4
Any outstanding asynchronous I/O operations are cancelled Any outstanding asynchronous I/O operations are cancelled
.RB ( aio_read (3), .RB ( aio_read (3),
.BR aio_write (3)). .BR aio_write (3)).
.IP * 4 .IP * 4
For the handling of capabilities during For the handling of capabilities during
.BR execve (2), .BR execve (2),
see see
.BR capabilities (7). .BR capabilities (7).
@ -200,9 +201,9 @@ is set appropriately.
.SH ERRORS .SH ERRORS
.TP .TP
.B E2BIG .B E2BIG
The total number of bytes in the environment The total number of bytes in the environment
.RI ( envp ) .RI ( envp )
and argument list and argument list
.RI ( argv ) .RI ( argv )
is too large. is too large.
.TP .TP
@ -256,7 +257,7 @@ is too long.
The system limit on the total number of open files has been reached. The system limit on the total number of open files has been reached.
.TP .TP
.B ENOENT .B ENOENT
The file The file
.I filename .I filename
or a script or ELF interpreter does not exist, or a shared library or a script or ELF interpreter does not exist, or a shared library
needed for file or interpreter cannot be found. needed for file or interpreter cannot be found.
@ -277,7 +278,7 @@ or a script or ELF interpreter is not a directory.
.B EPERM .B EPERM
The file system is mounted The file system is mounted
.IR nosuid , .IR nosuid ,
the user is not the superuser, the user is not the superuser,
and the file has the set-user-ID or set-group-ID bit set. and the file has the set-user-ID or set-group-ID bit set.
.TP .TP
.B EPERM .B EPERM
@ -287,9 +288,9 @@ file has the set-user-ID or set-group-ID bit set.
.B ETXTBSY .B ETXTBSY
Executable was open for writing by one or more processes. Executable was open for writing by one or more processes.
.SH "CONFORMING TO" .SH "CONFORMING TO"
SVr4, 4.3BSD, POSIX.1-2001. SVr4, 4.3BSD, POSIX.1-2001.
POSIX.1-2001 does not document the #! behavior POSIX.1-2001 does not document the #! behavior
but is otherwise compatible. but is otherwise compatible.
.\" SVr4 documents additional error .\" SVr4 documents additional error
.\" conditions EAGAIN, EINTR, ELIBACC, ENOLINK, EMULTIHOP; POSIX does not .\" conditions EAGAIN, EINTR, ELIBACC, ENOLINK, EMULTIHOP; POSIX does not
.\" document ETXTBSY, EPERM, EFAULT, ELOOP, EIO, ENFILE, EMFILE, EINVAL, .\" document ETXTBSY, EPERM, EFAULT, ELOOP, EIO, ENFILE, EMFILE, EINVAL,
@ -302,15 +303,15 @@ Linux ignores the set-user-ID and set-group-ID bits on scripts.
The result of mounting a filesystem The result of mounting a filesystem
.I nosuid .I nosuid
vary between Linux kernel versions: vary between Linux kernel versions:
some will refuse execution of set-user-ID and set-group-ID some will refuse execution of set-user-ID and set-group-ID
executables when this would executables when this would
give the user powers she did not have already (and return EPERM), give the user powers she did not have already (and return EPERM),
some will just ignore the set-user-ID and set-group-ID bits and some will just ignore the set-user-ID and set-group-ID bits and
.BR exec () .BR exec ()
successfully. successfully.
A maximum line length of 127 characters is allowed for the first line in A maximum line length of 127 characters is allowed for the first line in
a #! executable shell script. a #! executable shell script.
.\" .SH BUGS .\" .SH BUGS
.\" Some Linux versions have failed to check permissions on ELF .\" Some Linux versions have failed to check permissions on ELF
.\" interpreters. This is a security hole, because it allows users to .\" interpreters. This is a security hole, because it allows users to
@ -319,14 +320,14 @@ a #! executable shell script.
.\" that could be exploited for denial of service by a suitably crafted .\" that could be exploited for denial of service by a suitably crafted
.\" ELF binary. There are no known problems with 2.0.34 or 2.2.15. .\" ELF binary. There are no known problems with 2.0.34 or 2.2.15.
.SH HISTORICAL .SH HISTORICAL
With Unix V6 the argument list of an With Unix V6 the argument list of an
.BR exec () .BR exec ()
call was ended by 0, call was ended by 0,
while the argument list of while the argument list of
.I main .I main
was ended by \-1. Thus, this was ended by \-1. Thus, this
argument list was not directly usable in a further argument list was not directly usable in a further
.BR exec () .BR exec ()
call. call.
Since Unix V7 both are NULL. Since Unix V7 both are NULL.
.SH "SEE ALSO" .SH "SEE ALSO"

View File

@ -8,7 +8,7 @@
.\" manual under the conditions for verbatim copying, provided that the .\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a .\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one. .\" permission notice identical to this one.
.\" .\"
.\" Since the Linux kernel and libraries are constantly changing, this .\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no .\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" responsibility for errors or omissions, or for damages resulting from .\" responsibility for errors or omissions, or for damages resulting from
@ -16,7 +16,7 @@
.\" have taken the same level of care in the production of this manual, .\" have taken the same level of care in the production of this manual,
.\" which is licensed free of charge, as they might when working .\" which is licensed free of charge, as they might when working
.\" professionally. .\" professionally.
.\" .\"
.\" Formatted or processed versions of this manual, if unaccompanied by .\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work. .\" the source, must acknowledge the copyright and authors of this work.
.\" .\"

View File

@ -10,7 +10,7 @@
.\" manual under the conditions for verbatim copying, provided that the .\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a .\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one. .\" permission notice identical to this one.
.\" .\"
.\" Since the Linux kernel and libraries are constantly changing, this .\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no .\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" responsibility for errors or omissions, or for damages resulting from .\" responsibility for errors or omissions, or for damages resulting from
@ -18,7 +18,7 @@
.\" have taken the same level of care in the production of this manual, .\" have taken the same level of care in the production of this manual,
.\" which is licensed free of charge, as they might when working .\" which is licensed free of charge, as they might when working
.\" professionally. .\" professionally.
.\" .\"
.\" Formatted or processed versions of this manual, if unaccompanied by .\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work. .\" the source, must acknowledge the copyright and authors of this work.
.\" .\"
@ -43,53 +43,53 @@ system call operates in exactly the same way as
.BR access (2), .BR access (2),
except for the differences described in this manual page. except for the differences described in this manual page.
If the pathname given in If the pathname given in
.I pathname .I pathname
is relative, then it is interpreted relative to the directory is relative, then it is interpreted relative to the directory
referred to by the file descriptor referred to by the file descriptor
.IR dirfd .IR dirfd
(rather than relative to the current working directory of (rather than relative to the current working directory of
the calling process, as is done by the calling process, as is done by
.BR access (2) .BR access (2)
for a relative pathname). for a relative pathname).
If If
.I pathname .I pathname
is relative and is relative and
.I dirfd .I dirfd
is the special value is the special value
.BR AT_FDCWD , .BR AT_FDCWD ,
then then
.I pathname .I pathname
is interpreted relative to the current working is interpreted relative to the current working
directory of the calling process (like directory of the calling process (like
.BR access (2)). .BR access (2)).
If If
.IR pathname .IR pathname
is absolute, then is absolute, then
.I dirfd .I dirfd
is ignored. is ignored.
.I flags .I flags
is constructed by ORing together zero or more of the following values: is constructed by ORing together zero or more of the following values:
.TP .TP
.B AT_EACCESS .B AT_EACCESS
Perform access checks using the effective user and group IDs. Perform access checks using the effective user and group IDs.
By default, By default,
.BR faccessat () .BR faccessat ()
uses the real IDs (like uses the real IDs (like
.BR access (2)). .BR access (2)).
.TP .TP
.B AT_SYMLINK_NOFOLLOW .B AT_SYMLINK_NOFOLLOW
If If
.I pathname .I pathname
is a symbolic link, do not dereference it: is a symbolic link, do not dereference it:
instead return information about the link itself. instead return information about the link itself.
.SH "RETURN VALUE" .SH "RETURN VALUE"
On success, (all requested permissions granted) On success, (all requested permissions granted)
.BR faccessat () .BR faccessat ()
returns 0. returns 0.
On error, \-1 is returned and On error, \-1 is returned and
.I errno .I errno
is set to indicate the error. is set to indicate the error.
@ -98,7 +98,7 @@ The same errors that occur for
.BR access (2) .BR access (2)
can also occur for can also occur for
.BR faccessat (). .BR faccessat ().
The following additional errors can occur for The following additional errors can occur for
.BR faccessat (): .BR faccessat ():
.TP .TP
.B EBADF .B EBADF
@ -127,9 +127,9 @@ The
.B AT_EACCESS .B AT_EACCESS
and and
.B AT_SYMLINK_NOFOLLOW .B AT_SYMLINK_NOFOLLOW
flags are actually implemented within the glibc wrapper function for flags are actually implemented within the glibc wrapper function for
.BR faccessat (). .BR faccessat ().
If either of these flags are specified, then the wrapper function employs If either of these flags are specified, then the wrapper function employs
.BR fstatat (2) .BR fstatat (2)
to determine access permissions. to determine access permissions.
.SH VERSIONS .SH VERSIONS

View File

@ -10,7 +10,7 @@
.\" manual under the conditions for verbatim copying, provided that the .\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a .\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one. .\" permission notice identical to this one.
.\" .\"
.\" Since the Linux kernel and libraries are constantly changing, this .\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no .\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" responsibility for errors or omissions, or for damages resulting from .\" responsibility for errors or omissions, or for damages resulting from
@ -18,7 +18,7 @@
.\" have taken the same level of care in the production of this manual, .\" have taken the same level of care in the production of this manual,
.\" which is licensed free of charge, as they might when working .\" which is licensed free of charge, as they might when working
.\" professionally. .\" professionally.
.\" .\"
.\" Formatted or processed versions of this manual, if unaccompanied by .\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work. .\" the source, must acknowledge the copyright and authors of this work.
.\" .\"
@ -42,47 +42,47 @@ system call operates in exactly the same way as
.BR chmod (2), .BR chmod (2),
except for the differences described in this manual page. except for the differences described in this manual page.
If the pathname given in If the pathname given in
.I pathname .I pathname
is relative, then it is interpreted relative to the directory is relative, then it is interpreted relative to the directory
referred to by the file descriptor referred to by the file descriptor
.IR dirfd .IR dirfd
(rather than relative to the current working directory of (rather than relative to the current working directory of
the calling process, as is done by the calling process, as is done by
.BR chmod (2) .BR chmod (2)
for a relative pathname). for a relative pathname).
If If
.I pathname .I pathname
is relative and is relative and
.I dirfd .I dirfd
is the special value is the special value
.BR AT_FDCWD , .BR AT_FDCWD ,
then then
.I pathname .I pathname
is interpreted relative to the current working is interpreted relative to the current working
directory of the calling process (like directory of the calling process (like
.BR chmod (2)). .BR chmod (2)).
If If
.IR pathname .IR pathname
is absolute, then is absolute, then
.I dirfd .I dirfd
is ignored. is ignored.
.I flags .I flags
can either be 0, or include the following flag: can either be 0, or include the following flag:
.TP .TP
.B AT_SYMLINK_NOFOLLOW .B AT_SYMLINK_NOFOLLOW
If If
.I pathname .I pathname
is a symbolic link, do not dereference it: is a symbolic link, do not dereference it:
instead operate on the link itself. instead operate on the link itself.
This flag is not currently implemented. This flag is not currently implemented.
.SH "RETURN VALUE" .SH "RETURN VALUE"
On success, On success,
.BR fchmodat () .BR fchmodat ()
returns 0. returns 0.
On error, \-1 is returned and On error, \-1 is returned and
.I errno .I errno
is set to indicate the error. is set to indicate the error.
@ -91,7 +91,7 @@ The same errors that occur for
.BR chmod (2) .BR chmod (2)
can also occur for can also occur for
.BR fchmodat (). .BR fchmodat ().
The following additional errors can occur for The following additional errors can occur for
.BR fchmodat (): .BR fchmodat ():
.TP .TP
.B EBADF .B EBADF
@ -109,7 +109,7 @@ is relative and
is a file descriptor referring to a file other than a directory. is a file descriptor referring to a file other than a directory.
.TP .TP
.B ENOTSUP .B ENOTSUP
.IR flags .IR flags
specified specified
.BR AT_SYMLINK_NOFOLLOW , .BR AT_SYMLINK_NOFOLLOW ,
which is not supported. which is not supported.

View File

@ -10,7 +10,7 @@
.\" manual under the conditions for verbatim copying, provided that the .\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a .\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one. .\" permission notice identical to this one.
.\" .\"
.\" Since the Linux kernel and libraries are constantly changing, this .\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no .\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" responsibility for errors or omissions, or for damages resulting from .\" responsibility for errors or omissions, or for damages resulting from
@ -18,7 +18,7 @@
.\" have taken the same level of care in the production of this manual, .\" have taken the same level of care in the production of this manual,
.\" which is licensed free of charge, as they might when working .\" which is licensed free of charge, as they might when working
.\" professionally. .\" professionally.
.\" .\"
.\" Formatted or processed versions of this manual, if unaccompanied by .\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work. .\" the source, must acknowledge the copyright and authors of this work.
.\" .\"
@ -32,7 +32,7 @@ file descriptor
.B #define _ATFILE_SOURCE .B #define _ATFILE_SOURCE
.B #include <unistd.h> .B #include <unistd.h>
.sp .sp
.BI "int fchownat(int " dirfd ", const char *" pathname , .BI "int fchownat(int " dirfd ", const char *" pathname ,
.BI " uid_t " owner ", gid_t " group ", int " flags ); .BI " uid_t " owner ", gid_t " group ", int " flags );
.fi .fi
.SH DESCRIPTION .SH DESCRIPTION
@ -42,51 +42,51 @@ system call operates in exactly the same way as
.BR chown (2), .BR chown (2),
except for the differences described in this manual page. except for the differences described in this manual page.
If the pathname given in If the pathname given in
.I pathname .I pathname
is relative, then it is interpreted relative to the directory is relative, then it is interpreted relative to the directory
referred to by the file descriptor referred to by the file descriptor
.IR dirfd .IR dirfd
(rather than relative to the current working directory of (rather than relative to the current working directory of
the calling process, as is done by the calling process, as is done by
.BR chown (2) .BR chown (2)
for a relative pathname). for a relative pathname).
If If
.I pathname .I pathname
is relative and is relative and
.I dirfd .I dirfd
is the special value is the special value
.BR AT_FDCWD , .BR AT_FDCWD ,
then then
.I pathname .I pathname
is interpreted relative to the current working is interpreted relative to the current working
directory of the calling process (like directory of the calling process (like
.BR chown (2)). .BR chown (2)).
If If
.IR pathname .IR pathname
is absolute, then is absolute, then
.I dirfd .I dirfd
is ignored. is ignored.
.I flags .I flags
can either be 0, or include the following flag: can either be 0, or include the following flag:
.TP .TP
.B AT_SYMLINK_NOFOLLOW .B AT_SYMLINK_NOFOLLOW
If If
.I pathname .I pathname
is a symbolic link, do not dereference it: is a symbolic link, do not dereference it:
instead operate on the link itself, like instead operate on the link itself, like
.BR lchown (2). .BR lchown (2).
(By default, (By default,
.BR fchownat () .BR fchownat ()
dereferences symbolic links, like dereferences symbolic links, like
.BR chown (2).) .BR chown (2).)
.SH "RETURN VALUE" .SH "RETURN VALUE"
On success, On success,
.BR fchownat () .BR fchownat ()
returns 0. returns 0.
On error, \-1 is returned and On error, \-1 is returned and
.I errno .I errno
is set to indicate the error. is set to indicate the error.
@ -95,7 +95,7 @@ The same errors that occur for
.BR chown (2) .BR chown (2)
can also occur for can also occur for
.BR fchownat (). .BR fchownat ().
The following additional errors can occur for The following additional errors can occur for
.BR fchownat (): .BR fchownat ():
.TP .TP
.B EBADF .B EBADF

View File

@ -14,7 +14,7 @@
.\" manual under the conditions for verbatim copying, provided that the .\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a .\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one. .\" permission notice identical to this one.
.\" .\"
.\" Since the Linux kernel and libraries are constantly changing, this .\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no .\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" responsibility for errors or omissions, or for damages resulting from .\" responsibility for errors or omissions, or for damages resulting from
@ -22,7 +22,7 @@
.\" have taken the same level of care in the production of this manual, .\" have taken the same level of care in the production of this manual,
.\" which is licensed free of charge, as they might when working .\" which is licensed free of charge, as they might when working
.\" professionally. .\" professionally.
.\" .\"
.\" Formatted or processed versions of this manual, if unaccompanied by .\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work. .\" the source, must acknowledge the copyright and authors of this work.
.\" .\"
@ -44,12 +44,12 @@
.\" Modified, 27 May 2004, Michael Kerrisk <mtk-manpages@gmx.net> .\" Modified, 27 May 2004, Michael Kerrisk <mtk-manpages@gmx.net>
.\" Added notes on capability requirements .\" Added notes on capability requirements
.\" Modified 2004-12-08, added O_NOATIME after note from Martin Pool .\" Modified 2004-12-08, added O_NOATIME after note from Martin Pool
.\" 2004-12-10, mtk, noted F_GETOWN bug after suggestion from aeb. .\" 2004-12-10, mtk, noted F_GETOWN bug after suggestion from aeb.
.\" 2005-04-08 Jamie Lokier <jamie@shareable.org>, mtk .\" 2005-04-08 Jamie Lokier <jamie@shareable.org>, mtk
.\" Described behaviour of F_SETOWN/F_SETSIG in .\" Described behaviour of F_SETOWN/F_SETSIG in
.\" multi-threaded processes, and generally cleaned .\" multi-threaded processes, and generally cleaned
.\" up the discussion of F_SETOWN. .\" up the discussion of F_SETOWN.
.\" 2005-05-20, Johannes Nicolai <johannes.nicolai@hpi.uni-potsdam.de>, .\" 2005-05-20, Johannes Nicolai <johannes.nicolai@hpi.uni-potsdam.de>,
.\" mtk: Noted F_SETOWN bug for socket file descriptor in Linux 2.4 .\" mtk: Noted F_SETOWN bug for socket file descriptor in Linux 2.4
.\" and earlier. Added text on permissions required to send signal. .\" and earlier. Added text on permissions required to send signal.
.\" .\"
@ -90,7 +90,7 @@ See
for further details. for further details.
.SS "File descriptor flags" .SS "File descriptor flags"
The following commands manipulate the flags associated with The following commands manipulate the flags associated with
a file descriptor. a file descriptor.
Currently, only one such flag is defined: Currently, only one such flag is defined:
.BR FD_CLOEXEC , .BR FD_CLOEXEC ,
the close-on-exec flag. the close-on-exec flag.
@ -114,7 +114,7 @@ initialized by
.\" .BR creat (2), .\" .BR creat (2),
and possibly modified by and possibly modified by
.BR fcntl (2). .BR fcntl (2).
Duplicated file descriptors Duplicated file descriptors
(made with (made with
.BR dup (), .BR dup (),
.BR fcntl (F_DUPFD), .BR fcntl (F_DUPFD),
@ -131,7 +131,7 @@ Read the file status flags.
.B F_SETFL .B F_SETFL
Set the file status flags to the value specified by Set the file status flags to the value specified by
.IR arg . .IR arg .
File access mode File access mode
.RB ( O_RDONLY ", " O_WRONLY ", " O_RDWR ) .RB ( O_RDONLY ", " O_WRONLY ", " O_RDWR )
and file creation flags and file creation flags
(i.e., (i.e.,
@ -140,12 +140,12 @@ in
.I arg .I arg
are ignored. are ignored.
On Linux this command can only change the On Linux this command can only change the
.BR O_APPEND , .BR O_APPEND ,
.BR O_ASYNC , .BR O_ASYNC ,
.BR O_DIRECT , .BR O_DIRECT ,
.BR O_NOATIME , .BR O_NOATIME ,
and and
.BR O_NONBLOCK .BR O_NONBLOCK
flags. flags.
.\" FIXME According to POSIX.1-2001, O_SYNC should also be modifiable .\" FIXME According to POSIX.1-2001, O_SYNC should also be modifiable
.\" via fcntl(2), but currently Linux does not permit this .\" via fcntl(2), but currently Linux does not permit this
@ -322,7 +322,7 @@ Because of the buffering performed by the
library, the use of record locking with routines in that package library, the use of record locking with routines in that package
should be avoided; use should be avoided; use
.BR read (2) .BR read (2)
and and
.BR write (2) .BR write (2)
instead. instead.
.SS "Mandatory locking" .SS "Mandatory locking"
@ -331,9 +331,9 @@ The above record locks may be either advisory or mandatory,
and are advisory by default. and are advisory by default.
Advisory locks are not enforced and are useful only between Advisory locks are not enforced and are useful only between
cooperating processes. cooperating processes.
Mandatory locks are enforced for all processes. Mandatory locks are enforced for all processes.
If a process tries to perform an incompatible access (e.g., If a process tries to perform an incompatible access (e.g.,
.BR read (2) .BR read (2)
or or
@ -342,33 +342,33 @@ on a file region that has an incompatible mandatory lock,
then the result depends upon whether the then the result depends upon whether the
.B O_NONBLOCK .B O_NONBLOCK
flag is enabled for its open file description. flag is enabled for its open file description.
If the If the
.B O_NONBLOCK .B O_NONBLOCK
flag is not enabled, then flag is not enabled, then
system call is blocked until the lock is removed system call is blocked until the lock is removed
or converted to a mode that is compatible with the access. or converted to a mode that is compatible with the access.
If the If the
.B O_NONBLOCK .B O_NONBLOCK
flag is enabled, then the system call fails with the error flag is enabled, then the system call fails with the error
.BR EAGAIN .BR EAGAIN
or or
.BR EWOULDBLOCK. .BR EWOULDBLOCK.
To make use of mandatory locks, mandatory locking must be enabled To make use of mandatory locks, mandatory locking must be enabled
both on the file system that contains the file to be locked, both on the file system that contains the file to be locked,
and on the file itself. and on the file itself.
Mandatory locking is enabled on a file system Mandatory locking is enabled on a file system
using the "\-o mand" option to using the "\-o mand" option to
.BR mount (8), .BR mount (8),
or the or the
.B MS_MANDLOCK .B MS_MANDLOCK
flag for flag for
.BR mount (2). .BR mount (2).
Mandatory locking is enabled on a file by disabling Mandatory locking is enabled on a file by disabling
group execute permission on the file and enabling the set-group-ID group execute permission on the file and enabling the set-group-ID
permission bit (see permission bit (see
.BR chmod (1) .BR chmod (1)
and and
.BR chmod (2)). .BR chmod (2)).
.SS "Managing signals" .SS "Managing signals"
.BR F_GETOWN ", " F_SETOWN ", " F_GETSIG " and " F_SETSIG .BR F_GETOWN ", " F_SETOWN ", " F_GETSIG " and " F_SETSIG
@ -398,8 +398,8 @@ If you set the
.B O_ASYNC .B O_ASYNC
status flag on a file descriptor (either by providing this flag with the status flag on a file descriptor (either by providing this flag with the
.BR open (2) .BR open (2)
.\" FIXME The statement that O_ASYNC can be used in open() does not .\" FIXME The statement that O_ASYNC can be used in open() does not
.\" match reality; setting O_ASYNC via open() does not seem to be .\" match reality; setting O_ASYNC via open() does not seem to be
.\" effective. .\" effective.
.\" See http://bugzilla.kernel.org/show_bug.cgi?id=5993 .\" See http://bugzilla.kernel.org/show_bug.cgi?id=5993
call, or by using the call, or by using the
@ -418,7 +418,7 @@ Sending a signal to the owner process (group) specified by
is subject to the same permissions checks as are described for is subject to the same permissions checks as are described for
.BR kill (2), .BR kill (2),
where the sending process is the one that employs where the sending process is the one that employs
.BR F_SETOWN .BR F_SETOWN
(but see BUGS below). (but see BUGS below).
.sp .sp
If the file descriptor If the file descriptor
@ -427,15 +427,16 @@ refers to a socket,
.B F_SETOWN .B F_SETOWN
also selects also selects
the recipient of SIGURG signals that are delivered when out-of-band the recipient of SIGURG signals that are delivered when out-of-band
data arrives on that socket. (SIGURG is sent in any situation where data arrives on that socket.
(SIGURG is sent in any situation where
.BR select (2) .BR select (2)
would report the socket as having an "exceptional condition".) would report the socket as having an "exceptional condition".)
.\" The following appears to be rubbish. It doesn't seem to .\" The following appears to be rubbish. It doesn't seem to
.\" be true according to the kernel source, and I can write .\" be true according to the kernel source, and I can write
.\" a program that gets a terminal-generated SIGIO even though .\" a program that gets a terminal-generated SIGIO even though
.\" it is not the foreground process group of the terminal. .\" it is not the foreground process group of the terminal.
.\" -- MTK, 8 Apr 05 .\" -- MTK, 8 Apr 05
.\" .\"
.\" If the file descriptor .\" If the file descriptor
.\" .I fd .\" .I fd
.\" refers to a terminal device, then SIGIO .\" refers to a terminal device, then SIGIO
@ -445,10 +446,10 @@ If a non-zero value is given to
.B F_SETSIG .B F_SETSIG
in a multi-threaded process running with a threading library in a multi-threaded process running with a threading library
that supports thread groups (e.g., NPTL), that supports thread groups (e.g., NPTL),
then a positive value given to then a positive value given to
.B F_SETOWN .B F_SETOWN
has a different meaning: has a different meaning:
.\" The relevant place in the (2.6) kernel source is the .\" The relevant place in the (2.6) kernel source is the
.\" 'switch' in fs/fcntl.c::send_sigio_to_task() -- MTK, Apr 2005 .\" 'switch' in fs/fcntl.c::send_sigio_to_task() -- MTK, Apr 2005
instead of being a process ID identifying a whole process, instead of being a process ID identifying a whole process,
it is a thread ID identifying a specific thread within a process. it is a thread ID identifying a specific thread within a process.
@ -473,9 +474,9 @@ to the SIGURG signal generated for out-of-band data on a socket:
this signal is always sent to either a process or a process group, this signal is always sent to either a process or a process group,
depending on the value given to depending on the value given to
.BR F_SETOWN . .BR F_SETOWN .
.\" send_sigurg()/send_sigurg_to_task() bypasses .\" send_sigurg()/send_sigurg_to_task() bypasses
.\" kill_fasync()/send_sigio()/send_sigio_to_task() .\" kill_fasync()/send_sigio()/send_sigio_to_task()
.\" to directly call send_group_sig_info() .\" to directly call send_group_sig_info()
.\" -- MTK, Apr 2005 (kernel 2.6.11) .\" -- MTK, Apr 2005 (kernel 2.6.11)
Note also that Linux imposes a limit on the Note also that Linux imposes a limit on the
number of real-time signals that may be queued to a number of real-time signals that may be queued to a
@ -483,20 +484,22 @@ process (see
.BR getrlimit (2) .BR getrlimit (2)
and and
.BR signal (7)) .BR signal (7))
and if this limit is reached, then the kernel reverts to and if this limit is reached, then the kernel reverts to
delivering SIGIO, and this signal is delivered to the entire delivering SIGIO, and this signal is delivered to the entire
process rather than to a specific thread. process rather than to a specific thread.
.\" See fs/fcntl.c::send_sigio_to_task() (2.4/2.6) sources -- MTK, Apr 05 .\" See fs/fcntl.c::send_sigio_to_task() (2.4/2.6) sources -- MTK, Apr 05
.TP .TP
.B F_GETSIG .B F_GETSIG
Get the signal sent when input or output becomes possible. A value of Get the signal sent when input or output becomes possible.
zero means SIGIO is sent. Any other value (including SIGIO) is the A value of zero means SIGIO is sent.
Any other value (including SIGIO) is the
signal sent instead, and in this case additional info is available to signal sent instead, and in this case additional info is available to
the signal handler if installed with SA_SIGINFO. the signal handler if installed with SA_SIGINFO.
.TP .TP
.B F_SETSIG .B F_SETSIG
Sets the signal sent when input or output becomes possible. A value of Sets the signal sent when input or output becomes possible.
zero means to send the default SIGIO signal. Any other value (including A value of zero means to send the default SIGIO signal.
Any other value (including
SIGIO) is the signal to send instead, and in this case additional info SIGIO) is the signal to send instead, and in this case additional info
is available to the signal handler if installed with SA_SIGINFO. is available to the signal handler if installed with SA_SIGINFO.
.sp .sp
@ -505,7 +508,7 @@ Additionally, passing a non-zero value to
changes the signal recipient from a whole process to a specific thread changes the signal recipient from a whole process to a specific thread
within a process. within a process.
See the description of See the description of
.B F_SETOWN .B F_SETOWN
for more details. for more details.
.sp .sp
By using By using
@ -521,7 +524,8 @@ If the
.I si_code .I si_code
field indicates the source is SI_SIGIO, the field indicates the source is SI_SIGIO, the
.I si_fd .I si_fd
field gives the file descriptor associated with the event. Otherwise, field gives the file descriptor associated with the event.
Otherwise,
there is no indication which file descriptors are pending, and you there is no indication which file descriptors are pending, and you
should use the usual mechanisms should use the usual mechanisms
.RB ( select (2), .RB ( select (2),
@ -532,8 +536,9 @@ with
set etc.) to determine which file descriptors are available for I/O. set etc.) to determine which file descriptors are available for I/O.
.sp .sp
By selecting a real time signal (value >= SIGRTMIN), multiple By selecting a real time signal (value >= SIGRTMIN), multiple
I/O events may be queued using the same signal numbers. (Queuing is I/O events may be queued using the same signal numbers.
dependent on available memory). Extra information is available (Queuing is dependent on available memory).
Extra information is available
if SA_SIGINFO is set for the signal handler, as above. if SA_SIGINFO is set for the signal handler, as above.
.PP .PP
Using these mechanisms, a program can implement fully asynchronous I/O Using these mechanisms, a program can implement fully asynchronous I/O
@ -551,7 +556,8 @@ is specific to BSD and Linux.
.B F_GETSIG .B F_GETSIG
and and
.B F_SETSIG .B F_SETSIG
are Linux specific. POSIX has asynchronous I/O and the are Linux specific.
POSIX has asynchronous I/O and the
.I aio_sigevent .I aio_sigevent
structure to achieve similar things; these are also available structure to achieve similar things; these are also available
in Linux as part of the GNU C Library (Glibc). in Linux as part of the GNU C Library (Glibc).
@ -583,12 +589,12 @@ This will cause the calling process to be notified when
the file is opened for writing or is truncated. the file is opened for writing or is truncated.
.\" The following became true in kernel 2.6.10: .\" The following became true in kernel 2.6.10:
.\" See the man-pages-2.09 Changelog for further info. .\" See the man-pages-2.09 Changelog for further info.
A read lease can only be placed on a file descriptor that A read lease can only be placed on a file descriptor that
is opened read-only. is opened read-only.
.TP .TP
.B F_WRLCK .B F_WRLCK
Take out a write lease. Take out a write lease.
This will cause the caller to be notified when This will cause the caller to be notified when
the file is opened for reading or writing or is truncated. the file is opened for reading or writing or is truncated.
A write lease may be placed on a file only if no other process A write lease may be placed on a file only if no other process
currently has the file open. currently has the file open.
@ -657,24 +663,24 @@ and assuming the lease breaker has not unblocked its system call,
the kernel permits the lease breaker's system call to proceed. the kernel permits the lease breaker's system call to proceed.
If the lease breaker's blocked If the lease breaker's blocked
.BR open () .BR open ()
or or
.BR truncate () .BR truncate ()
is interrupted by a signal handler, is interrupted by a signal handler,
then the system call fails with the error then the system call fails with the error
.BR EINTR , .BR EINTR ,
but the other steps still occur as described above. but the other steps still occur as described above.
If the lease breaker is killed by a signal while blocked in If the lease breaker is killed by a signal while blocked in
.BR open () .BR open ()
or or
.BR truncate (), .BR truncate (),
then the other steps still occur as described above. then the other steps still occur as described above.
If the lease breaker specifies the If the lease breaker specifies the
.B O_NONBLOCK .B O_NONBLOCK
flag when calling flag when calling
.BR open (), .BR open (),
then the call immediately fails with the error then the call immediately fails with the error
.BR EWOULDBLOCK , .BR EWOULDBLOCK ,
but the other steps still occur as described above. but the other steps still occur as described above.
The default signal used to notify the lease holder is SIGIO, The default signal used to notify the lease holder is SIGIO,
@ -722,7 +728,7 @@ DN_ATTRIB The attributes of a file were changed
(chown, chmod, utime[s]) (chown, chmod, utime[s])
.TE .TE
.sp .sp
(In order to obtain these definitions, the _GNU_SOURCE feature test macro (In order to obtain these definitions, the _GNU_SOURCE feature test macro
must be defined.) must be defined.)
.sp .sp
Directory notifications are normally "one-shot", and the application Directory notifications are normally "one-shot", and the application
@ -766,10 +772,11 @@ so that multiple notifications can be queued.
.B NOTE: .B NOTE:
New applications should consider using the New applications should consider using the
.I inotify .I inotify
interface (available since kernel 2.6.13), interface (available since kernel 2.6.13),
which provides a superior interface for obtaining notifications of which provides a superior interface for obtaining notifications of
file system events. See file system events.
See
.BR inotify (7). .BR inotify (7).
.SH "RETURN VALUE" .SH "RETURN VALUE"
For a successful call, the return value depends on the operation: For a successful call, the return value depends on the operation:
@ -830,14 +837,16 @@ the command was interrupted by a signal.
For For
.BR F_GETLK " and " F_SETLK , .BR F_GETLK " and " F_SETLK ,
the command was interrupted by a signal before the lock was checked or the command was interrupted by a signal before the lock was checked or
acquired. Most likely when locking a remote file (e.g. locking over acquired.
Most likely when locking a remote file (e.g. locking over
NFS), but can sometimes happen locally. NFS), but can sometimes happen locally.
.TP .TP
.B EINVAL .B EINVAL
For For
.BR F_DUPFD , .BR F_DUPFD ,
.I arg .I arg
is negative or is greater than the maximum allowable value. For is negative or is greater than the maximum allowable value.
For
.BR F_SETSIG , .BR F_SETSIG ,
.I arg .I arg
is not an allowable signal number. is not an allowable signal number.
@ -869,7 +878,8 @@ and
POSIX.1-2001 allows POSIX.1-2001 allows
.I l_len .I l_len
to be negative. (And if it is, the interval described by the lock to be negative.
(And if it is, the interval described by the lock
covers bytes covers bytes
.IR l_start + l_len .IR l_start + l_len
up to and including up to and including
@ -907,7 +917,7 @@ In Linux 2.4 and earlier, there is bug that can occur
when an unprivileged process uses when an unprivileged process uses
.B F_SETOWN .B F_SETOWN
to specify the owner to specify the owner
of a socket file descriptor of a socket file descriptor
as a process (group) other than the caller. as a process (group) other than the caller.
In this case, In this case,
.BR fcntl () .BR fcntl ()
@ -920,9 +930,9 @@ has permission to send signals to.
Despite this error return, the file descriptor owner is set, Despite this error return, the file descriptor owner is set,
and signals will be sent to the owner. and signals will be sent to the owner.
.SH "CONFORMING TO" .SH "CONFORMING TO"
SVr4, 4.3BSD, POSIX.1-2001. SVr4, 4.3BSD, POSIX.1-2001.
Only the operations F_DUPFD, Only the operations F_DUPFD,
F_GETFD, F_SETFD, F_GETFL, F_SETFL, F_GETLK, F_SETLK, F_SETLKW, F_GETFD, F_SETFD, F_GETFL, F_SETFL, F_GETLK, F_SETLK, F_SETLKW,
F_GETOWN, and F_SETOWN are specified in POSIX.1-2001. F_GETOWN, and F_SETOWN are specified in POSIX.1-2001.
F_GETSIG, F_SETSIG, F_NOTIFY, F_GETLEASE, and F_SETLEASE F_GETSIG, F_SETSIG, F_NOTIFY, F_GETLEASE, and F_SETLEASE

View File

@ -13,7 +13,7 @@
.\" manual under the conditions for verbatim copying, provided that the .\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a .\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one. .\" permission notice identical to this one.
.\" .\"
.\" Since the Linux kernel and libraries are constantly changing, this .\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no .\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" responsibility for errors or omissions, or for damages resulting from .\" responsibility for errors or omissions, or for damages resulting from
@ -21,7 +21,7 @@
.\" have taken the same level of care in the production of this manual, .\" have taken the same level of care in the production of this manual,
.\" which is licensed free of charge, as they might when working .\" which is licensed free of charge, as they might when working
.\" professionally. .\" professionally.
.\" .\"
.\" Formatted or processed versions of this manual, if unaccompanied by .\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work. .\" the source, must acknowledge the copyright and authors of this work.
.\" .\"
@ -38,7 +38,8 @@ fdatasync \- synchronize a file's in-core data with that on disk
.SH DESCRIPTION .SH DESCRIPTION
.BR fdatasync () .BR fdatasync ()
flushes all data buffers of a file to disk (before the system flushes all data buffers of a file to disk (before the system
call returns). It resembles call returns).
It resembles
.BR fsync () .BR fsync ()
but is not required to update the metadata such as access time. but is not required to update the metadata such as access time.
@ -46,16 +47,19 @@ Applications that access databases or log files often write a tiny
data fragment (e.g., one line in a log file) and then call data fragment (e.g., one line in a log file) and then call
.BR fsync () .BR fsync ()
immediately in order to ensure that the written data is physically immediately in order to ensure that the written data is physically
stored on the harddisk. Unfortunately, stored on the harddisk.
Unfortunately,
.BR fsync () .BR fsync ()
will always initiate two write operations: one for the newly written will always initiate two write operations: one for the newly written
data and another one in order to update the modification time stored data and another one in order to update the modification time stored
in the inode. If the modification time is not a part of the transaction in the inode.
If the modification time is not a part of the transaction
concept concept
.BR fdatasync () .BR fdatasync ()
can be used to avoid unnecessary inode disk write operations. can be used to avoid unnecessary inode disk write operations.
.SH "RETURN VALUE" .SH "RETURN VALUE"
On success, zero is returned. On error, \-1 is returned, and On success, zero is returned.
On error, \-1 is returned, and
.I errno .I errno
is set appropriately. is set appropriately.
.SH ERRORS .SH ERRORS

View File

@ -1,6 +1,6 @@
.\" Hey Emacs! This file is -*- nroff -*- source. .\" Hey Emacs! This file is -*- nroff -*- source.
.\" .\"
.\" Copyright 1993 Rickard E. Faith (faith@cs.unc.edu) and .\" Copyright 1993 Rickard E. Faith (faith@cs.unc.edu) and
.\" and Copyright 2002 Michael Kerrisk .\" and Copyright 2002 Michael Kerrisk
.\" .\"
.\" Permission is granted to make and distribute verbatim copies of this .\" Permission is granted to make and distribute verbatim copies of this
@ -11,7 +11,7 @@
.\" manual under the conditions for verbatim copying, provided that the .\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a .\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one. .\" permission notice identical to this one.
.\" .\"
.\" Since the Linux kernel and libraries are constantly changing, this .\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no .\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" responsibility for errors or omissions, or for damages resulting from .\" responsibility for errors or omissions, or for damages resulting from
@ -19,7 +19,7 @@
.\" have taken the same level of care in the production of this manual, .\" have taken the same level of care in the production of this manual,
.\" which is licensed free of charge, as they might when working .\" which is licensed free of charge, as they might when working
.\" professionally. .\" professionally.
.\" .\"
.\" Formatted or processed versions of this manual, if unaccompanied by .\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work. .\" the source, must acknowledge the copyright and authors of this work.
.\" .\"
@ -73,7 +73,7 @@ Locks created by
.BR flock () .BR flock ()
are associated with an open file table entry. are associated with an open file table entry.
This means that duplicate file descriptors (created by, for example, This means that duplicate file descriptors (created by, for example,
.BR fork (2) .BR fork (2)
or or
.BR dup (2)) .BR dup (2))
refer to the same lock, and this lock may be modified refer to the same lock, and this lock may be modified
@ -107,7 +107,8 @@ are preserved across an
A shared or exclusive lock can be placed on a file regardless of the A shared or exclusive lock can be placed on a file regardless of the
mode in which the file was opened. mode in which the file was opened.
.SH "RETURN VALUE" .SH "RETURN VALUE"
On success, zero is returned. On error, \-1 is returned, and On success, zero is returned.
On error, \-1 is returned, and
.I errno .I errno
is set appropriately. is set appropriately.
.SH ERRORS .SH ERRORS
@ -142,7 +143,8 @@ possibly implemented in terms of
appears on most Unix systems. appears on most Unix systems.
.SH NOTES .SH NOTES
.BR flock (2) .BR flock (2)
does not lock files over NFS. Use does not lock files over NFS.
Use
.BR fcntl (2) .BR fcntl (2)
instead: that does work over NFS, given a sufficiently recent version of instead: that does work over NFS, given a sufficiently recent version of
Linux and a server which supports locking. Linux and a server which supports locking.
@ -186,7 +188,7 @@ Converting a lock
the existing lock is first removed, and then a new lock is established. the existing lock is first removed, and then a new lock is established.
Between these two steps, Between these two steps,
a pending lock request by another process may be granted, a pending lock request by another process may be granted,
with the result that the conversion either blocks, or fails if with the result that the conversion either blocks, or fails if
.B LOCK_NB .B LOCK_NB
was specified. was specified.
(This is the original BSD behaviour, (This is the original BSD behaviour,

View File

@ -12,7 +12,7 @@
.\" manual under the conditions for verbatim copying, provided that the .\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a .\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one. .\" permission notice identical to this one.
.\" .\"
.\" Since the Linux kernel and libraries are constantly changing, this .\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no .\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" responsibility for errors or omissions, or for damages resulting from .\" responsibility for errors or omissions, or for damages resulting from
@ -20,7 +20,7 @@
.\" have taken the same level of care in the production of this manual, .\" have taken the same level of care in the production of this manual,
.\" which is licensed free of charge, as they might when working .\" which is licensed free of charge, as they might when working
.\" professionally. .\" professionally.
.\" .\"
.\" Formatted or processed versions of this manual, if unaccompanied by .\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work. .\" the source, must acknowledge the copyright and authors of this work.
.\" .\"
@ -48,8 +48,8 @@ fork \- create a child process
.SH DESCRIPTION .SH DESCRIPTION
.BR fork () .BR fork ()
creates a new process by duplicating the calling process. creates a new process by duplicating the calling process.
The new process, referred to as the \fIchild\fP, The new process, referred to as the \fIchild\fP,
is an exact duplicate of the calling process, is an exact duplicate of the calling process,
referred to as the \fIparent\fP, except for the following points: referred to as the \fIparent\fP, except for the following points:
.IP * 4 .IP * 4
The child has its own unique process ID, The child has its own unique process ID,
@ -62,7 +62,7 @@ The child does not inherit its parent's memory locks
.RB ( mlock (2), .RB ( mlock (2),
.BR mlockall (2)). .BR mlockall (2)).
.IP * 4 .IP * 4
Process resource utilisations Process resource utilisations
.RB ( getrusage (2)) .RB ( getrusage (2))
and CPU time counters and CPU time counters
.RB ( times (2)) .RB ( times (2))
@ -82,30 +82,30 @@ The parent does not inherit timers from its parent
.BR alarm (3), .BR alarm (3),
.BR timer_create (3)). .BR timer_create (3)).
.IP * 4 .IP * 4
The child does not inherit outstanding asynchronous I/O operations The child does not inherit outstanding asynchronous I/O operations
from its parent from its parent
.RB ( aio_read (3), .RB ( aio_read (3),
.BR aio_write (3)). .BR aio_write (3)).
.PP .PP
The process attributes in the preceding list are all specified The process attributes in the preceding list are all specified
in POSIX.1-2001. in POSIX.1-2001.
The parent and child also differ with respect to the following The parent and child also differ with respect to the following
Linux-specific process attributes: Linux-specific process attributes:
.IP * 4 .IP * 4
The child does not inherit directory change notifications (dnotify) The child does not inherit directory change notifications (dnotify)
from its parent from its parent
(see the description of (see the description of
.B F_NOTIFY .B F_NOTIFY
in in
.BR fcntl (2)). .BR fcntl (2)).
.IP * 4 .IP * 4
The The
.BR prctl (2) .BR prctl (2)
.B PR_SET_PDEATHSIG .B PR_SET_PDEATHSIG
setting is reset so that the child does not receive a signal setting is reset so that the child does not receive a signal
when its parent terminates. when its parent terminates.
.IP * 4 .IP * 4
Memory mappings that have been marked with the Memory mappings that have been marked with the
.BR madvise (2) .BR madvise (2)
.B MADV_DONTFORK .B MADV_DONTFORK
flag are not inherited across a flag are not inherited across a
@ -117,42 +117,42 @@ The termination signal of the child is always SIGCHLD
.PP .PP
Note the following further points: Note the following further points:
.IP * 4 .IP * 4
The child process is created with a single thread \(em the The child process is created with a single thread \(em the
one that called one that called
.BR fork (2). .BR fork (2).
The entire virtual address space of the parent is replicated in the child, The entire virtual address space of the parent is replicated in the child,
including the states of mutexes, condition variables, including the states of mutexes, condition variables,
and other pthreads objects; the use of and other pthreads objects; the use of
.BR pthread_atfork (3) .BR pthread_atfork (3)
may be helpful for dealing with problems that this can cause. may be helpful for dealing with problems that this can cause.
.IP * 4 .IP * 4
The child inherits copies of the parent's set of open file descriptors. The child inherits copies of the parent's set of open file descriptors.
Each file descriptor in the child refers to the same Each file descriptor in the child refers to the same
open file description (see open file description (see
.BR open (2)) .BR open (2))
as the corresponding file descriptor in the parent. as the corresponding file descriptor in the parent.
This means that the two descriptors share open file status flags, This means that the two descriptors share open file status flags,
current file offset, current file offset,
and signal-driven I/O attributes (see the description of and signal-driven I/O attributes (see the description of
.B F_SETOWN .B F_SETOWN
and and
.B F_SETSIG .B F_SETSIG
in in
.BR fcntl (2)). .BR fcntl (2)).
.IP * 4 .IP * 4
The child inherits copies of the parent's set of open message The child inherits copies of the parent's set of open message
queue descriptors (see queue descriptors (see
.BR mq_overview (7)). .BR mq_overview (7)).
Each descriptor in the child refers to the same Each descriptor in the child refers to the same
open message queue description open message queue description
as the corresponding descriptor in the parent. as the corresponding descriptor in the parent.
This means that the two descriptors share the same flags This means that the two descriptors share the same flags
.RI ( mq_flags ). .RI ( mq_flags ).
.SH "RETURN VALUE" .SH "RETURN VALUE"
On success, the PID of the child process is returned in the parent's thread On success, the PID of the child process is returned in the parent's thread
of execution, and a 0 is returned in the child's thread of execution. On of execution, and a 0 is returned in the child's thread of execution.
failure, a \-1 will be returned in the parent's context, no child process On failure, a \-1 will be returned in the parent's context,
will be created, and no child process will be created, and
.I errno .I errno
will be set appropriately. will be set appropriately.
.SH ERRORS .SH ERRORS

View File

@ -10,7 +10,7 @@
.\" manual under the conditions for verbatim copying, provided that the .\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a .\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one. .\" permission notice identical to this one.
.\" .\"
.\" Since the Linux kernel and libraries are constantly changing, this .\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no .\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" responsibility for errors or omissions, or for damages resulting from .\" responsibility for errors or omissions, or for damages resulting from
@ -18,7 +18,7 @@
.\" have taken the same level of care in the production of this manual, .\" have taken the same level of care in the production of this manual,
.\" which is licensed free of charge, as they might when working .\" which is licensed free of charge, as they might when working
.\" professionally. .\" professionally.
.\" .\"
.\" Formatted or processed versions of this manual, if unaccompanied by .\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work. .\" the source, must acknowledge the copyright and authors of this work.
.\" .\"
@ -32,7 +32,7 @@ fstatat \- get file status relative to a directory file descriptor
.B #include <sys/stat.h> .B #include <sys/stat.h>
.sp .sp
.BI "int fstatat(int " dirfd ", const char *" pathname ", struct stat *" \ .BI "int fstatat(int " dirfd ", const char *" pathname ", struct stat *" \
buf , buf ,
.BI " int " flags ); .BI " int " flags );
.fi .fi
.SH DESCRIPTION .SH DESCRIPTION
@ -42,51 +42,51 @@ system call operates in exactly the same way as
.BR stat (2), .BR stat (2),
except for the differences described in this manual page. except for the differences described in this manual page.
If the pathname given in If the pathname given in
.I pathname .I pathname
is relative, then it is interpreted relative to the directory is relative, then it is interpreted relative to the directory
referred to by the file descriptor referred to by the file descriptor
.IR dirfd .IR dirfd
(rather than relative to the current working directory of (rather than relative to the current working directory of
the calling process, as is done by the calling process, as is done by
.BR stat (2) .BR stat (2)
for a relative pathname). for a relative pathname).
If If
.I pathname .I pathname
is relative and is relative and
.I dirfd .I dirfd
is the special value is the special value
.BR AT_FDCWD , .BR AT_FDCWD ,
then then
.I pathname .I pathname
is interpreted relative to the current working is interpreted relative to the current working
directory of the calling process (like directory of the calling process (like
.BR stat (2)). .BR stat (2)).
If If
.IR pathname .IR pathname
is absolute, then is absolute, then
.I dirfd .I dirfd
is ignored. is ignored.
.I flags .I flags
can either be 0, or include the following flag: can either be 0, or include the following flag:
.TP .TP
.B AT_SYMLINK_NOFOLLOW .B AT_SYMLINK_NOFOLLOW
If If
.I pathname .I pathname
is a symbolic link, do not dereference it: is a symbolic link, do not dereference it:
instead return information about the link itself, like instead return information about the link itself, like
.BR lstat (2). .BR lstat (2).
(By default, (By default,
.BR fstatat () .BR fstatat ()
dereferences symbolic links, like dereferences symbolic links, like
.BR stat (2).) .BR stat (2).)
.SH "RETURN VALUE" .SH "RETURN VALUE"
On success, On success,
.BR fstatat () .BR fstatat ()
returns 0. returns 0.
On error, \-1 is returned and On error, \-1 is returned and
.I errno .I errno
is set to indicate the error. is set to indicate the error.
@ -95,7 +95,7 @@ The same errors that occur for
.BR stat (2) .BR stat (2)
can also occur for can also occur for
.BR fstatat (). .BR fstatat ().
The following additional errors can occur for The following additional errors can occur for
.BR fstatat (): .BR fstatat ():
.TP .TP
.B EBADF .B EBADF

View File

@ -11,7 +11,7 @@
.\" manual under the conditions for verbatim copying, provided that the .\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a .\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one. .\" permission notice identical to this one.
.\" .\"
.\" Since the Linux kernel and libraries are constantly changing, this .\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no .\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" responsibility for errors or omissions, or for damages resulting from .\" responsibility for errors or omissions, or for damages resulting from
@ -19,7 +19,7 @@
.\" have taken the same level of care in the production of this manual, .\" have taken the same level of care in the production of this manual,
.\" which is licensed free of charge, as they might when working .\" which is licensed free of charge, as they might when working
.\" professionally. .\" professionally.
.\" .\"
.\" Formatted or processed versions of this manual, if unaccompanied by .\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work. .\" the source, must acknowledge the copyright and authors of this work.
.\" .\"
@ -45,15 +45,15 @@ fsync, fdatasync \- synchronize a file's in-core state with storage device
.BI "int fdatasync(int " fd ); .BI "int fdatasync(int " fd );
.SH DESCRIPTION .SH DESCRIPTION
.BR fsync () .BR fsync ()
transfers ("flushes") all modified in-core data of transfers ("flushes") all modified in-core data of
(i.e., modified buffer cache pages for) the (i.e., modified buffer cache pages for) the
file referred to by the file descriptor file referred to by the file descriptor
.I fd .I fd
to the disk device (or other permanent storage device) to the disk device (or other permanent storage device)
where that file resides. where that file resides.
The call blocks until the device reports that the transfer has completed. The call blocks until the device reports that the transfer has completed.
It also flushes metadata information associated with the file (see It also flushes metadata information associated with the file (see
.BR stat (2)). .BR stat (2)).
Calling Calling
.BR fsync () .BR fsync ()
@ -64,18 +64,18 @@ For that an explicit
on a file descriptor for the directory is also needed. on a file descriptor for the directory is also needed.
.BR fdatasync () .BR fdatasync ()
is similar to is similar to
.BR fsync (), .BR fsync (),
but does not flush modified metadata unless that metadata but does not flush modified metadata unless that metadata
is needed in order to allow a subsequent data retrieval to be is needed in order to allow a subsequent data retrieval to be
correctly handled. correctly handled.
For example, changes to For example, changes to
.I st_atime .I st_atime
or or
.I st_mtime .I st_mtime
(respectively, time of last access and (respectively, time of last access and
time of last modification; see time of last modification; see
.BR stat (2)) .BR stat (2))
do not require flushing because they are not necessary for do not require flushing because they are not necessary for
a subsequent data read to be handled correctly. a subsequent data read to be handled correctly.
On the other hand, a change to the file size On the other hand, a change to the file size
@ -89,7 +89,8 @@ The aim of
is to reduce disk activity for applications that do not is to reduce disk activity for applications that do not
require all metadata to be synchronised with the disk. require all metadata to be synchronised with the disk.
.SH "RETURN VALUE" .SH "RETURN VALUE"
On success, zero is returned. On error, \-1 is returned, and On success, zero is returned.
On error, \-1 is returned, and
.I errno .I errno
is set appropriately. is set appropriately.
.SH ERRORS .SH ERRORS
@ -107,8 +108,8 @@ is bound to a special file which does not support synchronization.
.SH NOTES .SH NOTES
If the underlying hard disk has write caching enabled, then If the underlying hard disk has write caching enabled, then
the data may not really be on permanent storage when the data may not really be on permanent storage when
.BR fsync () .BR fsync ()
/ /
.BR fdatasync () .BR fdatasync ()
return. return.
.\" See .\" See

View File

@ -7,8 +7,8 @@
.\" Modified 2004-10-07 aeb, added FUTEX_REQUEUE, FUTEX_CMP_REQUEUE .\" Modified 2004-10-07 aeb, added FUTEX_REQUEUE, FUTEX_CMP_REQUEUE
.\" .\"
.\" FIXME .\" FIXME
.\" 2.6.18 adds (Ingo Molnar) priority inheritance support: .\" 2.6.18 adds (Ingo Molnar) priority inheritance support:
.\" FUTEX_LOCK_PI, FUTEX_UNLOCK_PI, and FUTEX_TRYLOCK_PI. These need .\" FUTEX_LOCK_PI, FUTEX_UNLOCK_PI, and FUTEX_TRYLOCK_PI. These need
.\" to be documented in the manual page. Probably there is sufficient .\" to be documented in the manual page. Probably there is sufficient
.\" material in the kernel source file Documentation/pi-futex.txt. .\" material in the kernel source file Documentation/pi-futex.txt.
.\" .\"
@ -38,15 +38,17 @@ addresses for the same memory in separate processes may not be
equal, the kernel maps them internally so the same memory mapped in equal, the kernel maps them internally so the same memory mapped in
different locations will correspond for different locations will correspond for
.BR futex () .BR futex ()
calls). It is typically used to calls).
It is typically used to
implement the contended case of a lock in shared memory, as implement the contended case of a lock in shared memory, as
described in described in
.BR futex (7). .BR futex (7).
.PP .PP
When a When a
.BR futex (7) .BR futex (7)
operation did not finish uncontended in userspace, a call needs to be made operation did not finish uncontended in userspace, a call needs to be made
to the kernel to arbitrate. Arbitration can either mean putting the calling to the kernel to arbitrate.
Arbitration can either mean putting the calling
process to sleep or, conversely, waking a waiting process. process to sleep or, conversely, waking a waiting process.
.PP .PP
Callers of this function are expected to adhere to the semantics as set out in Callers of this function are expected to adhere to the semantics as set out in
@ -71,10 +73,12 @@ This operation atomically verifies that the futex address
.I uaddr .I uaddr
still contains the value still contains the value
.IR val , .IR val ,
and sleeps awaiting FUTEX_WAKE on this futex address. If the and sleeps awaiting FUTEX_WAKE on this futex address.
If the
.I timeout .I timeout
argument is non-NULL, its contents describe the maximum argument is non-NULL, its contents describe the maximum
duration of the wait, which is infinite otherwise. The arguments duration of the wait, which is infinite otherwise.
The arguments
.I uaddr2 .I uaddr2
and and
.I val3 .I val3
@ -84,7 +88,7 @@ For
.BR futex (7), .BR futex (7),
this call is executed if decrementing the count gave a negative value this call is executed if decrementing the count gave a negative value
(indicating contention), and will sleep until another process releases (indicating contention), and will sleep until another process releases
the futex and executes the FUTEX_WAKE operation. the futex and executes the FUTEX_WAKE operation.
.TP .TP
.B FUTEX_WAKE .B FUTEX_WAKE
This operation wakes at most \fIval\fR This operation wakes at most \fIval\fR
@ -117,7 +121,7 @@ and
.I val3 .I val3
are ignored. are ignored.
To prevent race conditions, the caller should test if the futex has To prevent race conditions, the caller should test if the futex has
been upped after FUTEX_FD returns. been upped after FUTEX_FD returns.
.\" FIXME . Check that this flag does eventually get removed. .\" FIXME . Check that this flag does eventually get removed.
@ -127,7 +131,8 @@ in June 2007; any applications that use it should be fixed now.
.BR FUTEX_REQUEUE " (since Linux 2.5.70)" .BR FUTEX_REQUEUE " (since Linux 2.5.70)"
This operation was introduced in order to avoid a "thundering herd" effect This operation was introduced in order to avoid a "thundering herd" effect
when FUTEX_WAKE is used and all processes woken up need to acquire another when FUTEX_WAKE is used and all processes woken up need to acquire another
futex. This call wakes up futex.
This call wakes up
.I val .I val
processes, and requeues all other waiters on the futex at address processes, and requeues all other waiters on the futex at address
.IR uaddr2 . .IR uaddr2 .
@ -139,7 +144,8 @@ are ignored.
.TP .TP
.BR FUTEX_CMP_REQUEUE " (since Linux 2.6.7)" .BR FUTEX_CMP_REQUEUE " (since Linux 2.6.7)"
There was a race in the intended use of FUTEX_REQUEUE, so There was a race in the intended use of FUTEX_REQUEUE, so
FUTEX_CMP_REQUEUE was introduced. This is similar to FUTEX_REQUEUE, FUTEX_CMP_REQUEUE was introduced.
This is similar to FUTEX_REQUEUE,
but first checks whether the location but first checks whether the location
.I uaddr .I uaddr
still contains the value still contains the value
@ -154,9 +160,12 @@ Depending on which operation was executed, the returned value can have
differing meanings. differing meanings.
.TP .TP
.B FUTEX_WAIT .B FUTEX_WAIT
Returns 0 if the process was woken by a FUTEX_WAKE call. In case of timeout, Returns 0 if the process was woken by a FUTEX_WAKE call.
ETIMEDOUT is returned. If the futex was not equal to the expected value, In case of timeout,
the operation returns EWOULDBLOCK. Signals (or other spurious wakeups) ETIMEDOUT is returned.
If the futex was not equal to the expected value,
the operation returns EWOULDBLOCK.
Signals (or other spurious wakeups)
cause FUTEX_WAIT to return EINTR. cause FUTEX_WAIT to return EINTR.
.TP .TP
.B FUTEX_WAKE .B FUTEX_WAKE
@ -193,7 +202,8 @@ The system limit on the total number of open files has been reached.
.SH "NOTES" .SH "NOTES"
.PP .PP
To reiterate, bare futexes are not intended as an easy to use abstraction To reiterate, bare futexes are not intended as an easy to use abstraction
for end-users. Implementors are expected to be assembly literate and to have for end-users.
Implementors are expected to be assembly literate and to have
read the sources of the futex userspace library referenced below. read the sources of the futex userspace library referenced below.
.\" .SH "AUTHORS" .\" .SH "AUTHORS"
.\" .PP .\" .PP
@ -205,16 +215,19 @@ read the sources of the futex userspace library referenced below.
.SH "VERSIONS" .SH "VERSIONS"
.PP .PP
Initial futex support was merged in Linux 2.5.7 but with different semantics Initial futex support was merged in Linux 2.5.7 but with different semantics
from what was described above. A 4-parameter system call with the semantics from what was described above.
given here was introduced in Linux 2.5.40. In Linux 2.5.70 one parameter A 4-parameter system call with the semantics
was added. In Linux 2.6.7 a sixth parameter was added \(em messy, especially given here was introduced in Linux 2.5.40.
In Linux 2.5.70 one parameter
was added.
In Linux 2.6.7 a sixth parameter was added \(em messy, especially
on the s390 architecture. on the s390 architecture.
.SH "CONFORMING TO" .SH "CONFORMING TO"
This system call is Linux specific. This system call is Linux specific.
.SH "SEE ALSO" .SH "SEE ALSO"
.PP .PP
.BR futex (7), .BR futex (7),
`Fuss, Futexes and Furwocks: Fast Userlevel Locking in Linux' `Fuss, Futexes and Furwocks: Fast Userlevel Locking in Linux'
(proceedings of the Ottawa Linux Symposium 2002), (proceedings of the Ottawa Linux Symposium 2002),
futex example library, futex-*.tar.bz2 futex example library, futex-*.tar.bz2
<URL:ftp://ftp.nl.kernel.org:/pub/linux/kernel/people/rusty/>. <URL:ftp://ftp.nl.kernel.org:/pub/linux/kernel/people/rusty/>.

View File

@ -10,7 +10,7 @@
.\" manual under the conditions for verbatim copying, provided that the .\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a .\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one. .\" permission notice identical to this one.
.\" .\"
.\" Since the Linux kernel and libraries are constantly changing, this .\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no .\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" responsibility for errors or omissions, or for damages resulting from .\" responsibility for errors or omissions, or for damages resulting from
@ -18,7 +18,7 @@
.\" have taken the same level of care in the production of this manual, .\" have taken the same level of care in the production of this manual,
.\" which is licensed free of charge, as they might when working .\" which is licensed free of charge, as they might when working
.\" professionally. .\" professionally.
.\" .\"
.\" Formatted or processed versions of this manual, if unaccompanied by .\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work. .\" the source, must acknowledge the copyright and authors of this work.
.\" .\"
@ -32,7 +32,7 @@ directory file descriptor
.B #define _ATFILE_SOURCE .B #define _ATFILE_SOURCE
.B #include <fcntl.h> .B #include <fcntl.h>
.sp .sp
.BI "int futimesat(int " dirfd ", const char *" pathname , .BI "int futimesat(int " dirfd ", const char *" pathname ,
.BI " const struct timeval " times [2]); .BI " const struct timeval " times [2]);
.fi .fi
.SH DESCRIPTION .SH DESCRIPTION
@ -42,36 +42,36 @@ system call operates in exactly the same way as
.BR utimes (2), .BR utimes (2),
except for the differences described in this manual page. except for the differences described in this manual page.
If the pathname given in If the pathname given in
.I pathname .I pathname
is relative, then it is interpreted relative to the directory is relative, then it is interpreted relative to the directory
referred to by the file descriptor referred to by the file descriptor
.IR dirfd .IR dirfd
(rather than relative to the current working directory of (rather than relative to the current working directory of
the calling process, as is done by the calling process, as is done by
.BR utimes (2) .BR utimes (2)
for a relative pathname). for a relative pathname).
If If
.I pathname .I pathname
is relative and is relative and
.I dirfd .I dirfd
is the special value is the special value
.BR AT_FDCWD , .BR AT_FDCWD ,
then then
.I pathname .I pathname
is interpreted relative to the current working is interpreted relative to the current working
directory of the calling process (like directory of the calling process (like
.BR utimes (2)). .BR utimes (2)).
If If
.IR pathname .IR pathname
is absolute, then is absolute, then
.I dirfd .I dirfd
is ignored. is ignored.
.SH "RETURN VALUE" .SH "RETURN VALUE"
On success, On success,
.BR futimesat () .BR futimesat ()
returns a 0. returns a 0.
On error, \-1 is returned and On error, \-1 is returned and
.I errno .I errno
@ -81,7 +81,7 @@ The same errors that occur for
.BR utimes (2) .BR utimes (2)
can also occur for can also occur for
.BR futimesat (). .BR futimesat ().
The following additional errors can occur for The following additional errors can occur for
.BR futimesat (): .BR futimesat ():
.TP .TP
.B EBADF .B EBADF
@ -100,7 +100,7 @@ A similar system call exists on Solaris.
.SH GLIBC NOTES .SH GLIBC NOTES
If If
.I pathname .I pathname
is NULL, then the glibc is NULL, then the glibc
.BR futimes () .BR futimes ()
wrapper function updates the times for the file referred to by wrapper function updates the times for the file referred to by
.IR dirfd . .IR dirfd .

View File

@ -2,7 +2,7 @@
.\" This file is distributed according to the GNU General Public License. .\" This file is distributed according to the GNU General Public License.
.\" See the file COPYING in the top level source directory for details. .\" See the file COPYING in the top level source directory for details.
.\" .\"
.\" 2006-02-09, some reformatting by Luc Van Oostenryck; some .\" 2006-02-09, some reformatting by Luc Van Oostenryck; some
.\" reformatting and rewordings by mtk .\" reformatting and rewordings by mtk
.\" .\"
.TH GET_KERNEL_SYMS 2 "2002" Linux "Linux Module Support" .TH GET_KERNEL_SYMS 2 "2002" Linux "Linux Module Support"
@ -38,11 +38,11 @@ The value associated with a symbol of this form is the address at
which the module is loaded. which the module is loaded.
.PP .PP
The symbols exported from each module follow their magic module tag The symbols exported from each module follow their magic module tag
and the modules are returned in the reverse of the and the modules are returned in the reverse of the
order in which they were loaded. order in which they were loaded.
.SH "RETURN VALUE" .SH "RETURN VALUE"
Returns the number of symbols copied to Returns the number of symbols copied to
.IR table . .IR table .
There is no possible error return. There is no possible error return.
.SH "CONFORMING TO" .SH "CONFORMING TO"
.BR get_kernel_syms () .BR get_kernel_syms ()
@ -61,7 +61,7 @@ favor of
(which is itself nowadays deprecated (which is itself nowadays deprecated
in favor of other interfaces described on its manual page). in favor of other interfaces described on its manual page).
.SH NOTES .SH NOTES
This system call is only present on Linux up until kernel 2.4; This system call is only present on Linux up until kernel 2.4;
it was removed in Linux 2.6. it was removed in Linux 2.6.
.\" Removed in Linux-2.5.48 .\" Removed in Linux-2.5.48
.SH "SEE ALSO" .SH "SEE ALSO"

View File

@ -8,26 +8,26 @@
.\" manual under the conditions for verbatim copying, provided that the .\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a .\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one. .\" permission notice identical to this one.
.\" .\"
.\" Since the Linux kernel and libraries are constantly changing, this .\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no .\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" responsibility for errors or omissions, or for damages resulting from .\" responsibility for errors or omissions, or for damages resulting from
.\" the use of the information contained herein. .\" the use of the information contained herein.
.\" .\"
.\" Formatted or processed versions of this manual, if unaccompanied by .\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work. .\" the source, must acknowledge the copyright and authors of this work.
.\" .\"
.\" 2006-02-03, mtk, substantial wording changes and other improvements .\" 2006-02-03, mtk, substantial wording changes and other improvements
.\" .\"
.TH GET_MEMPOLICY 2 "2006-02-07" "SuSE Labs" "Linux Programmer's Manual" .TH GET_MEMPOLICY 2 "2006-02-07" "SuSE Labs" "Linux Programmer's Manual"
.SH SYNOPSIS .SH SYNOPSIS
get_mempolicy \- Retrieve NUMA memory policy for a process get_mempolicy \- Retrieve NUMA memory policy for a process
.SH NAME .SH NAME
.B "#include <numaif.h>" .B "#include <numaif.h>"
.nf .nf
.sp .sp
.BI "int get_mempolicy(int *" policy ", unsigned long *" nodemask , .BI "int get_mempolicy(int *" policy ", unsigned long *" nodemask ,
.BI " unsigned long " maxnode ", unsigned long " addr , .BI " unsigned long " maxnode ", unsigned long " addr ,
.BI " unsigned long " flags ); .BI " unsigned long " flags );
.fi .fi
.\" TBD rewrite this. it is confusing. .\" TBD rewrite this. it is confusing.
@ -39,18 +39,18 @@ depending on the setting of
A NUMA machine has different A NUMA machine has different
memory controllers with different distances to specific CPUs. memory controllers with different distances to specific CPUs.
The memory policy defines in which node memory is allocated for The memory policy defines in which node memory is allocated for
the process. the process.
If If
.IR flags .IR flags
is specified as 0, is specified as 0,
then information about the calling process's default policy then information about the calling process's default policy
(as set by (as set by
.BR set_mempolicy (2)) .BR set_mempolicy (2))
is returned. is returned.
If If
.I flags .I flags
specifies specifies
.BR MPOL_F_ADDR , .BR MPOL_F_ADDR ,
@ -62,52 +62,52 @@ This policy may be different from the process's default policy if
has been used to establish a policy for the page containing has been used to establish a policy for the page containing
.IR addr . .IR addr .
If If
.I policy .I policy
is not NULL, then it is used to return the policy. is not NULL, then it is used to return the policy.
If If
.IR nodemask .IR nodemask
is not NULL, then it is used to return the nodemask associated is not NULL, then it is used to return the nodemask associated
with the policy. with the policy.
.I maxnode .I maxnode
is the maximum bit number plus one that can be stored into is the maximum bit number plus one that can be stored into
.IR nodemask . .IR nodemask .
The bit number is always rounded to a multiple of The bit number is always rounded to a multiple of
.IR "unsigned long" . .IR "unsigned long" .
.\" .\"
.\" If .\" If
.\" .I flags .\" .I flags
.\" specifies both .\" specifies both
.\" .B MPOL_F_NODE .\" .B MPOL_F_NODE
.\" and .\" and
.\" .BR MPOL_F_ADDR , .\" .BR MPOL_F_ADDR ,
.\" then .\" then
.\" .I policy .\" .I policy
.\" instead returns the number of the node on which the address .\" instead returns the number of the node on which the address
.\" .I addr .\" .I addr
.\" is allocated. .\" is allocated.
.\" .\"
.\" If .\" If
.\" .I flags .\" .I flags
.\" specifies .\" specifies
.\" .B MPOL_F_NODE .\" .B MPOL_F_NODE
.\" but not .\" but not
.\" .BR MPOL_F_ADDR , .\" .BR MPOL_F_ADDR ,
.\" and the process's current policy is .\" and the process's current policy is
.\" .BR MPOL_INTERLEAVE , .\" .BR MPOL_INTERLEAVE ,
.\" then .\" then
.\" checkme: Andi's text below says that the info is returned in .\" checkme: Andi's text below says that the info is returned in
.\" 'nodemask', not 'policy': .\" 'nodemask', not 'policy':
.\" .I policy .\" .I policy
.\" instead returns the number of the next node that will be used for .\" instead returns the number of the next node that will be used for
.\" interleaving allocation. .\" interleaving allocation.
.\" FIXME . .\" FIXME .
.\" The other valid flag is .\" The other valid flag is
.\" .I MPOL_F_NODE. .\" .I MPOL_F_NODE.
.\" It is only valid when the policy is .\" It is only valid when the policy is
.\" .I MPOL_INTERLEAVE. .\" .I MPOL_INTERLEAVE.
.\" In this case not the interleave mask, but an unsigned long with the next .\" In this case not the interleave mask, but an unsigned long with the next
.\" node that would be used for interleaving is returned in .\" node that would be used for interleaving is returned in
.\" .I nodemask. .\" .I nodemask.
.\" Other flag values are reserved. .\" Other flag values are reserved.
@ -118,15 +118,15 @@ On success,
.BR get_mempolicy () .BR get_mempolicy ()
returns 0; returns 0;
on error, \-1 is returned and on error, \-1 is returned and
.I errno .I errno
is set to indicate the error. is set to indicate the error.
.\" .SH ERRORS .\" .SH ERRORS
.\" FIXME writeme -- no errors are listed on this page .\" FIXME writeme -- no errors are listed on this page
.\" . .\" .
.\" .TP .\" .TP
.\" .B EINVAL .\" .B EINVAL
.\" .I nodemask .\" .I nodemask
.\" is non-NULL, and .\" is non-NULL, and
.\" .I maxnode .\" .I maxnode
.\" is too small; .\" is too small;
.\" or .\" or
@ -144,15 +144,15 @@ is set to indicate the error.
.\" is NULL. .\" is NULL.
.\" (And there are other EINVAL cases.) .\" (And there are other EINVAL cases.)
.SH NOTES .SH NOTES
This manual page is incomplete: This manual page is incomplete:
it does not document the details the it does not document the details the
.BR MPOL_F_NODE .BR MPOL_F_NODE
flag, flag,
which modifies the operation of which modifies the operation of
.BR get_mempolicy (). .BR get_mempolicy ().
This is deliberate: this flag is not intended for application use, This is deliberate: this flag is not intended for application use,
and its operation may change or it may be removed altogether in and its operation may change or it may be removed altogether in
future kernel versions. future kernel versions.
.B Do not use it. .B Do not use it.
.SH "VERSIONS AND LIBRARY SUPPORT" .SH "VERSIONS AND LIBRARY SUPPORT"
See See

View File

@ -14,14 +14,14 @@ get_thread_area \- Get a Thread Local Storage (TLS) area
.BI "int get_thread_area(struct user_desc *" u_info ); .BI "int get_thread_area(struct user_desc *" u_info );
.SH "DESCRIPTION" .SH "DESCRIPTION"
.BR get_thread_area () .BR get_thread_area ()
returns an entry in the current thread's Thread Local Storage (TLS) array. returns an entry in the current thread's Thread Local Storage (TLS) array.
The index of the entry corresponds to the value The index of the entry corresponds to the value
of \fIu_info->\fR\fIentry_number\fR, passed in by the user. of \fIu_info->\fR\fIentry_number\fR, passed in by the user.
If the value is in bounds, \fBget_thread_info\fR copies the corresponding If the value is in bounds, \fBget_thread_info\fR copies the corresponding
TLS entry into the area pointed to by \fIu_info\fR. TLS entry into the area pointed to by \fIu_info\fR.
.SH "RETURN VALUE" .SH "RETURN VALUE"
.BR get_thread_area () .BR get_thread_area ()
returns 0 on success. returns 0 on success.
Otherwise, it returns \-1 and sets Otherwise, it returns \-1 and sets
.I errno .I errno
appropriately. appropriately.

View File

@ -8,7 +8,7 @@
.\" manual under the conditions for verbatim copying, provided that the .\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a .\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one. .\" permission notice identical to this one.
.\" .\"
.\" Since the Linux kernel and libraries are constantly changing, this .\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no .\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" responsibility for errors or omissions, or for damages resulting from .\" responsibility for errors or omissions, or for damages resulting from
@ -16,7 +16,7 @@
.\" have taken the same level of care in the production of this manual, .\" have taken the same level of care in the production of this manual,
.\" which is licensed free of charge, as they might when working .\" which is licensed free of charge, as they might when working
.\" professionally. .\" professionally.
.\" .\"
.\" Formatted or processed versions of this manual, if unaccompanied by .\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work. .\" the source, must acknowledge the copyright and authors of this work.
.\" .\"
@ -72,7 +72,8 @@ The function \fBgetcontext\fP() initializes the structure
pointed at by \fIucp\fP to the currently active context. pointed at by \fIucp\fP to the currently active context.
.LP .LP
The function \fBsetcontext\fP() restores the user context The function \fBsetcontext\fP() restores the user context
pointed at by \fIucp\fP. A successful call does not return. pointed at by \fIucp\fP.
A successful call does not return.
The context should have been obtained by a call of \fBgetcontext\fP(), The context should have been obtained by a call of \fBgetcontext\fP(),
or \fBmakecontext\fP(), or passed as third argument to a signal or \fBmakecontext\fP(), or passed as third argument to a signal
handler. handler.
@ -91,20 +92,24 @@ When this member is NULL, the thread exits.
If the context was obtained by a call to a signal handler, If the context was obtained by a call to a signal handler,
then old standard text says that "program execution continues with the then old standard text says that "program execution continues with the
program instruction following the instruction interrupted program instruction following the instruction interrupted
by the signal". However, this sentence was removed in SUSv2, by the signal".
However, this sentence was removed in SUSv2,
and the present verdict is "the result is unspecified". and the present verdict is "the result is unspecified".
.SH "RETURN VALUE" .SH "RETURN VALUE"
When successful, \fBgetcontext\fP() returns 0 and \fBsetcontext\fP() When successful, \fBgetcontext\fP() returns 0 and \fBsetcontext\fP()
does not return. On error, both return \-1 and set \fIerrno\fP does not return.
On error, both return \-1 and set \fIerrno\fP
appropriately. appropriately.
.SH ERRORS .SH ERRORS
None defined. None defined.
.SH NOTES .SH NOTES
The earliest incarnation of this mechanism was the The earliest incarnation of this mechanism was the
\fIsetjmp\fP()/\fIlongjmp\fP() mechanism. Since that does not define \fIsetjmp\fP()/\fIlongjmp\fP() mechanism.
Since that does not define
the handling of the signal context, the next stage was the the handling of the signal context, the next stage was the
\fIsigsetjmp\fP()/\fIsiglongjmp\fP() pair. \fIsigsetjmp\fP()/\fIsiglongjmp\fP() pair.
The present mechanism gives much more control. On the other hand, The present mechanism gives much more control.
On the other hand,
there is no easy way to detect whether a return from \fBgetcontext\fP() there is no easy way to detect whether a return from \fBgetcontext\fP()
is from the first call, or via a \fBsetcontext\fP() call. is from the first call, or via a \fBsetcontext\fP() call.
The user has to invent her own bookkeeping device, and a register The user has to invent her own bookkeeping device, and a register
@ -113,7 +118,8 @@ variable won't do since registers are restored.
When a signal occurs, the current user context is saved and When a signal occurs, the current user context is saved and
a new context is created by the kernel for the signal handler. a new context is created by the kernel for the signal handler.
Do not leave the handler using \fIlongjmp\fP(): it is undefined Do not leave the handler using \fIlongjmp\fP(): it is undefined
what would happen with contexts. Use \fIsiglongjmp\fP() or what would happen with contexts.
Use \fIsiglongjmp\fP() or
\fIsetcontext\fP() instead. \fIsetcontext\fP() instead.
.SH "CONFORMING TO" .SH "CONFORMING TO"
SUSv2, POSIX.1-2001. SUSv2, POSIX.1-2001.

View File

@ -8,7 +8,7 @@
.\" manual under the conditions for verbatim copying, provided that the .\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a .\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one. .\" permission notice identical to this one.
.\" .\"
.\" Since the Linux kernel and libraries are constantly changing, this .\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no .\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" responsibility for errors or omissions, or for damages resulting from .\" responsibility for errors or omissions, or for damages resulting from
@ -16,7 +16,7 @@
.\" have taken the same level of care in the production of this manual, .\" have taken the same level of care in the production of this manual,
.\" which is licensed free of charge, as they might when working .\" which is licensed free of charge, as they might when working
.\" professionally. .\" professionally.
.\" .\"
.\" Formatted or processed versions of this manual, if unaccompanied by .\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work. .\" the source, must acknowledge the copyright and authors of this work.
.\" .\"
@ -49,14 +49,14 @@ This page documents the bare kernel system call interface.
.PP .PP
The system call The system call
.BR getdents () .BR getdents ()
reads several reads several
.I dirent .I dirent
structures from the directory structures from the directory
pointed at by pointed at by
.I fd .I fd
into the memory area pointed to by into the memory area pointed to by
.IR dirp . .IR dirp .
The parameter The parameter
.I count .I count
is the size of the memory area. is the size of the memory area.
.PP .PP

View File

@ -10,7 +10,7 @@
.\" manual under the conditions for verbatim copying, provided that the .\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a .\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one. .\" permission notice identical to this one.
.\" .\"
.\" Since the Linux kernel and libraries are constantly changing, this .\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no .\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" responsibility for errors or omissions, or for damages resulting from .\" responsibility for errors or omissions, or for damages resulting from
@ -18,7 +18,7 @@
.\" have taken the same level of care in the production of this manual, .\" have taken the same level of care in the production of this manual,
.\" which is licensed free of charge, as they might when working .\" which is licensed free of charge, as they might when working
.\" professionally. .\" professionally.
.\" .\"
.\" Formatted or processed versions of this manual, if unaccompanied by .\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work. .\" the source, must acknowledge the copyright and authors of this work.
.\" .\"
@ -41,7 +41,8 @@ If the null-terminated domain name requires more than \fIlen\fP bytes,
.BR getdomainname () .BR getdomainname ()
returns the first \fIlen\fP bytes (glibc) or returns an error (libc). returns the first \fIlen\fP bytes (glibc) or returns an error (libc).
.SH "RETURN VALUE" .SH "RETURN VALUE"
On success, zero is returned. On error, \-1 is returned, and On success, zero is returned.
On error, \-1 is returned, and
.I errno .I errno
is set appropriately. is set appropriately.
.SH ERRORS .SH ERRORS

View File

@ -10,7 +10,7 @@
.\" manual under the conditions for verbatim copying, provided that the .\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a .\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one. .\" permission notice identical to this one.
.\" .\"
.\" Since the Linux kernel and libraries are constantly changing, this .\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no .\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" responsibility for errors or omissions, or for damages resulting from .\" responsibility for errors or omissions, or for damages resulting from
@ -18,7 +18,7 @@
.\" have taken the same level of care in the production of this manual, .\" have taken the same level of care in the production of this manual,
.\" which is licensed free of charge, as they might when working .\" which is licensed free of charge, as they might when working
.\" professionally. .\" professionally.
.\" .\"
.\" Formatted or processed versions of this manual, if unaccompanied by .\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work. .\" the source, must acknowledge the copyright and authors of this work.
.\" .\"
@ -39,7 +39,8 @@ one more than the largest possible value for a file descriptor.
The current limit on the number of open files per process. The current limit on the number of open files per process.
.SH NOTES .SH NOTES
.BR getdtablesize () .BR getdtablesize ()
is implemented as a libc library function. The glibc version calls is implemented as a libc library function.
The glibc version calls
.BR getrlimit (2) .BR getrlimit (2)
and returns the current and returns the current
.B RLIMIT_NOFILE .B RLIMIT_NOFILE
@ -54,7 +55,7 @@ SVr4, 4.4BSD (the
.BR getdtablesize () .BR getdtablesize ()
function first appeared in 4.2BSD). function first appeared in 4.2BSD).
It is not specified in POSIX.1-2001; It is not specified in POSIX.1-2001;
portable applications should employ portable applications should employ
.I sysconf(_SC_OPEN_MAX) .I sysconf(_SC_OPEN_MAX)
instead of this call. instead of this call.
.SH "SEE ALSO" .SH "SEE ALSO"

View File

@ -10,7 +10,7 @@
.\" manual under the conditions for verbatim copying, provided that the .\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a .\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one. .\" permission notice identical to this one.
.\" .\"
.\" Since the Linux kernel and libraries are constantly changing, this .\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no .\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" responsibility for errors or omissions, or for damages resulting from .\" responsibility for errors or omissions, or for damages resulting from
@ -18,7 +18,7 @@
.\" have taken the same level of care in the production of this manual, .\" have taken the same level of care in the production of this manual,
.\" which is licensed free of charge, as they might when working .\" which is licensed free of charge, as they might when working
.\" professionally. .\" professionally.
.\" .\"
.\" Formatted or processed versions of this manual, if unaccompanied by .\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work. .\" the source, must acknowledge the copyright and authors of this work.
.\" .\"

View File

@ -10,7 +10,7 @@
.\" manual under the conditions for verbatim copying, provided that the .\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a .\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one. .\" permission notice identical to this one.
.\" .\"
.\" Since the Linux kernel and libraries are constantly changing, this .\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no .\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" responsibility for errors or omissions, or for damages resulting from .\" responsibility for errors or omissions, or for damages resulting from
@ -18,7 +18,7 @@
.\" have taken the same level of care in the production of this manual, .\" have taken the same level of care in the production of this manual,
.\" which is licensed free of charge, as they might when working .\" which is licensed free of charge, as they might when working
.\" professionally. .\" professionally.
.\" .\"
.\" Formatted or processed versions of this manual, if unaccompanied by .\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work. .\" the source, must acknowledge the copyright and authors of this work.
.\" .\"
@ -47,7 +47,8 @@ Up to
supplementary group IDs (of the calling process) are returned in supplementary group IDs (of the calling process) are returned in
.IR list . .IR list .
It is unspecified whether the effective group ID of the calling process It is unspecified whether the effective group ID of the calling process
is included in the returned list. (Thus, an application should also call is included in the returned list.
(Thus, an application should also call
.BR getegid (2) .BR getegid (2)
and add or remove the resulting value.) and add or remove the resulting value.)
If If
@ -71,7 +72,8 @@ On error, \-1 is returned, and
is set appropriately. is set appropriately.
.TP .TP
.BR setgroups () .BR setgroups ()
On success, zero is returned. On error, \-1 is returned, and On success, zero is returned.
On error, \-1 is returned, and
.I errno .I errno
is set appropriately. is set appropriately.
.SH ERRORS .SH ERRORS
@ -93,7 +95,7 @@ For
is less than the number of supplementary group IDs, but is not zero. is less than the number of supplementary group IDs, but is not zero.
.TP .TP
.B EPERM .B EPERM
The calling process has insufficient privilege to call The calling process has insufficient privilege to call
.BR setgroups (). .BR setgroups ().
.SH NOTES .SH NOTES
A process can have up to at least NGROUPS_MAX supplementary group IDs A process can have up to at least NGROUPS_MAX supplementary group IDs

View File

@ -10,7 +10,7 @@
.\" manual under the conditions for verbatim copying, provided that the .\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a .\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one. .\" permission notice identical to this one.
.\" .\"
.\" Since the Linux kernel and libraries are constantly changing, this .\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no .\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" responsibility for errors or omissions, or for damages resulting from .\" responsibility for errors or omissions, or for damages resulting from
@ -18,7 +18,7 @@
.\" have taken the same level of care in the production of this manual, .\" have taken the same level of care in the production of this manual,
.\" which is licensed free of charge, as they might when working .\" which is licensed free of charge, as they might when working
.\" professionally. .\" professionally.
.\" .\"
.\" Formatted or processed versions of this manual, if unaccompanied by .\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work. .\" the source, must acknowledge the copyright and authors of this work.
.\" .\"
@ -36,9 +36,10 @@ gethostid, sethostid \- get or set the unique identifier of the current host
.br .br
.BI "int sethostid(long " hostid ); .BI "int sethostid(long " hostid );
.SH DESCRIPTION .SH DESCRIPTION
Get or set a unique 32-bit identifier for the current machine. The 32-bit Get or set a unique 32-bit identifier for the current machine.
identifier is intended to be unique among all UNIX systems in The 32-bit identifier is intended to be unique among all UNIX systems in
existence. This normally resembles the Internet address for the local existence.
This normally resembles the Internet address for the local
machine, as returned by machine, as returned by
.BR gethostbyname (3), .BR gethostbyname (3),
and thus usually never needs to be set. and thus usually never needs to be set.
@ -57,11 +58,11 @@ returns the 32-bit identifier for the current host as set by
.BR sethostid (2). .BR sethostid (2).
.SH "CONFORMING TO" .SH "CONFORMING TO"
4.2BSD; these functions were dropped in 4.4BSD. 4.2BSD; these functions were dropped in 4.4BSD.
SVr4 includes SVr4 includes
.BR gethostid () .BR gethostid ()
but not but not
.BR sethostid (). .BR sethostid ().
POSIX.1-2001 specifies POSIX.1-2001 specifies
.BR gethostid () .BR gethostid ()
but not but not
.BR sethostid (). .BR sethostid ().

View File

@ -10,7 +10,7 @@
.\" manual under the conditions for verbatim copying, provided that the .\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a .\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one. .\" permission notice identical to this one.
.\" .\"
.\" Since the Linux kernel and libraries are constantly changing, this .\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no .\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" responsibility for errors or omissions, or for damages resulting from .\" responsibility for errors or omissions, or for damages resulting from
@ -18,7 +18,7 @@
.\" have taken the same level of care in the production of this manual, .\" have taken the same level of care in the production of this manual,
.\" which is licensed free of charge, as they might when working .\" which is licensed free of charge, as they might when working
.\" professionally. .\" professionally.
.\" .\"
.\" Formatted or processed versions of this manual, if unaccompanied by .\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work. .\" the source, must acknowledge the copyright and authors of this work.
.\" .\"
@ -46,10 +46,12 @@ system call returns a null-terminated hostname (set earlier by
.BR sethostname ()) .BR sethostname ())
in the array \fIname\fP that has a length of \fIlen\fP bytes. in the array \fIname\fP that has a length of \fIlen\fP bytes.
In case the null-terminated hostname does not fit, no error is In case the null-terminated hostname does not fit, no error is
returned, but the hostname is truncated. It is unspecified returned, but the hostname is truncated.
It is unspecified
whether the truncated hostname will be null-terminated. whether the truncated hostname will be null-terminated.
.SH "RETURN VALUE" .SH "RETURN VALUE"
On success, zero is returned. On error, \-1 is returned, and On success, zero is returned.
On error, \-1 is returned, and
.I errno .I errno
is set appropriately. is set appropriately.
.SH ERRORS .SH ERRORS
@ -88,34 +90,34 @@ SUSv2 guarantees that `Host names are limited to 255 bytes'.
POSIX.1-2001 guarantees that `Host names (not including POSIX.1-2001 guarantees that `Host names (not including
the terminating null byte) are limited to HOST_NAME_MAX bytes'. the terminating null byte) are limited to HOST_NAME_MAX bytes'.
.SH "GLIBC NOTES" .SH "GLIBC NOTES"
The GNU C library implements The GNU C library implements
.BR gethostname () .BR gethostname ()
as a library function that calls as a library function that calls
.BR uname (2) .BR uname (2)
and copies up to and copies up to
.I len .I len
bytes from the returned bytes from the returned
.I nodename .I nodename
field into field into
.IR name . .IR name .
Having performed the copy, the function then checks if the length of the Having performed the copy, the function then checks if the length of the
.I nodename .I nodename
was greater than or equal to was greater than or equal to
.IR len , .IR len ,
and if it is, then the function returns \-1 with and if it is, then the function returns \-1 with
.I errno .I errno
set to set to
.BR ENAMETOOLONG . .BR ENAMETOOLONG .
Versions of glibc before 2.2 Versions of glibc before 2.2
.\" At least glibc 2.0 and 2.1, older versions not checked .\" At least glibc 2.0 and 2.1, older versions not checked
handle the case where the length of the handle the case where the length of the
.I nodename .I nodename
was greater than or equal to was greater than or equal to
.IR len .IR len
differently: nothing is copied into differently: nothing is copied into
.I name .I name
and the function returns \-1 with and the function returns \-1 with
.I errno .I errno
set to set to
.BR ENAMETOOLONG . .BR ENAMETOOLONG .
.SH "SEE ALSO" .SH "SEE ALSO"

View File

@ -17,8 +17,9 @@ getitimer, setitimer \- get or set value of an interval timer
.BI " struct itimerval *" ovalue ); .BI " struct itimerval *" ovalue );
.fi .fi
.SH DESCRIPTION .SH DESCRIPTION
The system provides each process with three interval timers, each decrementing The system provides each process with three interval timers,
in a distinct time domain. When any timer expires, a signal is sent to the each decrementing in a distinct time domain.
When any timer expires, a signal is sent to the
process, and the timer (potentially) restarts. process, and the timer (potentially) restarts.
.TP 1.5i .TP 1.5i
.B ITIMER_REAL .B ITIMER_REAL
@ -33,10 +34,11 @@ upon expiration.
.TP .TP
.B ITIMER_PROF .B ITIMER_PROF
decrements both when the process executes and when the system is executing decrements both when the process executes and when the system is executing
on behalf of the process. Coupled with on behalf of the process.
Coupled with
.BR ITIMER_VIRTUAL , .BR ITIMER_VIRTUAL ,
this timer is usually used to profile the time spent by the application in user this timer is usually used to profile the time spent by the
and kernel space. application in user and kernel space.
.B SIGPROF .B SIGPROF
is delivered upon expiration. is delivered upon expiration.
.LP .LP
@ -71,7 +73,8 @@ or
The element The element
.I it_value .I it_value
is set to the amount of time remaining on the timer, or zero if the timer is set to the amount of time remaining on the timer, or zero if the timer
is disabled. Similarly, is disabled.
Similarly,
.I it_interval .I it_interval
is set to the reset value. is set to the reset value.
The function The function
@ -105,10 +108,12 @@ on the system timer resolution and on the system load.
Upon expiration, a signal will be generated and the timer reset. Upon expiration, a signal will be generated and the timer reset.
If the timer expires while the process is active (always true for If the timer expires while the process is active (always true for
.BR ITIMER_VIRTUAL ) .BR ITIMER_VIRTUAL )
the signal will be delivered immediately when generated. Otherwise the the signal will be delivered immediately when generated.
Otherwise the
delivery will be offset by a small time dependent on the system loading. delivery will be offset by a small time dependent on the system loading.
.SH "RETURN VALUE" .SH "RETURN VALUE"
On success, zero is returned. On error, \-1 is returned, and On success, zero is returned.
On error, \-1 is returned, and
.I errno .I errno
is set appropriately. is set appropriately.
.SH ERRORS .SH ERRORS
@ -130,7 +135,7 @@ or
A child created via A child created via
.BR fork (2) .BR fork (2)
does not inherit its parent's interval timers. does not inherit its parent's interval timers.
Interval timers are preserved across an Interval timers are preserved across an
.BR execve (2). .BR execve (2).
.SH "CONFORMING TO" .SH "CONFORMING TO"
POSIX.1-2001, SVr4, 4.4BSD (this call first appeared in 4.2BSD). POSIX.1-2001, SVr4, 4.4BSD (this call first appeared in 4.2BSD).
@ -150,7 +155,7 @@ has been delivered.
The second signal in such an event will be lost. The second signal in such an event will be lost.
On Linux, timer values are represented in jiffies. On Linux, timer values are represented in jiffies.
If a request is made set a timer with a value whose jiffies If a request is made set a timer with a value whose jiffies
representation exceeds MAX_SEC_IN_JIFFIES representation exceeds MAX_SEC_IN_JIFFIES
(defined in (defined in
.IR include/linux/jiffies.h ), .IR include/linux/jiffies.h ),
@ -161,7 +166,7 @@ this means that the ceiling value for a timer is
approximately 99.42 days. approximately 99.42 days.
On certain systems (including x86), On certain systems (including x86),
Linux kernels before version 2.6.12 have a bug which will produce Linux kernels before version 2.6.12 have a bug which will produce
premature timer expirations of up to one jiffy under some circumstances. premature timer expirations of up to one jiffy under some circumstances.
This bug is fixed in kernel 2.6.12. This bug is fixed in kernel 2.6.12.
.\" 4 Jul 2005: It looks like this bug may remain in 2.4.x. .\" 4 Jul 2005: It looks like this bug may remain in 2.4.x.
@ -174,7 +179,7 @@ should fail if a
value is specified that is outside of the range 0 to 999999. value is specified that is outside of the range 0 to 999999.
However, Linux does not give an error, but instead silently However, Linux does not give an error, but instead silently
adjusts the corresponding seconds value for the timer. adjusts the corresponding seconds value for the timer.
In the future (scheduled for March 2007), In the future (scheduled for March 2007),
this non-conformance will be repaired: this non-conformance will be repaired:
existing applications should be fixed now to ensure that they supply existing applications should be fixed now to ensure that they supply
a properly formed a properly formed

View File

@ -8,7 +8,7 @@
.\" manual under the conditions for verbatim copying, provided that the .\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a .\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one. .\" permission notice identical to this one.
.\" .\"
.\" Since the Linux kernel and libraries are constantly changing, this .\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no .\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" responsibility for errors or omissions, or for damages resulting from .\" responsibility for errors or omissions, or for damages resulting from
@ -16,7 +16,7 @@
.\" have taken the same level of care in the production of this manual, .\" have taken the same level of care in the production of this manual,
.\" which is licensed free of charge, as they might when working .\" which is licensed free of charge, as they might when working
.\" professionally. .\" professionally.
.\" .\"
.\" Formatted or processed versions of this manual, if unaccompanied by .\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work. .\" the source, must acknowledge the copyright and authors of this work.
.\" .\"
@ -64,7 +64,7 @@ In SUSv2 the
call is labeled LEGACY, and in POSIX.1-2001 call is labeled LEGACY, and in POSIX.1-2001
it has been dropped; it has been dropped;
HP-UX does not have this call. HP-UX does not have this call.
Portable applications should employ Portable applications should employ
.I sysconf(_SC_PAGESIZE) .I sysconf(_SC_PAGESIZE)
instead of this call. instead of this call.
.SH NOTES .SH NOTES
@ -75,7 +75,8 @@ If it is, it returns the kernel symbol PAGE_SIZE,
which is architecture and machine model dependent. which is architecture and machine model dependent.
Generally, one uses binaries that are architecture but not Generally, one uses binaries that are architecture but not
machine model dependent, in order to have a single binary machine model dependent, in order to have a single binary
distribution per architecture. This means that a user program distribution per architecture.
This means that a user program
should not find PAGE_SIZE at compile time from a header file, should not find PAGE_SIZE at compile time from a header file,
but use an actual system call, at least for those architectures but use an actual system call, at least for those architectures
(like sun4) where this dependency exists. (like sun4) where this dependency exists.

View File

@ -53,10 +53,11 @@ The
parameter should be initialized to indicate the amount of space pointed to parameter should be initialized to indicate the amount of space pointed to
by by
.IR name . .IR name .
On return it contains the actual size of the name returned (in bytes). The On return it contains the actual size of the name returned (in bytes).
name is truncated if the buffer provided is too small. The name is truncated if the buffer provided is too small.
.SH "RETURN VALUE" .SH "RETURN VALUE"
On success, zero is returned. On error, \-1 is returned, and On success, zero is returned.
On error, \-1 is returned, and
.I errno .I errno
is set appropriately. is set appropriately.
.SH ERRORS .SH ERRORS
@ -67,7 +68,7 @@ The argument
is not a valid descriptor. is not a valid descriptor.
.TP .TP
.B EFAULT .B EFAULT
The The
.I name .I name
parameter points to memory not in a valid part of the parameter points to memory not in a valid part of the
process address space. process address space.
@ -92,13 +93,13 @@ SVr4, 4.4BSD (the
.BR getpeername () .BR getpeername ()
function call first appeared in 4.2BSD), POSIX.1-2001. function call first appeared in 4.2BSD), POSIX.1-2001.
.SH NOTE .SH NOTE
The third argument of The third argument of
.BR getpeername () .BR getpeername ()
is in reality an is in reality an
.I int * .I int *
(and this is what 4.x BSD and libc4 and libc5 have). (and this is what 4.x BSD and libc4 and libc5 have).
Some POSIX confusion resulted in the present Some POSIX confusion resulted in the present
.IR socklen_t , .IR socklen_t ,
also used by glibc. also used by glibc.
See also See also
.BR accept (2). .BR accept (2).

View File

@ -9,7 +9,7 @@
.\" manual under the conditions for verbatim copying, provided that the .\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a .\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one. .\" permission notice identical to this one.
.\" .\"
.\" Since the Linux kernel and libraries are constantly changing, this .\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no .\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" responsibility for errors or omissions, or for damages resulting from .\" responsibility for errors or omissions, or for damages resulting from
@ -17,7 +17,7 @@
.\" have taken the same level of care in the production of this manual, .\" have taken the same level of care in the production of this manual,
.\" which is licensed free of charge, as they might when working .\" which is licensed free of charge, as they might when working
.\" professionally. .\" professionally.
.\" .\"
.\" Formatted or processed versions of this manual, if unaccompanied by .\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work. .\" the source, must acknowledge the copyright and authors of this work.
.TH GETPID 2 1993-07-23 "Linux 0.99.11" "Linux Programmer's Manual" .TH GETPID 2 1993-07-23 "Linux 0.99.11" "Linux Programmer's Manual"
@ -33,7 +33,8 @@ getpid, getppid \- get process identification
.B pid_t getppid(void); .B pid_t getppid(void);
.SH DESCRIPTION .SH DESCRIPTION
.BR getpid () .BR getpid ()
returns the process ID of the current process. (This is often used by returns the process ID of the current process.
(This is often used by
routines that generate unique temporary filenames.) routines that generate unique temporary filenames.)
.BR getppid () .BR getppid ()

View File

@ -70,9 +70,9 @@ is one of
.BR PRIO_PGRP , .BR PRIO_PGRP ,
or or
.BR PRIO_USER , .BR PRIO_USER ,
and and
.I who .I who
is interpreted relative to is interpreted relative to
.I which .I which
(a process identifier for (a process identifier for
.BR PRIO_PROCESS , .BR PRIO_PROCESS ,
@ -93,10 +93,12 @@ lower priorities cause more favorable scheduling.
The The
.BR getpriority () .BR getpriority ()
call returns the highest priority (lowest numerical value) call returns the highest priority (lowest numerical value)
enjoyed by any of the specified processes. The enjoyed by any of the specified processes.
The
.BR setpriority () .BR setpriority ()
call sets the priorities of all of the specified processes call sets the priorities of all of the specified processes
to the specified value. Only the superuser may lower priorities. to the specified value.
Only the superuser may lower priorities.
.SH "RETURN VALUE" .SH "RETURN VALUE"
Since Since
.BR getpriority () .BR getpriority ()
@ -121,7 +123,7 @@ or
.BR PRIO_USER . .BR PRIO_USER .
.TP .TP
.B ESRCH .B ESRCH
No process was located using the No process was located using the
.I which .I which
and and
.I who .I who
@ -134,7 +136,7 @@ may fail if:
.B EPERM .B EPERM
A process was located, but its effective user ID did not match A process was located, but its effective user ID did not match
either the effective or the real user ID of the caller, either the effective or the real user ID of the caller,
and was not privileged (on Linux: did not have the and was not privileged (on Linux: did not have the
.B CAP_SYS_NICE .B CAP_SYS_NICE
capability). capability).
But see NOTES below. But see NOTES below.
@ -145,7 +147,7 @@ have the required privilege (on Linux: did not have the
.B CAP_SYS_NICE .B CAP_SYS_NICE
capability). capability).
Since Linux 2.6.12, this error only occurs if the caller attempts Since Linux 2.6.12, this error only occurs if the caller attempts
to set a process priority outside the range of the to set a process priority outside the range of the
.B RLIMIT_NICE .B RLIMIT_NICE
soft resource limit of the target process; see soft resource limit of the target process; see
.BR getrlimit (2) .BR getrlimit (2)
@ -154,20 +156,20 @@ for details.
A child created by A child created by
.BR fork (2) .BR fork (2)
inherits its parent's nice value. inherits its parent's nice value.
The nice value is preserved across The nice value is preserved across
.BR execve (2). .BR execve (2).
The details on the condition for EPERM depend on the system. The details on the condition for EPERM depend on the system.
The above description is what POSIX.1-2001 says, and seems to be followed on The above description is what POSIX.1-2001 says, and seems to be followed on
all System V-like systems. all System V-like systems.
Linux kernels before 2.6.12 required the real or Linux kernels before 2.6.12 required the real or
effective user ID of the caller to match effective user ID of the caller to match
the real user of the process \fIwho\fP (instead of its effective user ID). the real user of the process \fIwho\fP (instead of its effective user ID).
Linux 2.6.12 and later require Linux 2.6.12 and later require
the effective user ID of the caller to match the effective user ID of the caller to match
the real or effective user ID of the process \fIwho\fP. the real or effective user ID of the process \fIwho\fP.
All BSD-like systems (SunOS 4.1.3, Ultrix 4.2, All BSD-like systems (SunOS 4.1.3, Ultrix 4.2,
4.3BSD, FreeBSD 4.3, OpenBSD-2.5, ...) behave in the same 4.3BSD, FreeBSD 4.3, OpenBSD-2.5, ...) behave in the same
manner as Linux >= 2.6.12. manner as Linux >= 2.6.12.
.LP .LP
The actual priority range varies between kernel versions. The actual priority range varies between kernel versions.

View File

@ -10,7 +10,7 @@
.\" manual under the conditions for verbatim copying, provided that the .\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a .\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one. .\" permission notice identical to this one.
.\" .\"
.\" Since the Linux kernel and libraries are constantly changing, this .\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no .\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" responsibility for errors or omissions, or for damages resulting from .\" responsibility for errors or omissions, or for damages resulting from
@ -18,7 +18,7 @@
.\" have taken the same level of care in the production of this manual, .\" have taken the same level of care in the production of this manual,
.\" which is licensed free of charge, as they might when working .\" which is licensed free of charge, as they might when working
.\" professionally. .\" professionally.
.\" .\"
.\" Formatted or processed versions of this manual, if unaccompanied by .\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work. .\" the source, must acknowledge the copyright and authors of this work.
.\" .\"
@ -33,7 +33,7 @@ getresuid, getresgid \- get real, effective and saved user or group ID
.sp .sp
.BI "int getresuid(uid_t *" ruid ", uid_t *" euid ", uid_t *" suid ); .BI "int getresuid(uid_t *" ruid ", uid_t *" euid ", uid_t *" suid );
.br .br
.BI "int getresgid(gid_t *" rgid ", gid_t *" egid ", gid_t *" sgid ); .BI "int getresgid(gid_t *" rgid ", gid_t *" egid ", gid_t *" sgid );
.SH DESCRIPTION .SH DESCRIPTION
.BR getresuid () .BR getresuid ()
and and
@ -42,7 +42,8 @@ and
get the real UID, effective UID, and saved set-user-ID (resp. group ID's) get the real UID, effective UID, and saved set-user-ID (resp. group ID's)
of the current process. of the current process.
.SH "RETURN VALUE" .SH "RETURN VALUE"
On success, zero is returned. On error, \-1 is returned, and On success, zero is returned.
On error, \-1 is returned, and
.I errno .I errno
is set appropriately. is set appropriately.
.SH ERRORS .SH ERRORS
@ -51,7 +52,7 @@ is set appropriately.
One of the arguments specified an address outside the calling program's One of the arguments specified an address outside the calling program's
address space. address space.
.SH "CONFORMING TO" .SH "CONFORMING TO"
These calls are non-standard; These calls are non-standard;
they also appear on HP-UX and some of the BSDs. they also appear on HP-UX and some of the BSDs.
The prototype is given by glibc since version 2.3.2 The prototype is given by glibc since version 2.3.2

View File

@ -11,7 +11,7 @@
.\" manual under the conditions for verbatim copying, provided that the .\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a .\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one. .\" permission notice identical to this one.
.\" .\"
.\" Since the Linux kernel and libraries are constantly changing, this .\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no .\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" responsibility for errors or omissions, or for damages resulting from .\" responsibility for errors or omissions, or for damages resulting from
@ -19,7 +19,7 @@
.\" have taken the same level of care in the production of this manual, .\" have taken the same level of care in the production of this manual,
.\" which is licensed free of charge, as they might when working .\" which is licensed free of charge, as they might when working
.\" professionally. .\" professionally.
.\" .\"
.\" Formatted or processed versions of this manual, if unaccompanied by .\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work. .\" the source, must acknowledge the copyright and authors of this work.
.\" .\"
@ -43,7 +43,7 @@
.\" Modified 2004-06-16 by Michael Kerrisk <mtk-manpages@gmx.net> .\" Modified 2004-06-16 by Michael Kerrisk <mtk-manpages@gmx.net>
.\" Added notes on CAP_SYS_RESOURCE .\" Added notes on CAP_SYS_RESOURCE
.\" .\"
.\" 2004-11-16 -- mtk: the getrlimit.2 page, which formally included .\" 2004-11-16 -- mtk: the getrlimit.2 page, which formally included
.\" coverage of getrusage(2), has been split, so that the latter .\" coverage of getrusage(2), has been split, so that the latter
.\" is now covered in its own getrusage.2. .\" is now covered in its own getrusage.2.
.\" .\"
@ -75,13 +75,13 @@ getrlimit, setrlimit \- get/set resource limits
and and
.BR setrlimit () .BR setrlimit ()
get and set resource limits respectively. get and set resource limits respectively.
Each resource has an associated soft and hard limit, as defined by the Each resource has an associated soft and hard limit, as defined by the
.I rlimit .I rlimit
structure (the structure (the
.I rlim .I rlim
argument to both argument to both
.BR getrlimit () .BR getrlimit ()
and and
.BR setrlimit ()): .BR setrlimit ()):
.PP .PP
.in +0.5i .in +0.5i
@ -96,7 +96,7 @@ struct rlimit {
The soft limit is the value that the kernel enforces for the The soft limit is the value that the kernel enforces for the
corresponding resource. corresponding resource.
The hard limit acts as a ceiling for the soft limit: The hard limit acts as a ceiling for the soft limit:
an unprivileged process may only set its soft limit to a value in the an unprivileged process may only set its soft limit to a value in the
range from 0 up to the hard limit, and (irreversibly) lower its hard limit. range from 0 up to the hard limit, and (irreversibly) lower its hard limit.
A privileged process (under Linux: one with the A privileged process (under Linux: one with the
.B CAP_SYS_RESOURCE .B CAP_SYS_RESOURCE
@ -161,8 +161,8 @@ perform an orderly termination upon first receipt of
The maximum size of the process's data segment (initialized data, The maximum size of the process's data segment (initialized data,
uninitialized data, and heap). uninitialized data, and heap).
This limit affects calls to This limit affects calls to
.BR brk () .BR brk ()
and and
.BR sbrk (), .BR sbrk (),
which fail with the error which fail with the error
.B ENOMEM .B ENOMEM
@ -173,8 +173,8 @@ The maximum size of files that the process may create.
Attempts to extend a file beyond this limit result in delivery of a Attempts to extend a file beyond this limit result in delivery of a
.B SIGXFSZ .B SIGXFSZ
signal. signal.
By default, this signal terminates a process, but a process can By default, this signal terminates a process, but a process can
catch this signal instead, in which case the relevant system call (e.g., catch this signal instead, in which case the relevant system call (e.g.,
.BR write () .BR write ()
.BR truncate ()) .BR truncate ())
fails with the error fails with the error
@ -184,7 +184,7 @@ fails with the error
.\" to be precise: Linux 2.4.0-test9; no longer in 2.4.25 / 2.5.65 .\" to be precise: Linux 2.4.0-test9; no longer in 2.4.25 / 2.5.65
A limit on the combined number of A limit on the combined number of
.BR flock () .BR flock ()
locks and locks and
.BR fcntl () .BR fcntl ()
leases that this process may establish. leases that this process may establish.
.TP .TP
@ -193,9 +193,9 @@ The maximum number of bytes of memory that may be locked
into RAM. into RAM.
In effect this limit is rounded down to the nearest multiple In effect this limit is rounded down to the nearest multiple
of the system page size. of the system page size.
This limit affects This limit affects
.BR mlock (2) .BR mlock (2)
and and
.BR mlockall (2) .BR mlockall (2)
and the and the
.BR mmap (2) .BR mmap (2)
@ -204,16 +204,16 @@ operation.
Since Linux 2.6.9 it also affects the Since Linux 2.6.9 it also affects the
.BR shmctl (2) .BR shmctl (2)
.B SHM_LOCK .B SHM_LOCK
operation, where it sets a maximum on the total bytes in operation, where it sets a maximum on the total bytes in
shared memory segments (see shared memory segments (see
.BR shmget (2)) .BR shmget (2))
that may be locked by the real user ID of the calling process. that may be locked by the real user ID of the calling process.
The The
.BR shmctl (2) .BR shmctl (2)
.B SHM_LOCK .B SHM_LOCK
locks are accounted for separately from the per-process memory locks are accounted for separately from the per-process memory
locks established by locks established by
.BR mlock (2), .BR mlock (2),
.BR mlockall (2), .BR mlockall (2),
and and
.BR mmap (2) .BR mmap (2)
@ -238,10 +238,10 @@ against this limit according to the formula:
bytes = attr.mq_maxmsg * sizeof(struct msg_msg *) + bytes = attr.mq_maxmsg * sizeof(struct msg_msg *) +
attr.mq_maxmsg * attr.mq_msgsize attr.mq_maxmsg * attr.mq_msgsize
.fi .fi
where where
.I attr .I attr
is the is the
.I mq_attr .I mq_attr
structure specified as the fourth argument to structure specified as the fourth argument to
.BR mq_open (). .BR mq_open ().
@ -268,16 +268,16 @@ Specifies a value one greater than the maximum file descriptor number
that can be opened by this process. that can be opened by this process.
Attempts Attempts
.RB ( open (), .RB ( open (),
.BR pipe (), .BR pipe (),
.BR dup (), .BR dup (),
etc.) etc.)
to exceed this limit yield the error to exceed this limit yield the error
.BR EMFILE . .BR EMFILE .
.TP .TP
.B RLIMIT_NPROC .B RLIMIT_NPROC
The maximum number of processes (or, more precisely on Linux, threads) The maximum number of processes (or, more precisely on Linux, threads)
that can be created for the real user ID of the calling process. that can be created for the real user ID of the calling process.
Upon encountering this limit, Upon encountering this limit,
.BR fork () .BR fork ()
fails with the error fails with the error
.BR EAGAIN . .BR EAGAIN .
@ -291,11 +291,11 @@ affects calls to
specifying specifying
.BR MADV_WILLNEED . .BR MADV_WILLNEED .
.\" As at kernel 2.6.12, this limit still does nothing in 2.6 though .\" As at kernel 2.6.12, this limit still does nothing in 2.6 though
.\" talk of making it do something has surfaced from time to time in LKML .\" talk of making it do something has surfaced from time to time in LKML
.\" -- MTK, Jul 05 .\" -- MTK, Jul 05
.TP .TP
.BR RLIMIT_RTPRIO " (Since Linux 2.6.12, but see BUGS)" .BR RLIMIT_RTPRIO " (Since Linux 2.6.12, but see BUGS)"
Specifies a ceiling on the real-time priority that may be set for Specifies a ceiling on the real-time priority that may be set for
this process using this process using
.BR sched_setscheduler (2) .BR sched_setscheduler (2)
and and
@ -306,7 +306,7 @@ Specifies the limit on the number of signals
that may be queued for the real user ID of the calling process. that may be queued for the real user ID of the calling process.
Both standard and real-time signals are counted for the purpose of Both standard and real-time signals are counted for the purpose of
checking this limit. checking this limit.
However, the limit is only enforced for However, the limit is only enforced for
.BR sigqueue (2); .BR sigqueue (2);
it is always possible to use it is always possible to use
.BR kill (2) .BR kill (2)
@ -324,10 +324,11 @@ To handle this signal, a process must employ an alternate signal stack
.RB ( sigaltstack (2)). .RB ( sigaltstack (2)).
.PP .PP
.B RLIMIT_OFILE .B RLIMIT_OFILE
is the BSD name for is the BSD name for
.BR RLIMIT_NOFILE . .BR RLIMIT_NOFILE .
.SH "RETURN VALUE" .SH "RETURN VALUE"
On success, zero is returned. On error, \-1 is returned, and On success, zero is returned.
On error, \-1 is returned, and
.I errno .I errno
is set appropriately. is set appropriately.
.SH ERRORS .SH ERRORS
@ -341,7 +342,7 @@ points outside the accessible address space.
is not valid; is not valid;
or, for or, for
.BR setrlimit (): .BR setrlimit ():
.IR rlim->rlim_cur .IR rlim->rlim_cur
was greater than was greater than
.IR rlim->rlim_max . .IR rlim->rlim_max .
.TP .TP
@ -363,11 +364,11 @@ signals delivered when a process encountered the soft and hard
limits were delivered one (CPU) second later than they should have been. limits were delivered one (CPU) second later than they should have been.
This was fixed in kernel 2.6.8. This was fixed in kernel 2.6.8.
In 2.6.x kernels before 2.6.17, a In 2.6.x kernels before 2.6.17, a
.B RLIMIT_CPU .B RLIMIT_CPU
limit of 0 is wrongly treated as "no limit" (like limit of 0 is wrongly treated as "no limit" (like
.BR RLIM_INFINITY ). .BR RLIM_INFINITY ).
Since kernel 2.6.17, setting a limit of 0 does have an effect, Since kernel 2.6.17, setting a limit of 0 does have an effect,
but is actually treated as a limit of 1 second. but is actually treated as a limit of 1 second.
.\" see http://marc.theaimsgroup.com/?l=linux-kernel&m=114008066530167&w=2 .\" see http://marc.theaimsgroup.com/?l=linux-kernel&m=114008066530167&w=2
@ -375,12 +376,12 @@ A kernel bug means that
.B RLIMIT_RTPRIO .B RLIMIT_RTPRIO
does not work in kernel 2.6.12; the problem is fixed in kernel 2.6.13. does not work in kernel 2.6.12; the problem is fixed in kernel 2.6.13.
In kernel 2.6.12, there was an off-by-one mismatch In kernel 2.6.12, there was an off-by-one mismatch
between the priority ranges returned by between the priority ranges returned by
.BR getpriority (2) .BR getpriority (2)
and and
.BR RLIMIT_NICE . .BR RLIMIT_NICE .
This had the effect that actual ceiling for the nice value This had the effect that actual ceiling for the nice value
was calculated as was calculated as
.IR "19\ \-\ rlim_cur" . .IR "19\ \-\ rlim_cur" .
This was fixed in kernel 2.6.13. This was fixed in kernel 2.6.13.
@ -388,10 +389,10 @@ This was fixed in kernel 2.6.13.
Kernels before 2.4.22 did not diagnose the error Kernels before 2.4.22 did not diagnose the error
.B EINVAL .B EINVAL
for for
.BR setrlimit () .BR setrlimit ()
when when
.IR rlim->rlim_cur .IR rlim->rlim_cur
was greater than was greater than
.IR rlim->rlim_max . .IR rlim->rlim_max .
.SH NOTES .SH NOTES
@ -403,7 +404,7 @@ Resource limits are preserved across
.SH "CONFORMING TO" .SH "CONFORMING TO"
SVr4, 4.3BSD, POSIX.1-2001. SVr4, 4.3BSD, POSIX.1-2001.
.BR RLIMIT_MEMLOCK .BR RLIMIT_MEMLOCK
and and
.BR RLIMIT_NPROC .BR RLIMIT_NPROC
derive from BSD and are not specified in POSIX.1-2001; derive from BSD and are not specified in POSIX.1-2001;
they are present on the BSDs and Linux, but on few other implementations. they are present on the BSDs and Linux, but on few other implementations.

View File

@ -11,7 +11,7 @@
.\" manual under the conditions for verbatim copying, provided that the .\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a .\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one. .\" permission notice identical to this one.
.\" .\"
.\" Since the Linux kernel and libraries are constantly changing, this .\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no .\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" responsibility for errors or omissions, or for damages resulting from .\" responsibility for errors or omissions, or for damages resulting from
@ -19,13 +19,13 @@
.\" have taken the same level of care in the production of this manual, .\" have taken the same level of care in the production of this manual,
.\" which is licensed free of charge, as they might when working .\" which is licensed free of charge, as they might when working
.\" professionally. .\" professionally.
.\" .\"
.\" Formatted or processed versions of this manual, if unaccompanied by .\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work. .\" the source, must acknowledge the copyright and authors of this work.
.\" .\"
.\" 2004-11-16 -- mtk: the getrlimit.2 page, which formerly included .\" 2004-11-16 -- mtk: the getrlimit.2 page, which formerly included
.\" coverage of getrusage(2), has been split, so that the latter is .\" coverage of getrusage(2), has been split, so that the latter is
.\" now covered in its own getrusage.2. For older details of change .\" now covered in its own getrusage.2. For older details of change
.\" history, etc, see getrlimit.2 .\" history, etc, see getrlimit.2
.\" .\"
.\" Modified 2004-11-16, mtk, Noted that the non-conformance .\" Modified 2004-11-16, mtk, Noted that the non-conformance
@ -44,14 +44,14 @@ getrusage \- get resource usage
.PP .PP
.BR getrusage () .BR getrusage ()
returns current resource usages, for a \fIwho\fP returns current resource usages, for a \fIwho\fP
of either of either
.B RUSAGE_SELF .B RUSAGE_SELF
or or
.BR RUSAGE_CHILDREN . .BR RUSAGE_CHILDREN .
The former asks for resources used by the current process, The former asks for resources used by the current process,
the latter for resources used by those of its children the latter for resources used by those of its children
that have terminated and have been waited for. that have terminated and have been waited for.
.PP .PP
.in +0.5i .in +0.5i
.nf .nf
struct rusage { struct rusage {
@ -75,7 +75,8 @@ struct rusage {
.fi .fi
.in -0.5i .in -0.5i
.SH "RETURN VALUE" .SH "RETURN VALUE"
On success, zero is returned. On error, \-1 is returned, and On success, zero is returned.
On error, \-1 is returned, and
.I errno .I errno
is set appropriately. is set appropriately.
.SH ERRORS .SH ERRORS
@ -88,8 +89,8 @@ points outside the accessible address space.
.I who .I who
is invalid. is invalid.
.SH "CONFORMING TO" .SH "CONFORMING TO"
SVr4, 4.3BSD. SVr4, 4.3BSD.
POSIX.1-2001 specifies POSIX.1-2001 specifies
.BR getrusage (), .BR getrusage (),
but only specifies the fields but only specifies the fields
.I ru_utime .I ru_utime
@ -123,9 +124,9 @@ In linux 2.4 only the fields
.IR ru_stime , .IR ru_stime ,
.IR ru_minflt , .IR ru_minflt ,
and and
.IR ru_majflt .IR ru_majflt
are maintained. are maintained.
Since Linux 2.6, Since Linux 2.6,
.I ru_nvcsw .I ru_nvcsw
and and
.I ru_nivcsw .I ru_nivcsw

View File

@ -46,9 +46,10 @@ getsockname \- get socket name
.fi .fi
.SH DESCRIPTION .SH DESCRIPTION
.BR getsockname () .BR getsockname ()
returns the current returns the current
.I name .I name
for the specified socket. The for the specified socket.
The
.I namelen .I namelen
parameter should be initialized to indicate parameter should be initialized to indicate
the amount of space pointed to by the amount of space pointed to by
@ -56,7 +57,8 @@ the amount of space pointed to by
On return it contains the actual size of the name On return it contains the actual size of the name
returned (in bytes). returned (in bytes).
.SH "RETURN VALUE" .SH "RETURN VALUE"
On success, zero is returned. On error, \-1 is returned, and On success, zero is returned.
On error, \-1 is returned, and
.I errno .I errno
is set appropriately. is set appropriately.
.SH ERRORS .SH ERRORS
@ -67,7 +69,7 @@ The argument
is not a valid descriptor. is not a valid descriptor.
.TP .TP
.B EFAULT .B EFAULT
The The
.I name .I name
parameter points to memory not in a valid part of the parameter points to memory not in a valid part of the
process address space. process address space.
@ -89,9 +91,9 @@ SVr4, 4.4BSD (the
.BR getsockname () .BR getsockname ()
function call appeared in 4.2BSD), POSIX.1-2001. function call appeared in 4.2BSD), POSIX.1-2001.
.\" SVr4 documents additional ENOMEM .\" SVr4 documents additional ENOMEM
.\" and ENOSR error codes. .\" and ENOSR error codes.
.SH NOTE .SH NOTE
The third argument of The third argument of
.BR getsockname () .BR getsockname ()
is in reality an `int *' (and this is what 4.x BSD and libc4 and libc5 have). is in reality an `int *' (and this is what 4.x BSD and libc4 and libc5 have).
Some POSIX confusion resulted in the present socklen_t, also used by glibc. Some POSIX confusion resulted in the present socklen_t, also used by glibc.

View File

@ -36,7 +36,7 @@
.\" Modified Tue Aug 27 10:52:51 1996 by Andries Brouwer (aeb@cwi.nl) .\" Modified Tue Aug 27 10:52:51 1996 by Andries Brouwer (aeb@cwi.nl)
.\" Modified Thu Jan 23 13:29:34 1997 by Andries Brouwer (aeb@cwi.nl) .\" Modified Thu Jan 23 13:29:34 1997 by Andries Brouwer (aeb@cwi.nl)
.\" Modified Sun Mar 28 21:26:46 1999 by Andries Brouwer (aeb@cwi.nl) .\" Modified Sun Mar 28 21:26:46 1999 by Andries Brouwer (aeb@cwi.nl)
.\" Modified 1999 by Andi Kleen <ak@muc.de>. .\" Modified 1999 by Andi Kleen <ak@muc.de>.
.\" Removed most stuff because it is in socket.7 now. .\" Removed most stuff because it is in socket.7 now.
.\" .\"
.TH GETSOCKOPT 2 1999-05-24 "Linux Man Page" "Linux Programmer's Manual" .TH GETSOCKOPT 2 1999-05-24 "Linux Man Page" "Linux Programmer's Manual"
@ -60,7 +60,8 @@ and
.BR setsockopt () .BR setsockopt ()
manipulate the manipulate the
.I options .I options
associated with a socket. Options may exist at multiple associated with a socket.
Options may exist at multiple
protocol levels; they are always present at the uppermost protocol levels; they are always present at the uppermost
.B socket .B socket
level. level.
@ -73,7 +74,8 @@ is specified as
.BR SOL_SOCKET . .BR SOL_SOCKET .
To manipulate options at any To manipulate options at any
other level the protocol number of the appropriate protocol other level the protocol number of the appropriate protocol
controlling the option is supplied. For example, controlling the option is supplied.
For example,
to indicate that an option is to be interpreted by the to indicate that an option is to be interpreted by the
.B TCP .B TCP
protocol, protocol,
@ -92,23 +94,26 @@ are used to access option values for
For For
.BR getsockopt () .BR getsockopt ()
they identify a buffer in which the value for the they identify a buffer in which the value for the
requested option(s) are to be returned. For requested option(s) are to be returned.
For
.BR getsockopt (), .BR getsockopt (),
.I optlen .I optlen
is a value-result parameter, initially containing the is a value-result parameter, initially containing the
size of the buffer pointed to by size of the buffer pointed to by
.IR optval , .IR optval ,
and modified on return to indicate the actual size of and modified on return to indicate the actual size of
the value returned. If no option value is the value returned.
to be supplied or returned, If no option value is to be supplied or returned,
.I optval .I optval
may be NULL. may be NULL.
.I Optname .I Optname
and any specified options are passed uninterpreted to the appropriate and any specified options are passed uninterpreted to the appropriate
protocol module for interpretation. The include file protocol module for interpretation.
The include file
.I <sys/socket.h> .I <sys/socket.h>
contains definitions for socket level options, described below. Options at contains definitions for socket level options, described below.
Options at
other protocol levels vary in format and name; consult the appropriate other protocol levels vary in format and name; consult the appropriate
entries in section 4 of the manual. entries in section 4 of the manual.
@ -125,7 +130,8 @@ For a description of the available socket options see
.BR socket (7) .BR socket (7)
and the appropriate protocol man pages. and the appropriate protocol man pages.
.SH "RETURN VALUE" .SH "RETURN VALUE"
On success, zero is returned. On error, \-1 is returned, and On success, zero is returned.
On error, \-1 is returned, and
.I errno .I errno
is set appropriately. is set appropriately.
.SH ERRORS .SH ERRORS
@ -136,9 +142,10 @@ The argument
is not a valid descriptor. is not a valid descriptor.
.TP .TP
.B EFAULT .B EFAULT
The address pointed to by The address pointed to by
.I optval .I optval
is not in a valid part of the process address space. For is not in a valid part of the process address space.
For
.BR getsockopt (), .BR getsockopt (),
this error may also be returned if this error may also be returned if
.I optlen .I optlen
@ -146,7 +153,7 @@ is not in a valid part of the process address space.
.TP .TP
.B EINVAL .B EINVAL
.I optlen .I optlen
invalid in invalid in
.BR setsockopt (). .BR setsockopt ().
.TP .TP
.B ENOPROTOOPT .B ENOPROTOOPT
@ -157,22 +164,22 @@ The argument
.I s .I s
is a file, not a socket. is a file, not a socket.
.SH "CONFORMING TO" .SH "CONFORMING TO"
SVr4, 4.4BSD (these system calls first appeared in 4.2BSD), SVr4, 4.4BSD (these system calls first appeared in 4.2BSD),
POSIX.1-2001. POSIX.1-2001.
.\" SVr4 documents additional ENOMEM and ENOSR error codes, but does .\" SVr4 documents additional ENOMEM and ENOSR error codes, but does
.\" not document the .\" not document the
.\" .BR SO_SNDLOWAT ", " SO_RCVLOWAT ", " SO_SNDTIMEO ", " SO_RCVTIMEO .\" .BR SO_SNDLOWAT ", " SO_RCVLOWAT ", " SO_SNDTIMEO ", " SO_RCVTIMEO
.\" options .\" options
.SH NOTE .SH NOTE
The The
.I optlen .I optlen
argument of argument of
.BR getsockopt " and " setsockopt .BR getsockopt " and " setsockopt
is in reality an is in reality an
.I "int [*]" .I "int [*]"
(and this is what 4.x BSD and libc4 and libc5 have). (and this is what 4.x BSD and libc4 and libc5 have).
Some POSIX confusion resulted in the present Some POSIX confusion resulted in the present
.IR socklen_t , .IR socklen_t ,
also used by glibc. also used by glibc.
See also See also
.BR accept (2). .BR accept (2).

View File

@ -9,7 +9,7 @@
.\" manual under the conditions for verbatim copying, provided that the .\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a .\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one. .\" permission notice identical to this one.
.\" .\"
.\" Since the Linux kernel and libraries are constantly changing, this .\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no .\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" responsibility for errors or omissions, or for damages resulting from .\" responsibility for errors or omissions, or for damages resulting from
@ -17,7 +17,7 @@
.\" have taken the same level of care in the production of this manual, .\" have taken the same level of care in the production of this manual,
.\" which is licensed free of charge, as they might when working .\" which is licensed free of charge, as they might when working
.\" professionally. .\" professionally.
.\" .\"
.\" Formatted or processed versions of this manual, if unaccompanied by .\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work. .\" the source, must acknowledge the copyright and authors of this work.
.\" .\"
@ -38,13 +38,15 @@ gettid \- get thread identification
.fi .fi
.B pid_t gettid(void); .B pid_t gettid(void);
.SH DESCRIPTION .SH DESCRIPTION
\fBgettid\fP() returns the thread ID of the current process. This is equal \fBgettid\fP() returns the thread ID of the current process.
This is equal
to the process ID (as returned by to the process ID (as returned by
.BR getpid (2)), .BR getpid (2)),
unless the process is part of a thread group (created by specifying unless the process is part of a thread group (created by specifying
the CLONE_THREAD flag to the the CLONE_THREAD flag to the
.BR clone (2) .BR clone (2)
system call). All processes in the same thread group system call).
All processes in the same thread group
have the same PID, but each one has a unique TID. have the same PID, but each one has a unique TID.
.SH "RETURN VALUE" .SH "RETURN VALUE"
On success, returns the thread ID of the current process. On success, returns the thread ID of the current process.

View File

@ -10,7 +10,7 @@
.\" manual under the conditions for verbatim copying, provided that the .\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a .\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one. .\" permission notice identical to this one.
.\" .\"
.\" Since the Linux kernel and libraries are constantly changing, this .\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no .\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" responsibility for errors or omissions, or for damages resulting from .\" responsibility for errors or omissions, or for damages resulting from
@ -18,7 +18,7 @@
.\" have taken the same level of care in the production of this manual, .\" have taken the same level of care in the production of this manual,
.\" which is licensed free of charge, as they might when working .\" which is licensed free of charge, as they might when working
.\" professionally. .\" professionally.
.\" .\"
.\" Formatted or processed versions of this manual, if unaccompanied by .\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work. .\" the source, must acknowledge the copyright and authors of this work.
.\" .\"
@ -53,11 +53,11 @@ The functions
and and
.BR settimeofday () .BR settimeofday ()
can get and set the time as well as a timezone. can get and set the time as well as a timezone.
The The
.I tv .I tv
argument is a argument is a
.I struct timeval .I struct timeval
(as specified in (as specified in
.IR <sys/time.h> ): .IR <sys/time.h> ):
.sp .sp
.in +0.25i .in +0.25i
@ -71,9 +71,9 @@ struct timeval {
.sp .sp
and gives the number of seconds and microseconds since the Epoch (see and gives the number of seconds and microseconds since the Epoch (see
.BR time (2)). .BR time (2)).
The The
.I tz .I tz
argument is a argument is a
.IR "struct timezone" : .IR "struct timezone" :
.sp .sp
.in +0.25i .in +0.25i
@ -87,7 +87,7 @@ struct timezone {
.PP .PP
If either If either
.I tv .I tv
or or
.I tz .I tz
is NULL, the corresponding structure is not set or returned. is NULL, the corresponding structure is not set or returned.
.\" The following is covered under EPERM below: .\" The following is covered under EPERM below:
@ -95,8 +95,8 @@ is NULL, the corresponding structure is not set or returned.
.\" Only the superuser may use .\" Only the superuser may use
.\" .BR settimeofday (). .\" .BR settimeofday ().
.PP .PP
The use of the The use of the
.I timezone .I timezone
structure is obsolete; the structure is obsolete; the
.I tz .I tz
argument should normally be specified as NULL. argument should normally be specified as NULL.
@ -105,17 +105,19 @@ The
field has never been used under Linux; it has not field has never been used under Linux; it has not
been and will not be supported by libc or glibc. been and will not be supported by libc or glibc.
Each and every occurrence of this field in the kernel source Each and every occurrence of this field in the kernel source
(other than the declaration) is a bug. Thus, the following (other than the declaration) is a bug.
Thus, the following
is purely of historic interest. is purely of historic interest.
The field The field
.I tz_dsttime .I tz_dsttime
contains a symbolic constant (values are given below) contains a symbolic constant (values are given below)
that indicates in which part of the year Daylight Saving Time that indicates in which part of the year Daylight Saving Time
is in force. (Note: its value is constant throughout the year: is in force.
(Note: its value is constant throughout the year:
it does not indicate that DST is in force, it just selects an it does not indicate that DST is in force, it just selects an
algorithm.) algorithm.)
The daylight saving time algorithms defined are as follows : The daylight saving time algorithms defined are as follows :
.PP .PP
\fB DST_NONE\fP /* not on dst */ \fB DST_NONE\fP /* not on dst */
.br .br
@ -143,8 +145,10 @@ Of course it turned out that the period in which
Daylight Saving Time is in force cannot be given Daylight Saving Time is in force cannot be given
by a simple algorithm, one per country; indeed, by a simple algorithm, one per country; indeed,
this period is determined by unpredictable political this period is determined by unpredictable political
decisions. So this method of representing time zones decisions.
has been abandoned. Under Linux, in a call to So this method of representing time zones
has been abandoned.
Under Linux, in a call to
.BR settimeofday () .BR settimeofday ()
the the
.I tz_dsttime .I tz_dsttime
@ -160,12 +164,13 @@ argument, the
.I tv .I tv
argument is NULL and the argument is NULL and the
.I tz_minuteswest .I tz_minuteswest
field is non-zero. In such a case it is assumed that the CMOS clock field is non-zero.
In such a case it is assumed that the CMOS clock
is on local time, and that it has to be incremented by this amount is on local time, and that it has to be incremented by this amount
to get UTC system time. to get UTC system time.
No doubt it is a bad idea to use this feature. No doubt it is a bad idea to use this feature.
.PP .PP
The following macros are defined to operate on a The following macros are defined to operate on a
.IR "struct timeval" : .IR "struct timeval" :
.sp .sp
.nf .nf
@ -192,7 +197,7 @@ is set appropriately).
.SH ERRORS .SH ERRORS
.TP .TP
.B EFAULT .B EFAULT
One of One of
.I tv .I tv
or or
.I tz .I tz
@ -202,7 +207,7 @@ pointed outside the accessible address space.
Timezone (or something else) is invalid. Timezone (or something else) is invalid.
.TP .TP
.B EPERM .B EPERM
The calling process has insufficient privilege to call The calling process has insufficient privilege to call
.BR settimeofday (); .BR settimeofday ();
under Linux the under Linux the
.B CAP_SYS_TIME .B CAP_SYS_TIME
@ -220,14 +225,14 @@ are (since glibc2.2.2) only available if
.B _BSD_SOURCE .B _BSD_SOURCE
is defined. is defined.
.LP .LP
Traditionally, the fields of Traditionally, the fields of
.I struct timeval .I struct timeval
were longs. were longs.
.SH "CONFORMING TO" .SH "CONFORMING TO"
SVr4, 4.3BSD. SVr4, 4.3BSD.
POSIX.1-2001 describes POSIX.1-2001 describes
.BR gettimeofday () .BR gettimeofday ()
but not but not
.BR settimeofday (). .BR settimeofday ().
.SH "SEE ALSO" .SH "SEE ALSO"
.BR date (1), .BR date (1),

View File

@ -10,7 +10,7 @@
.\" manual under the conditions for verbatim copying, provided that the .\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a .\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one. .\" permission notice identical to this one.
.\" .\"
.\" Since the Linux kernel and libraries are constantly changing, this .\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no .\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" responsibility for errors or omissions, or for damages resulting from .\" responsibility for errors or omissions, or for damages resulting from
@ -18,7 +18,7 @@
.\" have taken the same level of care in the production of this manual, .\" have taken the same level of care in the production of this manual,
.\" which is licensed free of charge, as they might when working .\" which is licensed free of charge, as they might when working
.\" professionally. .\" professionally.
.\" .\"
.\" Formatted or processed versions of this manual, if unaccompanied by .\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work. .\" the source, must acknowledge the copyright and authors of this work.
.\" .\"

View File

@ -66,7 +66,7 @@ The length of the attribute
is returned. is returned.
.PP .PP
.BR lgetxattr () .BR lgetxattr ()
is identical to is identical to
.BR getxattr (), .BR getxattr (),
except in the case of a symbolic link, where the link itself is except in the case of a symbolic link, where the link itself is
interrogated, not the file that it refers to. interrogated, not the file that it refers to.

View File

@ -12,7 +12,7 @@
.\" manual under the conditions for verbatim copying, provided that the .\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a .\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one. .\" permission notice identical to this one.
.\" .\"
.\" Since the Linux kernel and libraries are constantly changing, this .\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no .\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" responsibility for errors or omissions, or for damages resulting from .\" responsibility for errors or omissions, or for damages resulting from
@ -20,7 +20,7 @@
.\" have taken the same level of care in the production of this manual, .\" have taken the same level of care in the production of this manual,
.\" which is licensed free of charge, as they might when working .\" which is licensed free of charge, as they might when working
.\" professionally. .\" professionally.
.\" .\"
.\" Formatted or processed versions of this manual, if unaccompanied by .\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work. .\" the source, must acknowledge the copyright and authors of this work.
.\" .\"

View File

@ -2,7 +2,7 @@
.\" This file is distributed according to the GNU General Public License. .\" This file is distributed according to the GNU General Public License.
.\" See the file COPYING in the top level source directory for details. .\" See the file COPYING in the top level source directory for details.
.\" .\"
.\" 2006-02-09, some reformatting by Luc Van Oostenryck; some .\" 2006-02-09, some reformatting by Luc Van Oostenryck; some
.\" reformatting and rewordings by mtk .\" reformatting and rewordings by mtk
.\" .\"
.TH INIT_MODULE 2 "2002" "Linux" "Linux Module Support" .TH INIT_MODULE 2 "2002" "Linux" "Linux Module Support"
@ -60,7 +60,8 @@ the rest of the module.
.PP .PP
This system call requires privilege. This system call requires privilege.
.SH "RETURN VALUE" .SH "RETURN VALUE"
On success, zero is returned. On error, \-1 is returned and On success, zero is returned.
On error, \-1 is returned and
.I errno .I errno
is set appropriately. is set appropriately.
.SH ERRORS .SH ERRORS
@ -81,7 +82,7 @@ slot is filled in incorrectly,
.I image->name .I image->name
does not correspond to the original module name, some does not correspond to the original module name, some
.I image->deps .I image->deps
entry does not correspond to a loaded module, entry does not correspond to a loaded module,
or some other similar inconsistency. or some other similar inconsistency.
.TP .TP
.B ENOENT .B ENOENT

View File

@ -35,11 +35,11 @@ inotify_add_watch \- add a watch to an initialized inotify instance
.BI "int inotify_add_watch(int " fd ", const char *" pathname ", uint32_t " mask ); .BI "int inotify_add_watch(int " fd ", const char *" pathname ", uint32_t " mask );
.SH DESCRIPTION .SH DESCRIPTION
.BR inotify_add_watch () .BR inotify_add_watch ()
adds a new watch, or modifies an existing watch, adds a new watch, or modifies an existing watch,
for the file whose location is specified in for the file whose location is specified in
.IR pathname ; .IR pathname ;
the caller must have read permission for this file. the caller must have read permission for this file.
The The
.I fd .I fd
argument is a file descriptor referring to the argument is a file descriptor referring to the
inotify instance whose watch list is to be modified. inotify instance whose watch list is to be modified.
@ -55,13 +55,13 @@ for a description of the bits that can be set in
A successful call to A successful call to
.BR inotify_add_watch () .BR inotify_add_watch ()
returns the unique watch descriptor associated with returns the unique watch descriptor associated with
.I pathname .I pathname
for this inotify instance. for this inotify instance.
If If
.I pathname .I pathname
was not previously being watched by this inotify instance, was not previously being watched by this inotify instance,
then the watch descriptor is newly allocated. then the watch descriptor is newly allocated.
If If
.I pathname .I pathname
was already being watched, then the descriptor was already being watched, then the descriptor
@ -69,10 +69,10 @@ for the existing watch is returned.
The watch descriptor is returned by later The watch descriptor is returned by later
.BR read (2)s .BR read (2)s
from the inotify file descriptor. from the inotify file descriptor.
These reads fetch These reads fetch
.I inotify_event .I inotify_event
structures indicating file system events; structures indicating file system events;
the returned watch descriptor identifies the returned watch descriptor identifies
the object for which the event occurred. the object for which the event occurred.
.SH "RETURN VALUE" .SH "RETURN VALUE"
@ -111,5 +111,5 @@ Inotify was merged into the 2.6.13 Linux kernel.
This system call is Linux specific. This system call is Linux specific.
.SH "SEE ALSO" .SH "SEE ALSO"
.BR inotify_init (2), .BR inotify_init (2),
.BR inotify_rm_watch (2), .BR inotify_rm_watch (2),
.BR inotify (7). .BR inotify (7).

View File

@ -59,5 +59,5 @@ Inotify was merged into the 2.6.13 Linux kernel.
This system call is Linux specific. This system call is Linux specific.
.SH "SEE ALSO" .SH "SEE ALSO"
.BR inotify_add_watch (2), .BR inotify_add_watch (2),
.BR inotify_rm_watch (2), .BR inotify_rm_watch (2),
.BR inotify (7). .BR inotify (7).

View File

@ -41,7 +41,8 @@ from the inotify instance associated with the file descriptor
Removing a watch causes an Removing a watch causes an
.B IN_IGNORED .B IN_IGNORED
event to be generated for this watch descriptor. (See event to be generated for this watch descriptor.
(See
.BR inotify (7).) .BR inotify (7).)
.SH "RETURN VALUE" .SH "RETURN VALUE"
On success, On success,
@ -67,5 +68,5 @@ Inotify was merged into the 2.6.13 Linux kernel.
This system call is Linux specific. This system call is Linux specific.
.SH "SEE ALSO" .SH "SEE ALSO"
.BR inotify_init (2), .BR inotify_init (2),
.BR inotify_add_watch (2), .BR inotify_add_watch (2),
.BR inotify (7). .BR inotify (7).

View File

@ -56,8 +56,9 @@ A _syscall macro
desired system call desired system call
.SS Setup .SS Setup
The important thing to know about a system call is its prototype. You The important thing to know about a system call is its prototype.
need to know how many arguments, their types, and the function return type. You need to know how many arguments, their types,
and the function return type.
There are six macros that make the actual call into the system easier. There are six macros that make the actual call into the system easier.
They have the form: They have the form:
.sp .sp
@ -65,7 +66,7 @@ They have the form:
.RI _syscall X ( type , name , type1 , arg1 , type2 , arg2 ,...) .RI _syscall X ( type , name , type1 , arg1 , type2 , arg2 ,...)
.RS .RS
.HP .HP
where \fIX\fP is 0\(en5, which are the number of arguments taken by the where \fIX\fP is 0\(en5, which are the number of arguments taken by the
system call system call
.HP .HP
\fItype\fP is the return type of the system call \fItype\fP is the return type of the system call
@ -79,7 +80,8 @@ system call
.RE .RE
.sp .sp
These macros create a function called \fIname\fP with the arguments you These macros create a function called \fIname\fP with the arguments you
specify. Once you include the _syscall() in your source file, specify.
Once you include the _syscall() in your source file,
you call the system call by \fIname\fP. you call the system call by \fIname\fP.
.SH EXAMPLE .SH EXAMPLE
.sp .sp
@ -94,7 +96,7 @@ _syscall1(int, sysinfo, struct sysinfo *, info);
/* Note: if you copy directly from the nroff source, remember to /* Note: if you copy directly from the nroff source, remember to
REMOVE the extra backslashes in the printf statement. */ REMOVE the extra backslashes in the printf statement. */
int int
main(void) main(void)
{ {
struct sysinfo s_info; struct sysinfo s_info;
@ -126,11 +128,13 @@ Swap: total 27881472 / free 24698880
Number of processes = 40 Number of processes = 40
.fi .fi
.SH NOTES .SH NOTES
The _syscall() macros DO NOT produce a prototype. You may have to The _syscall() macros DO NOT produce a prototype.
You may have to
create one, especially for C++ users. create one, especially for C++ users.
.sp .sp
System calls are not required to return only positive or negative error System calls are not required to return only positive or negative error
codes. You need to read the source to be sure how it will return errors. codes.
You need to read the source to be sure how it will return errors.
Usually, it is the negative of a standard error code, e.g., \-\fBEPERM\fP. Usually, it is the negative of a standard error code, e.g., \-\fBEPERM\fP.
The _syscall() macros will return the result \fIr\fP of the system call The _syscall() macros will return the result \fIr\fP of the system call
when \fIr\fP is nonnegative, but will return \-1 and set the variable when \fIr\fP is nonnegative, but will return \-1 and set the variable
@ -141,7 +145,8 @@ For the error codes, see
.sp .sp
Some system calls, such as Some system calls, such as
.BR mmap (), .BR mmap (),
require more than five arguments. These are handled by pushing the require more than five arguments.
These are handled by pushing the
arguments on the stack and passing a pointer to the block of arguments. arguments on the stack and passing a pointer to the block of arguments.
.sp .sp
When defining a system call, the argument types MUST be passed by-value When defining a system call, the argument types MUST be passed by-value
@ -152,19 +157,19 @@ about yet is via
.BR syscall (2). .BR syscall (2).
However, this mechanism can only be used if using a libc However, this mechanism can only be used if using a libc
(such as glibc) that supports (such as glibc) that supports
.BR syscall (2), .BR syscall (2),
and if the and if the
.I <sys/syscall.h> .I <sys/syscall.h>
header file contains the required SYS_foo definition. header file contains the required SYS_foo definition.
Otherwise, the use of a _syscall macro is required. Otherwise, the use of a _syscall macro is required.
Some architectures, notably ia64, do not provide the _syscall macros. Some architectures, notably ia64, do not provide the _syscall macros.
On these architectures, On these architectures,
.BR syscall (2) .BR syscall (2)
must be used. must be used.
.SH "CONFORMING TO" .SH "CONFORMING TO"
Certain codes are used to indicate Unix variants and standards to Certain codes are used to indicate Unix variants and standards to
which calls in the section conform. which calls in the section conform.
See See
.BR standards (7). .BR standards (7).
.SH FILES .SH FILES

View File

@ -27,23 +27,23 @@ io_cancel \- cancel an outstanding asynchronous I/O operation
.nf .nf
.\" .ad l .\" .ad l
.\" .hy 0 .\" .hy 0
.\" .\"
.B #include <libaio.h> .B #include <libaio.h>
.\"#include <linux/aio.h> .\"#include <linux/aio.h>
.sp .sp
.\" .HP 16 .\" .HP 16
.BI "int io_cancel(aio_context_t " ctx_id ", struct iocb *" iocb , .BI "int io_cancel(aio_context_t " ctx_id ", struct iocb *" iocb ,
.BI " struct io_event *" result ); .BI " struct io_event *" result );
.\" .ad .\" .ad
.\" .hy .\" .hy
.fi .fi
.SH "DESCRIPTION" .SH "DESCRIPTION"
.PP .PP
\fBio_cancel\fR() attempts to cancel an asynchronous I/O operation \fBio_cancel\fR() attempts to cancel an asynchronous I/O operation
previously submitted with the \fBio_submit\fR system call. previously submitted with the \fBio_submit\fR system call.
\fIctx_id\fR is the AIO context ID of the operation to be cancelled. \fIctx_id\fR is the AIO context ID of the operation to be cancelled.
If the AIO context is found, the event will be cancelled and then copied If the AIO context is found, the event will be cancelled and then copied
into the memory pointed to by \fIresult\fR without being placed into the memory pointed to by \fIresult\fR without being placed
into the completion queue. into the completion queue.
.SH "RETURN VALUE" .SH "RETURN VALUE"
.PP .PP
@ -67,16 +67,16 @@ The \fIiocb\fR specified was not cancelled.
The asynchronous I/O system calls first appeared in Linux 2.5, August 2002. The asynchronous I/O system calls first appeared in Linux 2.5, August 2002.
.SH "CONFORMING TO" .SH "CONFORMING TO"
.PP .PP
\fBio_cancel\fR() is Linux specific and should not be used \fBio_cancel\fR() is Linux specific and should not be used
in programs that are intended to be portable. in programs that are intended to be portable.
.SH "SEE ALSO" .SH "SEE ALSO"
.PP .PP
\fBio_setup\fR(2), \fBio_destroy\fR(2), \fBio_getevents\fR(2), \fBio_setup\fR(2), \fBio_destroy\fR(2), \fBio_getevents\fR(2),
\fBio_submit\fR(2). \fBio_submit\fR(2).
.\" .SH "NOTES" .\" .SH "NOTES"
.\" .\"
.\" .PP .\" .PP
.\" The asynchronous I/O system calls were written by Benjamin LaHaise. .\" The asynchronous I/O system calls were written by Benjamin LaHaise.
.\" .\"
.\" .SH AUTHOR .\" .SH AUTHOR
.\" Kent Yoder. .\" Kent Yoder.

View File

@ -37,9 +37,9 @@ io_destroy \- destroy an asynchronous I/O context
.fi .fi
.SH "DESCRIPTION" .SH "DESCRIPTION"
.PP .PP
\fBio_destroy\fR() removes the asynchronous I/O context from the list of \fBio_destroy\fR() removes the asynchronous I/O context from the list of
I/O contexts and then destroys it. I/O contexts and then destroys it.
\fBio_destroy\fR() can also cancel any outstanding asynchronous I/O \fBio_destroy\fR() can also cancel any outstanding asynchronous I/O
actions on \fIctx\fR and block on completion. actions on \fIctx\fR and block on completion.
.SH "RETURN VALUE" .SH "RETURN VALUE"
.PP .PP
@ -58,19 +58,19 @@ The context pointed to is invalid.
\fBio_destroy\fR() is not implemented on this architecture. \fBio_destroy\fR() is not implemented on this architecture.
.SH "CONFORMING TO" .SH "CONFORMING TO"
.PP .PP
\fBio_destroy\fR() is Linux specific and should not be used in programs \fBio_destroy\fR() is Linux specific and should not be used in programs
that are intended to be portable. that are intended to be portable.
.SH "VERSIONS" .SH "VERSIONS"
.PP .PP
The asynchronous I/O system calls first appeared in Linux 2.5, August 2002. The asynchronous I/O system calls first appeared in Linux 2.5, August 2002.
.SH "SEE ALSO" .SH "SEE ALSO"
.PP .PP
\fBio_setup\fR(2), \fBio_submit\fR(2), \fBio_getevents\fR(2), \fBio_setup\fR(2), \fBio_submit\fR(2), \fBio_getevents\fR(2),
\fBio_cancel\fR(2). \fBio_cancel\fR(2).
.\" .SH "NOTES" .\" .SH "NOTES"
.\" .\"
.\" .PP .\" .PP
.\" The asynchronous I/O system calls were written by Benjamin LaHaise. .\" The asynchronous I/O system calls were written by Benjamin LaHaise.
.\" .\"
.\" .SH AUTHOR .\" .SH AUTHOR
.\" Kent Yoder. .\" Kent Yoder.

View File

@ -32,7 +32,7 @@ io_getevents \- read asynchronous I/O events from the completion queue
.\" #include <linux/aio.h> .\" #include <linux/aio.h>
.sp .sp
.\" .HP 19 .\" .HP 19
.BI "int io_getevents(aio_context_t " ctx_id ", long " min_nr ", long " nr , .BI "int io_getevents(aio_context_t " ctx_id ", long " min_nr ", long " nr ,
.BI " struct io_event *" events \ .BI " struct io_event *" events \
", struct timespec *" timeout ); ", struct timespec *" timeout );
.\" .ad .\" .ad
@ -40,24 +40,24 @@ io_getevents \- read asynchronous I/O events from the completion queue
.fi .fi
.SH "DESCRIPTION" .SH "DESCRIPTION"
.PP .PP
\fBio_getevents\fR() attempts to read at least \fImin_nr\fR events and \fBio_getevents\fR() attempts to read at least \fImin_nr\fR events and
up to \fInr\fR events from the completion queue of the AIO context up to \fInr\fR events from the completion queue of the AIO context
specified by \fIctx_id\fR. specified by \fIctx_id\fR.
\fItimeout\fR specifies the amount of time to wait for events, \fItimeout\fR specifies the amount of time to wait for events,
where a NULL timeout waits until at least \fImin_nr\fR events where a NULL timeout waits until at least \fImin_nr\fR events
have been seen. have been seen.
Note that \fItimeout\fR is relative and will be updated if not NULL Note that \fItimeout\fR is relative and will be updated if not NULL
and the operation blocks. and the operation blocks.
.SH "RETURN VALUE" .SH "RETURN VALUE"
.PP .PP
On success, On success,
\fBio_getevents\fR() returns the number of events read: 0 if no events are \fBio_getevents\fR() returns the number of events read: 0 if no events are
available or < \fImin_nr\fR if the \fItimeout\fR has elapsed; available or < \fImin_nr\fR if the \fItimeout\fR has elapsed;
on failure, it returns one of the errors listed under ERRORS. on failure, it returns one of the errors listed under ERRORS.
.SH "ERRORS" .SH "ERRORS"
.TP .TP
.B EINVAL .B EINVAL
\fIctx_id\fR is invalid. \fImin_nr\fR is out of range or \fInr\fR is \fIctx_id\fR is invalid. \fImin_nr\fR is out of range or \fInr\fR is
out of range. out of range.
.TP .TP
.B EFAULT .B EFAULT
@ -67,19 +67,19 @@ Either \fIevents\fR or \fItimeout\fR is an invalid pointer.
\fBio_getevents\fR() is not implemented on this architecture. \fBio_getevents\fR() is not implemented on this architecture.
.SH "CONFORMING TO" .SH "CONFORMING TO"
.PP .PP
\fBio_getevents\fR() is Linux specific and should not be used in \fBio_getevents\fR() is Linux specific and should not be used in
programs that are intended to be portable. programs that are intended to be portable.
.SH "VERSIONS" .SH "VERSIONS"
.PP .PP
The asynchronous I/O system calls first appeared in Linux 2.5, August 2002. The asynchronous I/O system calls first appeared in Linux 2.5, August 2002.
.SH "SEE ALSO" .SH "SEE ALSO"
.PP .PP
\fBio_setup\fR(2), \fBio_submit\fR(2), \fBio_getevents\fR(2), \fBio_setup\fR(2), \fBio_submit\fR(2), \fBio_getevents\fR(2),
\fBio_cancel\fR(2), \fBio_destroy\fR(2). \fBio_cancel\fR(2), \fBio_destroy\fR(2).
.\" .SH "NOTES" .\" .SH "NOTES"
.\" .\"
.\" .PP .\" .PP
.\" The asynchronous I/O system calls were written by Benjamin LaHaise. .\" The asynchronous I/O system calls were written by Benjamin LaHaise.
.\" .\"
.\" .SH AUTHOR .\" .SH AUTHOR
.\" Kent Yoder. .\" Kent Yoder.

View File

@ -37,20 +37,20 @@ io_setup \- create an asynchronous I/O context
.fi .fi
.SH "DESCRIPTION" .SH "DESCRIPTION"
.PP .PP
\fBio_setup\fR() creates an asynchronous I/O context capable of receiving \fBio_setup\fR() creates an asynchronous I/O context capable of receiving
at least \fInr_events\fR. at least \fInr_events\fR.
\fIctxp\fR must not point to an AIO context that already exists, and must \fIctxp\fR must not point to an AIO context that already exists, and must
be initialized to 0 prior to the call. be initialized to 0 prior to the call.
On successful creation of the AIO context, \fI*ctxp\fR is filled in On successful creation of the AIO context, \fI*ctxp\fR is filled in
with the resulting handle. with the resulting handle.
.SH "RETURN VALUE" .SH "RETURN VALUE"
.PP .PP
\fBio_setup\fR() returns 0 on success; \fBio_setup\fR() returns 0 on success;
on failure, it returns one of the errors listed under ERRORS. on failure, it returns one of the errors listed under ERRORS.
.SH "ERRORS" .SH "ERRORS"
.TP .TP
.B EINVAL .B EINVAL
\fIctxp\fR is not initialized, or the specified \fInr_events\fR \fIctxp\fR is not initialized, or the specified \fInr_events\fR
exceeds internal limits. \fInr_events\fR should be greater than 0. exceeds internal limits. \fInr_events\fR should be greater than 0.
.TP .TP
.B EFAULT .B EFAULT
@ -66,14 +66,14 @@ The specified \fInr_events\fR exceeds the user's limit of available events.
\fBio_setup\fR() is not implemented on this architecture. \fBio_setup\fR() is not implemented on this architecture.
.SH "CONFORMING TO" .SH "CONFORMING TO"
.PP .PP
\fBio_setup\fR() is Linux specific and should not be used in programs \fBio_setup\fR() is Linux specific and should not be used in programs
that are intended to be portable. that are intended to be portable.
.SH "VERSIONS" .SH "VERSIONS"
.PP .PP
The asynchronous I/O system calls first appeared in Linux 2.5, August 2002. The asynchronous I/O system calls first appeared in Linux 2.5, August 2002.
.SH "SEE ALSO" .SH "SEE ALSO"
.PP .PP
\fBio_destroy\fR(2), \fBio_getevents\fR(2), \fBio_submit\fR(2), \fBio_destroy\fR(2), \fBio_getevents\fR(2), \fBio_submit\fR(2),
\fBio_cancel\fR(2). \fBio_cancel\fR(2).
.\" .SH "NOTES" .\" .SH "NOTES"
.\" .PP .\" .PP

View File

@ -37,22 +37,22 @@ io_submit \- submit asynchronous I/O blocks for processing
.fi .fi
.SH "DESCRIPTION" .SH "DESCRIPTION"
.PP .PP
\fBio_submit\fR() queues \fInr\fR I/O request blocks for processing in \fBio_submit\fR() queues \fInr\fR I/O request blocks for processing in
the AIO context \fIctx_id\fR. \fIiocbpp\fR should be an array of the AIO context \fIctx_id\fR. \fIiocbpp\fR should be an array of
\fInr\fR AIO request blocks, \fInr\fR AIO request blocks,
which will be submitted to context \fIctx_id\fR. which will be submitted to context \fIctx_id\fR.
.SH "RETURN VALUE" .SH "RETURN VALUE"
.PP .PP
On success, On success,
\fBio_submit\fR() returns the number of \fIiocb\fRs submitted (which may be \fBio_submit\fR() returns the number of \fIiocb\fRs submitted (which may be
0 if \fInr\fR is zero); 0 if \fInr\fR is zero);
on failure, it returns one of the errors listed under ERRORS. on failure, it returns one of the errors listed under ERRORS.
.SH "ERRORS" .SH "ERRORS"
.TP .TP
.B EINVAL .B EINVAL
The \fIaio_context\fR specified by \fIctx_id\fR is invalid. The \fIaio_context\fR specified by \fIctx_id\fR is invalid.
\fInr\fR is less than 0. The \fIiocb\fR at *iocbpp[0] is not properly \fInr\fR is less than 0. The \fIiocb\fR at *iocbpp[0] is not properly
initialized, or the operation specified is invalid for the file descriptor initialized, or the operation specified is invalid for the file descriptor
in the \fIiocb\fR. in the \fIiocb\fR.
.TP .TP
.B EFAULT .B EFAULT
@ -68,14 +68,14 @@ Insufficient resources are available to queue any \fIiocb\fRs.
\fBio_submit\fR() is not implemented on this architecture. \fBio_submit\fR() is not implemented on this architecture.
.SH "CONFORMING TO" .SH "CONFORMING TO"
.PP .PP
\fBio_submit\fR() is Linux specific and should not be used in \fBio_submit\fR() is Linux specific and should not be used in
programs that are intended to be portable. programs that are intended to be portable.
.SH "VERSIONS" .SH "VERSIONS"
.PP .PP
The asynchronous I/O system calls first appeared in Linux 2.5, August 2002. The asynchronous I/O system calls first appeared in Linux 2.5, August 2002.
.SH "SEE ALSO" .SH "SEE ALSO"
.PP .PP
\fBio_setup\fR(2), \fBio_destroy\fR(2), \fBio_getevents\fR(2), \fBio_setup\fR(2), \fBio_destroy\fR(2), \fBio_getevents\fR(2),
\fBio_cancel\fR(2). \fBio_cancel\fR(2).
.\" .SH "NOTES" .\" .SH "NOTES"
.\" .PP .\" .PP

View File

@ -46,22 +46,24 @@ ioctl \- control device
.SH DESCRIPTION .SH DESCRIPTION
The The
.BR ioctl () .BR ioctl ()
function manipulates the underlying device parameters of special files. In function manipulates the underlying device parameters of special files.
particular, many operating characteristics of character special files In particular, many operating characteristics of character special files
(e.g. terminals) may be controlled with (e.g. terminals) may be controlled with
.BR ioctl () .BR ioctl ()
requests. The argument requests.
The argument
.I d .I d
must be an open file descriptor. must be an open file descriptor.
.PP .PP
The second argument is a device-dependent request code. The third The second argument is a device-dependent request code.
argument is an untyped pointer to memory. It's traditionally The third argument is an untyped pointer to memory.
It's traditionally
.BI "char *" argp .BI "char *" argp
(from the days before (from the days before
.B "void *" .B "void *"
was valid C), and will be so named for this discussion. was valid C), and will be so named for this discussion.
.PP .PP
An An
.BR ioctl () .BR ioctl ()
.I request .I request
has encoded in it whether the argument is an has encoded in it whether the argument is an
@ -70,14 +72,15 @@ parameter or
.I out .I out
parameter, and the size of the argument parameter, and the size of the argument
.I argp .I argp
in bytes. Macros and defines used in specifying an in bytes.
Macros and defines used in specifying an
.BR ioctl () .BR ioctl ()
.I request .I request
are located in the file are located in the file
.IR <sys/ioctl.h> . .IR <sys/ioctl.h> .
.SH "RETURN VALUE" .SH "RETURN VALUE"
Usually, on success zero is returned. Usually, on success zero is returned.
A few A few
.BR ioctl () .BR ioctl ()
requests use the return value as an output parameter requests use the return value as an output parameter
and return a nonnegative value on success. and return a nonnegative value on success.
@ -116,17 +119,17 @@ Often the
call has unwanted side effects, that can be avoided under Linux call has unwanted side effects, that can be avoided under Linux
by giving it the O_NONBLOCK flag. by giving it the O_NONBLOCK flag.
.SH "CONFORMING TO" .SH "CONFORMING TO"
No single standard. No single standard.
Arguments, returns, and semantics of Arguments, returns, and semantics of
.BR ioctl (2) .BR ioctl (2)
vary according to the device driver in question (the call is used as a vary according to the device driver in question (the call is used as a
catch-all for operations that don't cleanly fit the Unix stream I/O catch-all for operations that don't cleanly fit the Unix stream I/O
model). model).
See See
.BR ioctl_list (2) .BR ioctl_list (2)
for a list of many of the known for a list of many of the known
.BR ioctl () .BR ioctl ()
calls. calls.
The The
.BR ioctl () .BR ioctl ()
function call appeared in Version 7 AT&T Unix. function call appeared in Version 7 AT&T Unix.

View File

@ -2,31 +2,32 @@
.\" Sun 17 Sep 1995 .\" Sun 17 Sep 1995
.\" Michael Elizabeth Chastain .\" Michael Elizabeth Chastain
.\" <mec@duracef.shout.net> .\" <mec@duracef.shout.net>
.\" .\"
.\" // Copyright .\" // Copyright
.\" .\"
.\" Ioctl List 1.3.27 is copyright 1995 by Michael Elizabeth Chastain. .\" Ioctl List 1.3.27 is copyright 1995 by Michael Elizabeth Chastain.
.\" It is licensed under the Gnu Public License, Version 2. .\" It is licensed under the Gnu Public License, Version 2.
.\" .\"
.\" .\"
.\" .\"
.\" // Change Log .\" // Change Log
.\" .\"
.\" 1.3.27 421 ioctls. .\" 1.3.27 421 ioctls.
.\" Type information for non-pointer args. .\" Type information for non-pointer args.
.\" SIOCDEVPRIVATE, SIOCPROTOPRIVATE ioctls. .\" SIOCDEVPRIVATE, SIOCPROTOPRIVATE ioctls.
.\" Descriptions of extended arguments. .\" Descriptions of extended arguments.
.\" .\"
.\" 1.2.9 365 ioctls. .\" 1.2.9 365 ioctls.
.\" First public version. .\" First public version.
.\" .\"
.\" .\"
.TH IOCTL_LIST 2 2003-03-30 "Linux 1.3" "Linux Programmer's Manual" .TH IOCTL_LIST 2 2003-03-30 "Linux 1.3" "Linux Programmer's Manual"
.SH NAME .SH NAME
ioctl_list \- list of ioctl calls in Linux/i386 kernel ioctl_list \- list of ioctl calls in Linux/i386 kernel
.SH DESCRIPTION .SH DESCRIPTION
This is Ioctl List 1.3.27, a list of ioctl calls in Linux/i386 kernel This is Ioctl List 1.3.27, a list of ioctl calls in Linux/i386 kernel
1.3.27. It contains 421 ioctls from /usr/include/{asm,linux}/*.h. 1.3.27.
It contains 421 ioctls from /usr/include/{asm,linux}/*.h.
For each ioctl, its numerical value, its name, and its argument For each ioctl, its numerical value, its name, and its argument
type are given. type are given.
.PP .PP
@ -36,7 +37,8 @@ If the kernel uses the argument for both input and output, this is
marked with // I-O. marked with // I-O.
.PP .PP
Some ioctls take more arguments or return more values than a single Some ioctls take more arguments or return more values than a single
structure. These are marked // MORE and documented further in a structure.
These are marked // MORE and documented further in a
separate section. separate section.
.PP .PP
This list is very incomplete. This list is very incomplete.
@ -49,9 +51,12 @@ tried to build some structure into them.
.LP .LP
The old Linux situation was that of mostly 16-bit constants, where the The old Linux situation was that of mostly 16-bit constants, where the
last byte is a serial number, and the preceding byte(s) give a type last byte is a serial number, and the preceding byte(s) give a type
indicating the driver. Sometimes the major number was used: 0x03 indicating the driver.
for the HDIO_* ioctls, 0x06 for the LP* ioctls. And sometimes Sometimes the major number was used: 0x03
one or more ASCII letters were used. For example, TCGETS has value for the HDIO_* ioctls, 0x06 for the LP* ioctls.
And sometimes
one or more ASCII letters were used.
For example, TCGETS has value
0x00005401, with 0x54 = 'T' indicating the terminal driver, and 0x00005401, with 0x54 = 'T' indicating the terminal driver, and
CYGETTIMEOUT has value 0x00435906, with 0x43 0x59 = 'C' 'Y' CYGETTIMEOUT has value 0x00435906, with 0x43 0x59 = 'C' 'Y'
indicating the cyclades driver. indicating the cyclades driver.
@ -78,7 +83,8 @@ it does not help in checking, but it causes varying values
for the various architectures. for the various architectures.
.SH "RETURN VALUE" .SH "RETURN VALUE"
Decent ioctls return 0 on success and \-1 on error, while Decent ioctls return 0 on success and \-1 on error, while
any output value is stored via the argument. However, any output value is stored via the argument.
However,
quite a few ioctls in fact return an output value. quite a few ioctls in fact return an output value.
This is not yet indicated below. This is not yet indicated below.
.nf .nf
@ -567,16 +573,18 @@ This is not yet indicated below.
// More arguments. // More arguments.
Some ioctl's take a pointer to a structure which contains additional Some ioctl's take a pointer to a structure which contains additional
pointers. These are documented here in alphabetical order. pointers.
These are documented here in alphabetical order.
CDROMREADAUDIO takes an input pointer 'const struct cdrom_read_audio *'. CDROMREADAUDIO takes an input pointer 'const struct cdrom_read_audio *'.
The 'buf' field points to an output buffer The 'buf' field points to an output buffer
of length 'nframes * CD_FRAMESIZE_RAW'. of length 'nframes * CD_FRAMESIZE_RAW'.
CDROMREADCOOKED, CDROMREADMODE1, CDROMREADMODE2, and CDROMREADRAW take CDROMREADCOOKED, CDROMREADMODE1, CDROMREADMODE2, and CDROMREADRAW take
an input pointer 'const struct cdrom_msf *'. They use the same pointer an input pointer 'const struct cdrom_msf *'.
as an output pointer to 'char []'. The length varies by request. For They use the same pointer as an output pointer to 'char []'.
CDROMREADMODE1, most drivers use 'CD_FRAMESIZE', but the Optics Storage The length varies by request.
For CDROMREADMODE1, most drivers use 'CD_FRAMESIZE', but the Optics Storage
driver uses 'OPT_BLOCKSIZE' instead (both have the numerical value driver uses 'OPT_BLOCKSIZE' instead (both have the numerical value
2048). 2048).
@ -596,29 +604,35 @@ The 'ifr_data' field is a pointer to another structure as follows:
EQL_GETMASTERCFG struct master_config * EQL_GETMASTERCFG struct master_config *
EQL_SETMASTERCFG const struct master_config * EQL_SETMASTERCFG const struct master_config *
FDRAWCMD takes a 'struct floppy raw_cmd *'. If 'flags & FD_RAW_WRITE' FDRAWCMD takes a 'struct floppy raw_cmd *'.
If 'flags & FD_RAW_WRITE'
is non-zero, then 'data' points to an input buffer of length 'length'. is non-zero, then 'data' points to an input buffer of length 'length'.
If 'flags & FD_RAW_READ' is non-zero, then 'data' points to an output If 'flags & FD_RAW_READ' is non-zero, then 'data' points to an output
buffer of length 'length'. buffer of length 'length'.
GIO_FONTX and PIO_FONTX take a 'struct console_font_desc *' or GIO_FONTX and PIO_FONTX take a 'struct console_font_desc *' or
a 'const struct console_font_desc *', respectively. 'chardata' points to a 'const struct console_font_desc *', respectively. 'chardata' points to
a buffer of 'char [charcount]'. This is an output buffer for GIO_FONTX a buffer of 'char [charcount]'.
This is an output buffer for GIO_FONTX
and an input buffer for PIO_FONTX. and an input buffer for PIO_FONTX.
GIO_UNIMAP and PIO_UNIMAP take a 'struct unimapdesc *' or GIO_UNIMAP and PIO_UNIMAP take a 'struct unimapdesc *' or
a 'const struct unimapdesc *', respectively. 'entries' points to a buffer a 'const struct unimapdesc *', respectively. 'entries' points to a buffer
of 'struct unipair [entry_ct]'. This is an output buffer for GIO_UNIMAP of 'struct unipair [entry_ct]'.
This is an output buffer for GIO_UNIMAP
and an input buffer for PIO_UNIMAP. and an input buffer for PIO_UNIMAP.
KDADDIO, KDDELIO, KDDISABIO, and KDENABIO enable or disable access to KDADDIO, KDDELIO, KDDISABIO, and KDENABIO enable or disable access to
I/O ports. They are essentially alternate interfaces to 'ioperm'. I/O ports.
They are essentially alternate interfaces to 'ioperm'.
KDMAPDISP and KDUNMAPDISP enable or disable memory mappings or I/O port KDMAPDISP and KDUNMAPDISP enable or disable memory mappings or I/O port
access. They are not implemented in the kernel. access.
They are not implemented in the kernel.
SCSI_IOCTL_PROBE_HOST takes an input pointer 'const int *', which is a SCSI_IOCTL_PROBE_HOST takes an input pointer 'const int *', which is a
length. It uses the same pointer as an output pointer to a 'char []' length.
It uses the same pointer as an output pointer to a 'char []'
buffer of this length. buffer of this length.
SIOCADDRT and SIOCDELRT take an input pointer whose type depends on SIOCADDRT and SIOCDELRT take an input pointer whose type depends on
@ -628,7 +642,8 @@ the protocol:
AX.25 const struct ax25_route * AX.25 const struct ax25_route *
NET/ROM const struct nr_route_struct * NET/ROM const struct nr_route_struct *
SIOCGIFCONF takes a 'struct ifconf *'. The 'ifc_buf' field points to a SIOCGIFCONF takes a 'struct ifconf *'.
The 'ifc_buf' field points to a
buffer of length 'ifc_len' bytes, into which the kernel writes a list of buffer of length 'ifc_len' bytes, into which the kernel writes a list of
type 'struct ifreq []'. type 'struct ifreq []'.
@ -637,8 +652,10 @@ SIOCSIFHWADDR takes an input pointer whose type depends on the protocol:
Most protocols const struct ifreq * Most protocols const struct ifreq *
AX.25 const char [AX25_ADDR_LEN] AX.25 const char [AX25_ADDR_LEN]
TIOCLINUX takes a 'const char *'. It uses this to distinguish several TIOCLINUX takes a 'const char *'.
independent sub-cases. In the table below, 'N + foo' means 'foo' after It uses this to distinguish several
independent sub-cases.
In the table below, 'N + foo' means 'foo' after
an N-byte pad. 'struct selection' is implicitly defined an N-byte pad. 'struct selection' is implicitly defined
in 'drivers/char/selection.c' in 'drivers/char/selection.c'

View File

@ -3,7 +3,7 @@
.\" Copyright (c) 1993 Michael Haardt .\" Copyright (c) 1993 Michael Haardt
.\" (michael@moria.de) .\" (michael@moria.de)
.\" Fri Apr 2 11:32:09 MET DST 1993 .\" Fri Apr 2 11:32:09 MET DST 1993
.\" .\"
.\" This is free documentation; you can redistribute it and/or .\" This is free documentation; you can redistribute it and/or
.\" modify it under the terms of the GNU General Public License as .\" modify it under the terms of the GNU General Public License as
.\" published by the Free Software Foundation; either version 2 of .\" published by the Free Software Foundation; either version 2 of
@ -25,7 +25,7 @@
.\" USA. .\" USA.
.\" .\"
.\" Modified Sat Jul 24 15:12:05 1993 by Rik Faith <faith@cs.unc.edu> .\" Modified Sat Jul 24 15:12:05 1993 by Rik Faith <faith@cs.unc.edu>
.\" Modified Tue Aug 1 16:27 1995 by Jochen Karrer .\" Modified Tue Aug 1 16:27 1995 by Jochen Karrer
.\" <cip307@cip.physik.uni-wuerzburg.de> .\" <cip307@cip.physik.uni-wuerzburg.de>
.\" Modified Tue Oct 22 08:11:14 EDT 1996 by Eric S. Raymond <esr@thyrsus.com> .\" Modified Tue Oct 22 08:11:14 EDT 1996 by Eric S. Raymond <esr@thyrsus.com>
.\" Modified Mon Feb 15 17:28:41 CET 1999 by Andries E. Brouwer <aeb@cwi.nl> .\" Modified Mon Feb 15 17:28:41 CET 1999 by Andries E. Brouwer <aeb@cwi.nl>
@ -46,26 +46,27 @@ ioperm \- set port input/output permissions
.SH DESCRIPTION .SH DESCRIPTION
\fBioperm\fP() sets the port access permission bits for the process for \fBioperm\fP() sets the port access permission bits for the process for
\fInum\fP bytes starting from port address \fBfrom\fP to the value \fInum\fP bytes starting from port address \fBfrom\fP to the value
\fBturn_on\fP. \fBturn_on\fP.
If \fBturn_on\fP is non-zero, the calling process must be privileged If \fBturn_on\fP is non-zero, the calling process must be privileged
.RB ( CAP_SYS_RAWIO ). .RB ( CAP_SYS_RAWIO ).
Only the first 0x3ff I/O ports can be specified in this manner. Only the first 0x3ff I/O ports can be specified in this manner.
For more ports, the For more ports, the
.BR iopl () .BR iopl ()
function must be used. function must be used.
Permissions are not inherited on Permissions are not inherited on
.BR fork (), .BR fork (),
but on but on
.BR exec () .BR exec ()
they are. they are.
This is useful for giving port access permissions to non-privileged tasks. This is useful for giving port access permissions to non-privileged tasks.
This call is mostly for the i386 architecture. This call is mostly for the i386 architecture.
On many other architectures it does not exist or will always On many other architectures it does not exist or will always
return an error. return an error.
.SH "RETURN VALUE" .SH "RETURN VALUE"
On success, zero is returned. On error, \-1 is returned, and On success, zero is returned.
On error, \-1 is returned, and
.I errno .I errno
is set appropriately. is set appropriately.
.SH ERRORS .SH ERRORS
@ -91,7 +92,7 @@ intended to be portable.
.SH NOTES .SH NOTES
Libc5 treats it as a system call and has a prototype in Libc5 treats it as a system call and has a prototype in
.IR <unistd.h> . .IR <unistd.h> .
Glibc1 does not have a prototype. Glibc1 does not have a prototype.
Glibc2 has a prototype both in Glibc2 has a prototype both in
.I <sys/io.h> .I <sys/io.h>
and in and in

View File

@ -11,7 +11,7 @@
.\" manual under the conditions for verbatim copying, provided that the .\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a .\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one. .\" permission notice identical to this one.
.\" .\"
.\" Since the Linux kernel and libraries are constantly changing, this .\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no .\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" responsibility for errors or omissions, or for damages resulting from .\" responsibility for errors or omissions, or for damages resulting from
@ -19,11 +19,11 @@
.\" have taken the same level of care in the production of this manual, .\" have taken the same level of care in the production of this manual,
.\" which is licensed free of charge, as they might when working .\" which is licensed free of charge, as they might when working
.\" professionally. .\" professionally.
.\" .\"
.\" Formatted or processed versions of this manual, if unaccompanied by .\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work. .\" the source, must acknowledge the copyright and authors of this work.
.\" .\"
.\" Modified Tue Aug 1 16:47 1995 by Jochen Karrer .\" Modified Tue Aug 1 16:47 1995 by Jochen Karrer
.\" <cip307@cip.physik.uni-wuerzburg.de> .\" <cip307@cip.physik.uni-wuerzburg.de>
.\" Modified Tue Oct 22 08:11:14 EDT 1996 by Eric S. Raymond <esr@thyrsus.com> .\" Modified Tue Oct 22 08:11:14 EDT 1996 by Eric S. Raymond <esr@thyrsus.com>
.\" Modified Fri Nov 27 14:50:36 CET 1998 by Andries Brouwer <aeb@cwi.nl> .\" Modified Fri Nov 27 14:50:36 CET 1998 by Andries Brouwer <aeb@cwi.nl>
@ -43,18 +43,19 @@ changes the I/O privilege level of the current process, as specified in
.IR level . .IR level .
This call is necessary to allow 8514-compatible X servers to run under This call is necessary to allow 8514-compatible X servers to run under
Linux. Since these X servers require access to all 65536 I/O ports, the Linux.
Since these X servers require access to all 65536 I/O ports, the
.BR ioperm () .BR ioperm ()
call is not sufficient. call is not sufficient.
In addition to granting unrestricted I/O port access, running at a higher In addition to granting unrestricted I/O port access, running at a higher
I/O privilege level also allows the process to disable interrupts. This I/O privilege level also allows the process to disable interrupts.
will probably crash the system, and is not recommended. This will probably crash the system, and is not recommended.
Permissions are inherited by Permissions are inherited by
.BR fork () .BR fork ()
and and
.BR exec (). .BR exec ().
The I/O privilege level for a normal process is 0. The I/O privilege level for a normal process is 0.
@ -62,7 +63,8 @@ This call is mostly for the i386 architecture.
On many other architectures it does not exist or will always On many other architectures it does not exist or will always
return an error. return an error.
.SH "RETURN VALUE" .SH "RETURN VALUE"
On success, zero is returned. On error, \-1 is returned, and On success, zero is returned.
On error, \-1 is returned, and
.I errno .I errno
is set appropriately. is set appropriately.
.SH ERRORS .SH ERRORS
@ -75,7 +77,7 @@ is greater than 3.
This call is unimplemented. This call is unimplemented.
.TP .TP
.B EPERM .B EPERM
The calling process has insufficient privilege to call The calling process has insufficient privilege to call
.BR iopl (); .BR iopl ();
the the
.B CAP_SYS_RAWIO .B CAP_SYS_RAWIO
@ -86,7 +88,8 @@ intended to be portable.
.SH NOTES .SH NOTES
Libc5 treats it as a system call and has a prototype in Libc5 treats it as a system call and has a prototype in
.IR <unistd.h> . .IR <unistd.h> .
Glibc1 does not have a prototype. Glibc2 has a prototype both in Glibc1 does not have a prototype.
Glibc2 has a prototype both in
.I <sys/io.h> .I <sys/io.h>
and in and in
.IR <sys/perm.h> . .IR <sys/perm.h> .

View File

@ -138,7 +138,8 @@ See the NOTES section for more
information on scheduling classes and priorities. information on scheduling classes and priorities.
I/O priorities are supported for reads and for synchronous (O_DIRECT, I/O priorities are supported for reads and for synchronous (O_DIRECT,
O_SYNC) writes. I/O priorities are not supported for asynchronous O_SYNC) writes.
I/O priorities are not supported for asynchronous
writes because they are issued outside the context of the program writes because they are issued outside the context of the program
dirtying the memory, and thus program-specific priorities do not apply. dirtying the memory, and thus program-specific priorities do not apply.
.SH "RETURN VALUE" .SH "RETURN VALUE"
@ -235,7 +236,8 @@ These nice levels are grouped in three scheduling classes
each one containing one or more priority levels: each one containing one or more priority levels:
.TP .TP
.BR IOPRIO_CLASS_RT " (1)" .BR IOPRIO_CLASS_RT " (1)"
This is the real-time I/O class. This scheduling class is given This is the real-time I/O class.
This scheduling class is given
higher priority than any other class: higher priority than any other class:
processes from this class are processes from this class are
given first access to the disk every time. given first access to the disk every time.
@ -264,8 +266,9 @@ Priority levels range from 0 (highest) to 7 (lowest).
.BR IOPRIO_CLASS_IDLE " (3)" .BR IOPRIO_CLASS_IDLE " (3)"
This is the idle scheduling class. This is the idle scheduling class.
Processes running at this level only get I/O Processes running at this level only get I/O
time when no one else needs the disk. The idle class has no class time when no one else needs the disk.
data. The idle class has no class
data.
Attention is required when assigning this priority class to a process, Attention is required when assigning this priority class to a process,
since it may become starved if higher priority processes are since it may become starved if higher priority processes are
constantly accessing the disk. constantly accessing the disk.

View File

@ -29,7 +29,7 @@ ipc \- System V IPC system calls
.SH SYNOPSIS .SH SYNOPSIS
.nf .nf
.BI "int ipc(unsigned int " call ", int " first ", int " second \ .BI "int ipc(unsigned int " call ", int " first ", int " second \
", int " third , ", int " third ,
.BI " void *" ptr ", long " fifth ); .BI " void *" ptr ", long " fifth );
.fi .fi
.SH DESCRIPTION .SH DESCRIPTION

View File

@ -10,7 +10,7 @@
.\" manual under the conditions for verbatim copying, provided that the .\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a .\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one. .\" permission notice identical to this one.
.\" .\"
.\" Since the Linux kernel and libraries are constantly changing, this .\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no .\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" responsibility for errors or omissions, or for damages resulting from .\" responsibility for errors or omissions, or for damages resulting from
@ -18,7 +18,7 @@
.\" have taken the same level of care in the production of this manual, .\" have taken the same level of care in the production of this manual,
.\" which is licensed free of charge, as they might when working .\" which is licensed free of charge, as they might when working
.\" professionally. .\" professionally.
.\" .\"
.\" Formatted or processed versions of this manual, if unaccompanied by .\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work. .\" the source, must acknowledge the copyright and authors of this work.
.\" .\"
@ -116,20 +116,20 @@ Linux allows a process to signal itself, but on Linux the call
\fIkill(\-1,sig)\fP does not signal the current process. \fIkill(\-1,sig)\fP does not signal the current process.
.LP .LP
POSIX.1-2001 requires that if a process sends a signal to itself, POSIX.1-2001 requires that if a process sends a signal to itself,
and the sending thread does not have the signal blocked, and the sending thread does not have the signal blocked,
and no other thread and no other thread
has it unblocked or is waiting for it in \fIsigwait\fP(), at least one has it unblocked or is waiting for it in \fIsigwait\fP(), at least one
unblocked signal must be delivered to the sending thread before the unblocked signal must be delivered to the sending thread before the
\fIkill\fP(). \fIkill\fP().
.SH BUGS .SH BUGS
In 2.6 kernels up to and including 2.6.7, In 2.6 kernels up to and including 2.6.7,
there was a bug that meant that when sending signals to a process group, there was a bug that meant that when sending signals to a process group,
.BR kill () .BR kill ()
failed with the error failed with the error
.B EPERM .B EPERM
if the caller did have permission to send the signal to \fIany\fP (rather if the caller did have permission to send the signal to \fIany\fP (rather
than \fIall\fP) of the members of the process group. than \fIall\fP) of the members of the process group.
Notwithstanding this error return, the signal was still delivered Notwithstanding this error return, the signal was still delivered
to all of the processes for which the caller had permission to signal. to all of the processes for which the caller had permission to signal.
.SH "LINUX HISTORY" .SH "LINUX HISTORY"
Across different kernel versions, Linux has enforced different rules Across different kernel versions, Linux has enforced different rules

View File

@ -35,7 +35,7 @@
.\" Modified Tue Oct 22 08:11:14 EDT 1996 by Eric S. Raymond <esr@thyrsus.com> .\" Modified Tue Oct 22 08:11:14 EDT 1996 by Eric S. Raymond <esr@thyrsus.com>
.\" Modified 2004-06-16 by Michael Kerrisk <mtk-manpages@gmx.net> .\" Modified 2004-06-16 by Michael Kerrisk <mtk-manpages@gmx.net>
.\" Added notes on CAP_KILL .\" Added notes on CAP_KILL
.\" Modified 2004-06-21 by aeb .\" Modified 2004-06-21 by aeb
.\" .\"
.TH KILLPG 2 2004-06-21 "BSD Man Page" "Linux Programmer's Manual" .TH KILLPG 2 2004-06-21 "BSD Man Page" "Linux Programmer's Manual"
.SH NAME .SH NAME
@ -72,7 +72,8 @@ saved set-user-ID of the target process.
In the case of SIGCONT it suffices when the sending and receiving In the case of SIGCONT it suffices when the sending and receiving
processes belong to the same session. processes belong to the same session.
.SH "RETURN VALUE" .SH "RETURN VALUE"
On success, zero is returned. On error, \-1 is returned, and On success, zero is returned.
On error, \-1 is returned, and
.I errno .I errno
is set appropriately. is set appropriately.
.SH ERRORS .SH ERRORS
@ -94,8 +95,9 @@ The process group was given as 0 but the sending process does not
have a process group. have a process group.
.SH NOTES .SH NOTES
There are various differences between the permission checking There are various differences between the permission checking
in BSD-type systems and System V-type systems. See the POSIX rationale in BSD-type systems and System V-type systems.
for See the POSIX rationale
for
.BR kill (). .BR kill ().
A difference not mentioned by POSIX concerns the return A difference not mentioned by POSIX concerns the return
value EPERM: BSD documents that no signal is sent and EPERM returned value EPERM: BSD documents that no signal is sent and EPERM returned

View File

@ -11,7 +11,7 @@
.\" manual under the conditions for verbatim copying, provided that the .\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a .\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one. .\" permission notice identical to this one.
.\" .\"
.\" Since the Linux kernel and libraries are constantly changing, this .\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no .\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" responsibility for errors or omissions, or for damages resulting from .\" responsibility for errors or omissions, or for damages resulting from
@ -19,7 +19,7 @@
.\" have taken the same level of care in the production of this manual, .\" have taken the same level of care in the production of this manual,
.\" which is licensed free of charge, as they might when working .\" which is licensed free of charge, as they might when working
.\" professionally. .\" professionally.
.\" .\"
.\" Formatted or processed versions of this manual, if unaccompanied by .\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work. .\" the source, must acknowledge the copyright and authors of this work.
.\" .\"
@ -50,7 +50,8 @@ both names refer to the same file (and so have the same permissions
and ownership) and it is impossible to tell which name was the and ownership) and it is impossible to tell which name was the
\`original'. \`original'.
.SH "RETURN VALUE" .SH "RETURN VALUE"
On success, zero is returned. On error, \-1 is returned, and On success, zero is returned.
On error, \-1 is returned, and
.I errno .I errno
is set appropriately. is set appropriately.
.SH ERRORS .SH ERRORS
@ -127,13 +128,14 @@ even if the same filesystem is mounted on both.)
.SH NOTES .SH NOTES
Hard links, as created by Hard links, as created by
.BR link (), .BR link (),
cannot span filesystems. Use cannot span filesystems.
Use
.BR symlink () .BR symlink ()
if this is required. if this is required.
POSIX.1-2001 says that POSIX.1-2001 says that
.BR link () .BR link ()
should dereference should dereference
.I oldpath .I oldpath
if it is a symbolic link. if it is a symbolic link.
However, Linux does not do so: if However, Linux does not do so: if
@ -141,7 +143,7 @@ However, Linux does not do so: if
is a symbolic link, then is a symbolic link, then
.I newpath .I newpath
is created as a (hard) link to the same symbolic link file is created as a (hard) link to the same symbolic link file
(i.e., (i.e.,
.I newpath .I newpath
becomes a symbolic link to the same file that becomes a symbolic link to the same file that
.I oldpath .I oldpath
@ -158,7 +160,8 @@ SVr4, 4.3BSD, POSIX.1-2001 (except as noted above).
.\" X/OPEN does not document EFAULT, ENOMEM or EIO. .\" X/OPEN does not document EFAULT, ENOMEM or EIO.
.SH BUGS .SH BUGS
On NFS file systems, the return code may be wrong in case the NFS server On NFS file systems, the return code may be wrong in case the NFS server
performs the link creation and dies before it can say so. Use performs the link creation and dies before it can say so.
Use
.BR stat (2) .BR stat (2)
to find out if the link got created. to find out if the link got created.
.SH "SEE ALSO" .SH "SEE ALSO"

View File

@ -10,7 +10,7 @@
.\" manual under the conditions for verbatim copying, provided that the .\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a .\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one. .\" permission notice identical to this one.
.\" .\"
.\" Since the Linux kernel and libraries are constantly changing, this .\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no .\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" responsibility for errors or omissions, or for damages resulting from .\" responsibility for errors or omissions, or for damages resulting from
@ -18,7 +18,7 @@
.\" have taken the same level of care in the production of this manual, .\" have taken the same level of care in the production of this manual,
.\" which is licensed free of charge, as they might when working .\" which is licensed free of charge, as they might when working
.\" professionally. .\" professionally.
.\" .\"
.\" Formatted or processed versions of this manual, if unaccompanied by .\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work. .\" the source, must acknowledge the copyright and authors of this work.
.\" .\"
@ -31,7 +31,7 @@ linkat \- create a file link relative to directory file descriptors
.B #define _ATFILE_SOURCE .B #define _ATFILE_SOURCE
.B #include <unistd.h> .B #include <unistd.h>
.sp .sp
.BI "int linkat(int " olddirfd ", const char *" oldpath , .BI "int linkat(int " olddirfd ", const char *" oldpath ,
.BI " int " newdirfd ", const char *" newpath ", int " flags ); .BI " int " newdirfd ", const char *" newpath ", int " flags );
.fi .fi
.SH DESCRIPTION .SH DESCRIPTION
@ -41,51 +41,51 @@ system call operates in exactly the same way as
.BR link (2), .BR link (2),
except for the differences described in this manual page. except for the differences described in this manual page.
If the pathname given in If the pathname given in
.I oldpath .I oldpath
is relative, then it is interpreted relative to the directory is relative, then it is interpreted relative to the directory
referred to by the file descriptor referred to by the file descriptor
.IR olddirfd .IR olddirfd
(rather than relative to the current working directory of (rather than relative to the current working directory of
the calling process, as is done by the calling process, as is done by
.BR link (2) .BR link (2)
for a relative pathname). for a relative pathname).
If If
.I oldpath .I oldpath
is relative and is relative and
.I olddirfd .I olddirfd
is the special value is the special value
.BR AT_FDCWD , .BR AT_FDCWD ,
then then
.I oldpath .I oldpath
is interpreted relative to the current working is interpreted relative to the current working
directory of the calling process (like directory of the calling process (like
.BR link (2)). .BR link (2)).
If If
.IR oldpath .IR oldpath
is absolute, then is absolute, then
.I olddirfd .I olddirfd
is ignored. is ignored.
The interpretation of The interpretation of
.I newpath .I newpath
is as for is as for
.IR oldpath , .IR oldpath ,
except that a relative pathname is interpreted relative except that a relative pathname is interpreted relative
to the directory referred to by the file descriptor to the directory referred to by the file descriptor
.IR newdirfd . .IR newdirfd .
By default, By default,
.BR linkat (2), .BR linkat (2),
does not dereference does not dereference
.I oldpath .I oldpath
if it is a symbolic link (like if it is a symbolic link (like
.BR link (2)). .BR link (2)).
Since Linux 2.6.18, the flag Since Linux 2.6.18, the flag
.B AT_SYMLINK_FOLLOW .B AT_SYMLINK_FOLLOW
can be specified can be specified
.I flags .I flags
to cause to cause
.I oldpath .I oldpath
@ -95,8 +95,8 @@ Before kernel 2.6.18, the
argument was unused, and had to be specified as 0. argument was unused, and had to be specified as 0.
.SH "RETURN VALUE" .SH "RETURN VALUE"
On success, On success,
.BR linkat () .BR linkat ()
returns 0. returns 0.
On error, \-1 is returned and On error, \-1 is returned and
.I errno .I errno
is set to indicate the error. is set to indicate the error.
@ -105,7 +105,7 @@ The same errors that occur for
.BR link (2) .BR link (2)
can also occur for can also occur for
.BR linkat (). .BR linkat ().
The following additional errors can occur for The following additional errors can occur for
.BR linkat (): .BR linkat ():
.TP .TP
.B EBADF .B EBADF

View File

@ -35,7 +35,7 @@
.\" Modified 950727 by aeb, following a suggestion by Urs Thuermann .\" Modified 950727 by aeb, following a suggestion by Urs Thuermann
.\" <urs@isnogud.escape.de> .\" <urs@isnogud.escape.de>
.\" Modified Tue Oct 22 08:11:14 EDT 1996 by Eric S. Raymond <esr@thyrsus.com> .\" Modified Tue Oct 22 08:11:14 EDT 1996 by Eric S. Raymond <esr@thyrsus.com>
.\" Modified 1998 by Andi Kleen .\" Modified 1998 by Andi Kleen
.\" Modified 11 May 2001 by Sam Varshavchik <mrsam@courier-mta.com> .\" Modified 11 May 2001 by Sam Varshavchik <mrsam@courier-mta.com>
.\" .\"
.TH LISTEN 2 1993-07-23 "BSD Man Page" "Linux Programmer's Manual" .TH LISTEN 2 1993-07-23 "BSD Man Page" "Linux Programmer's Manual"
@ -64,29 +64,32 @@ or
The The
.I backlog .I backlog
parameter defines the maximum length the queue of pending connections may parameter defines the maximum length the queue of pending connections may
grow to. If a connection request arrives with the queue full the client grow to.
If a connection request arrives with the queue full the client
may receive an error with an indication of may receive an error with an indication of
.B ECONNREFUSED .B ECONNREFUSED
or, if the underlying protocol supports retransmission, the request may be or, if the underlying protocol supports retransmission, the request may be
ignored so that retries succeed. ignored so that retries succeed.
.SH NOTES .SH NOTES
The behaviour of the The behaviour of the
.I backlog .I backlog
parameter on TCP sockets changed with Linux 2.2. parameter on TCP sockets changed with Linux 2.2.
Now it specifies the queue length for Now it specifies the queue length for
.I completely .I completely
established sockets waiting to be accepted, instead of the number of incomplete established sockets waiting to be accepted, instead of the number of incomplete
connection requests. The maximum length of the queue for incomplete sockets connection requests.
can be set using the The maximum length of the queue for incomplete sockets
can be set using the
.B tcp_max_syn_backlog .B tcp_max_syn_backlog
sysctl. sysctl.
When syncookies are enabled there is no logical maximum When syncookies are enabled there is no logical maximum
length and this sysctl setting is ignored. length and this sysctl setting is ignored.
See See
.BR tcp (7) .BR tcp (7)
for more information. for more information.
.SH "RETURN VALUE" .SH "RETURN VALUE"
On success, zero is returned. On error, \-1 is returned, and On success, zero is returned.
On error, \-1 is returned, and
.I errno .I errno
is set appropriately. is set appropriately.
.SH ERRORS .SH ERRORS
@ -112,18 +115,18 @@ operation.
4.4BSD, POSIX.1-2001. 4.4BSD, POSIX.1-2001.
The The
.BR listen () .BR listen ()
function call first appeared in 4.2BSD. function call first appeared in 4.2BSD.
.SH BUGS .SH BUGS
If the socket is of type If the socket is of type
.BR AF_INET , .BR AF_INET ,
and the and the
.I backlog .I backlog
argument is greater argument is greater
than the constant than the constant
.B SOMAXCONN .B SOMAXCONN
(128 in Linux 2.0 & 2.2), it is silently truncated (128 in Linux 2.0 & 2.2), it is silently truncated
to to
.BR SOMAXCONN . .BR SOMAXCONN .
.\" The following is now rather historic information (MTK, Jun 05) .\" The following is now rather historic information (MTK, Jun 05)
.\" Don't rely on this value in portable applications since BSD .\" Don't rely on this value in portable applications since BSD
.\" (and some BSD-derived systems) limit the backlog to 5. .\" (and some BSD-derived systems) limit the backlog to 5.

View File

@ -64,7 +64,7 @@ The length of the attribute name
is returned. is returned.
.PP .PP
.BR llistxattr () .BR llistxattr ()
is identical to is identical to
.BR listxattr (), .BR listxattr (),
except in the case of a symbolic link, where the list of names of except in the case of a symbolic link, where the list of names of
extended attributes associated with the link itself is retrieved, extended attributes associated with the link itself is retrieved,

View File

@ -8,7 +8,7 @@
.\" manual under the conditions for verbatim copying, provided that the .\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a .\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one. .\" permission notice identical to this one.
.\" .\"
.\" Since the Linux kernel and libraries are constantly changing, this .\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no .\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" responsibility for errors or omissions, or for damages resulting from .\" responsibility for errors or omissions, or for damages resulting from
@ -16,7 +16,7 @@
.\" have taken the same level of care in the production of this manual, .\" have taken the same level of care in the production of this manual,
.\" which is licensed free of charge, as they might when working .\" which is licensed free of charge, as they might when working
.\" professionally. .\" professionally.
.\" .\"
.\" Formatted or processed versions of this manual, if unaccompanied by .\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work. .\" the source, must acknowledge the copyright and authors of this work.
.\" .\"
@ -33,12 +33,12 @@ _llseek \- reposition read/write file offset
.B #include <linux/unistd.h> .B #include <linux/unistd.h>
.B #include <errno.h> .B #include <errno.h>
.sp .sp
.B _syscall5(int, _llseek, unsigned int, fd, unsigned long, hi, .B _syscall5(int, _llseek, unsigned int, fd, unsigned long, hi,
.B " " unsigned long, lo, loff_t *, res, unsigned int, wh) .B " " unsigned long, lo, loff_t *, res, unsigned int, wh)
/* Using \fBsyscall\fP(2) may be preferable; see \fBintro\fP(2) */ /* Using \fBsyscall\fP(2) may be preferable; see \fBintro\fP(2) */
.sp .sp
.BI "int _llseek(unsigned int " fd ", unsigned long " offset_high , .BI "int _llseek(unsigned int " fd ", unsigned long " offset_high ,
.BI " unsigned long " offset_low ", loff_t *" result , .BI " unsigned long " offset_low ", loff_t *" result ,
.BI " unsigned int " whence ); .BI " unsigned int " whence );
.fi .fi
.SH DESCRIPTION .SH DESCRIPTION
@ -83,4 +83,4 @@ This function is Linux specific, and should not be used in programs
intended to be portable. intended to be portable.
.SH "SEE ALSO" .SH "SEE ALSO"
.BR lseek (2), .BR lseek (2),
.BR lseek64 (3) .BR lseek64 (3)

View File

@ -10,7 +10,7 @@
.\" manual under the conditions for verbatim copying, provided that the .\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a .\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one. .\" permission notice identical to this one.
.\" .\"
.\" Since the Linux kernel and libraries are constantly changing, this .\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no .\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" responsibility for errors or omissions, or for damages resulting from .\" responsibility for errors or omissions, or for damages resulting from
@ -18,7 +18,7 @@
.\" have taken the same level of care in the production of this manual, .\" have taken the same level of care in the production of this manual,
.\" which is licensed free of charge, as they might when working .\" which is licensed free of charge, as they might when working
.\" professionally. .\" professionally.
.\" .\"
.\" Formatted or processed versions of this manual, if unaccompanied by .\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work. .\" the source, must acknowledge the copyright and authors of this work.
.\" .\"
@ -34,13 +34,13 @@ lookup_dcookie \- return a directory entry's path
Look up the full path of the directory entry specified by the value Look up the full path of the directory entry specified by the value
.I cookie .I cookie
. .
The cookie is an opaque identifier uniquely identifying a particular directory The cookie is an opaque identifier uniquely identifying a particular
entry. The buffer given is filled in with the full path of the directory directory entry.
entry. The buffer given is filled in with the full path of the directory entry.
For For
.BR lookup_dcookie () .BR lookup_dcookie ()
to return successfully, to return successfully,
the kernel must still hold a cookie reference to the directory entry. the kernel must still hold a cookie reference to the directory entry.
.SH "NOTES" .SH "NOTES"
.BR lookup_dcookie () .BR lookup_dcookie ()
@ -73,7 +73,7 @@ The kernel could not allocate memory for the temporary buffer holding
the path. the path.
.TP .TP
.B EPERM .B EPERM
The process does not have the capability The process does not have the capability
.B CAP_SYS_ADMIN .B CAP_SYS_ADMIN
required to look up cookie values. required to look up cookie values.
.TP .TP

View File

@ -81,13 +81,13 @@ The
function allows the file offset to be set beyond the end function allows the file offset to be set beyond the end
of the file (but this does not change the size of the file). of the file (but this does not change the size of the file).
If data is later written at this point, subsequent reads of the data If data is later written at this point, subsequent reads of the data
in the gap (a "hole") return null bytes ('\\0') until in the gap (a "hole") return null bytes ('\\0') until
data is actually written into the gap. data is actually written into the gap.
.SH "RETURN VALUE" .SH "RETURN VALUE"
Upon successful completion, Upon successful completion,
.BR lseek () .BR lseek ()
returns the resulting offset location as measured in bytes from the returns the resulting offset location as measured in bytes from the
beginning of the file. beginning of the file.
Otherwise, a value of \fI(off_t)\-1\fP is returned and Otherwise, a value of \fI(off_t)\-1\fP is returned and
.I errno .I errno
is set to indicate the error. is set to indicate the error.
@ -107,7 +107,7 @@ or beyond the end of a seekable device.
.TP .TP
.B EOVERFLOW .B EOVERFLOW
.\" HP-UX 11 says EINVAL for this case (but POSIX.1 says EOVERFLOW) .\" HP-UX 11 says EINVAL for this case (but POSIX.1 says EOVERFLOW)
The resulting file offset cannot be represented in an The resulting file offset cannot be represented in an
.IR off_t . .IR off_t .
.TP .TP
.B ESPIPE .B ESPIPE
@ -117,7 +117,7 @@ is associated with a pipe, socket, or FIFO.
SVr4, 4.3BSD, POSIX.1-2001. SVr4, 4.3BSD, POSIX.1-2001.
.SH RESTRICTIONS .SH RESTRICTIONS
Some devices are incapable of seeking and POSIX does not specify which Some devices are incapable of seeking and POSIX does not specify which
devices must support devices must support
.BR lseek (). .BR lseek ().
Linux specific restrictions: using \fBlseek\fP() on a tty device returns Linux specific restrictions: using \fBlseek\fP() on a tty device returns
@ -157,4 +157,4 @@ subject to race conditions.
.BR open (2), .BR open (2),
.BR fseek (3), .BR fseek (3),
.BR lseek64 (3), .BR lseek64 (3),
.BR posix_fallocate (3) .BR posix_fallocate (3)

View File

@ -10,7 +10,7 @@
.\" manual under the conditions for verbatim copying, provided that the .\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a .\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one. .\" permission notice identical to this one.
.\" .\"
.\" Since the Linux kernel and libraries are constantly changing, this .\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no .\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" responsibility for errors or omissions, or for damages resulting from .\" responsibility for errors or omissions, or for damages resulting from
@ -18,7 +18,7 @@
.\" have taken the same level of care in the production of this manual, .\" have taken the same level of care in the production of this manual,
.\" which is licensed free of charge, as they might when working .\" which is licensed free of charge, as they might when working
.\" professionally. .\" professionally.
.\" .\"
.\" Formatted or processed versions of this manual, if unaccompanied by .\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work. .\" the source, must acknowledge the copyright and authors of this work.
.\" .\"
@ -49,21 +49,24 @@ the address range beginning at address
.I start .I start
and with size and with size
.I length .I length
bytes. It allows an application to tell the kernel how it expects to use bytes.
It allows an application to tell the kernel how it expects to use
some mapped or shared memory areas, so that the kernel can choose some mapped or shared memory areas, so that the kernel can choose
appropriate read-ahead and caching techniques. appropriate read-ahead and caching techniques.
This call does not influence the semantics of the application This call does not influence the semantics of the application
(except in the case of (except in the case of
.BR MADV_DONTNEED ), .BR MADV_DONTNEED ),
but but
may influence its performance. The kernel is free to ignore the advice. may influence its performance.
The kernel is free to ignore the advice.
.LP .LP
The advice is indicated in the The advice is indicated in the
.I advice .I advice
parameter which can be parameter which can be
.TP .TP
.B MADV_NORMAL .B MADV_NORMAL
No special treatment. This is the default. No special treatment.
This is the default.
.TP .TP
.B MADV_RANDOM .B MADV_RANDOM
Expect page references in random order. Expect page references in random order.
@ -89,13 +92,13 @@ without an underlying file.
.TP .TP
.BR MADV_REMOVE " (Since Linux 2.6.16)" .BR MADV_REMOVE " (Since Linux 2.6.16)"
Free up a given range of pages Free up a given range of pages
and its associated backing store. and its associated backing store.
Currently, Currently,
.\" 2.6.18-rc5 .\" 2.6.18-rc5
only shmfs/tmpfs supports this; other filesystems return -ENOSYS. only shmfs/tmpfs supports this; other filesystems return -ENOSYS.
.\" Databases want to use this feature to drop a section of their .\" Databases want to use this feature to drop a section of their
.\" bufferpool (shared memory segments) - without writing back to .\" bufferpool (shared memory segments) - without writing back to
.\" disk/swap space. This feature is also useful for supporting .\" disk/swap space. This feature is also useful for supporting
.\" hot-plug memory on UML. .\" hot-plug memory on UML.
.TP .TP
.BR MADV_DONTFORK " (Since Linux 2.6.16)" .BR MADV_DONTFORK " (Since Linux 2.6.16)"
@ -108,22 +111,22 @@ the physical location of a pagei(s) if the parent writes to it after a
(Such page relocations cause problems for hardware that (Such page relocations cause problems for hardware that
DMAs into the page(s).) DMAs into the page(s).)
.\" [PATCH] madvise MADV_DONTFORK/MADV_DOFORK .\" [PATCH] madvise MADV_DONTFORK/MADV_DOFORK
.\" Currently, copy-on-write may change the physical address of .\" Currently, copy-on-write may change the physical address of
.\" a page even if the user requested that the page is pinned in .\" a page even if the user requested that the page is pinned in
.\" memory (either by mlock or by get_user_pages). This happens .\" memory (either by mlock or by get_user_pages). This happens
.\" if the process forks meanwhile, and the parent writes to that .\" if the process forks meanwhile, and the parent writes to that
.\" page. As a result, the page is orphaned: in case of .\" page. As a result, the page is orphaned: in case of
.\" get_user_pages, the application will never see any data hardware .\" get_user_pages, the application will never see any data hardware
.\" DMA's into this page after the COW. In case of mlock'd memory, .\" DMA's into this page after the COW. In case of mlock'd memory,
.\" the parent is not getting the realtime/security benefits of mlock. .\" the parent is not getting the realtime/security benefits of mlock.
.\" .\"
.\" In particular, this affects the Infiniband modules which do DMA from .\" In particular, this affects the Infiniband modules which do DMA from
.\" and into user pages all the time. .\" and into user pages all the time.
.\" .\"
.\" This patch adds madvise options to control whether memory range is .\" This patch adds madvise options to control whether memory range is
.\" inherited across fork. Useful e.g. for when hardware is doing DMA .\" inherited across fork. Useful e.g. for when hardware is doing DMA
.\" from/into these pages. Could also be useful to an application .\" from/into these pages. Could also be useful to an application
.\" wanting to speed up its forks by cutting large areas out of .\" wanting to speed up its forks by cutting large areas out of
.\" consideration. .\" consideration.
.TP .TP
.BR MADV_DOFORK " (Since Linux 2.6.16)" .BR MADV_DOFORK " (Since Linux 2.6.16)"
@ -132,9 +135,10 @@ Undo the effect of
restoring the default behaviour, whereby a mapping is inherited across restoring the default behaviour, whereby a mapping is inherited across
.BR fork (2). .BR fork (2).
.SH "RETURN VALUE" .SH "RETURN VALUE"
On success On success
.BR madvise () .BR madvise ()
returns zero. On error, it returns \-1 and returns zero.
On error, it returns \-1 and
.I errno .I errno
is set appropriately. is set appropriately.
.SH ERRORS .SH ERRORS
@ -146,14 +150,14 @@ A kernel resource was temporarily unavailable.
The map exists, but the area maps something that isn't a file. The map exists, but the area maps something that isn't a file.
.TP .TP
.B EINVAL .B EINVAL
The value The value
.IR len .IR len
is negative, is negative,
.\" .I len .\" .I len
.\" is zero, .\" is zero,
.I start .I start
is not page-aligned, is not page-aligned,
.I advice .I advice
is not a valid value, or the application is attempting is not a valid value, or the application is attempting
to release locked or shared pages (with MADV_DONTNEED). to release locked or shared pages (with MADV_DONTNEED).
.TP .TP
@ -179,10 +183,11 @@ The Linux implementation requires that the address
.I start .I start
be page-aligned, and allows be page-aligned, and allows
.I length .I length
to be zero. If there are some parts of the specified address range to be zero.
If there are some parts of the specified address range
that are not mapped, the Linux version of that are not mapped, the Linux version of
.BR madvise () .BR madvise ()
ignores them and applies the call to the rest (but returns ignores them and applies the call to the rest (but returns
.B ENOMEM .B ENOMEM
from the system call, as it should). from the system call, as it should).
.SH HISTORY .SH HISTORY
@ -194,7 +199,7 @@ POSIX.1b.
POSIX.1-2001 describes POSIX.1-2001 describes
.BR posix_madvise () .BR posix_madvise ()
with constants POSIX_MADV_NORMAL, etc., with constants POSIX_MADV_NORMAL, etc.,
with a behaviour close to that described here. with a behaviour close to that described here.
There is a similar There is a similar
.BR posix_fadvise () .BR posix_fadvise ()
for file access. for file access.

View File

@ -8,15 +8,15 @@
.\" manual under the conditions for verbatim copying, provided that the .\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a .\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one. .\" permission notice identical to this one.
.\" .\"
.\" Since the Linux kernel and libraries are constantly changing, this .\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no .\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" responsibility for errors or omissions, or for damages resulting from .\" responsibility for errors or omissions, or for damages resulting from
.\" the use of the information contained herein. .\" the use of the information contained herein.
.\" .\"
.\" Formatted or processed versions of this manual, if unaccompanied by .\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work. .\" the source, must acknowledge the copyright and authors of this work.
.\" .\"
.\" 2006-02-03, mtk, substantial wording changes and other improvements .\" 2006-02-03, mtk, substantial wording changes and other improvements
.\" .\"
.TH MBIND 2 "2006-02-07" "SuSE Labs" "Linux Programmer's Manual" .TH MBIND 2 "2006-02-07" "SuSE Labs" "Linux Programmer's Manual"
@ -26,41 +26,41 @@ mbind \- Set memory policy for a memory range
.nf .nf
.B "#include <numaif.h>" .B "#include <numaif.h>"
.sp .sp
.BI "int mbind(void *" start ", unsigned long " len ", int " policy , .BI "int mbind(void *" start ", unsigned long " len ", int " policy ,
.BI " unsigned long *" nodemask ", unsigned long " maxnode , .BI " unsigned long *" nodemask ", unsigned long " maxnode ,
.BI " unsigned " flags ); .BI " unsigned " flags );
.sp .sp
.BI "cc ... -lnuma" .BI "cc ... -lnuma"
.fi .fi
.SH DESCRIPTION .SH DESCRIPTION
.BR mbind () .BR mbind ()
sets the NUMA memory sets the NUMA memory
.I policy .I policy
for the memory range starting with for the memory range starting with
.I start .I start
and continuing for and continuing for
.IR len .IR len
bytes. bytes.
The memory of a NUMA machine is divided into multiple nodes. The memory of a NUMA machine is divided into multiple nodes.
The memory policy defines in which node memory is allocated. The memory policy defines in which node memory is allocated.
.BR mbind () .BR mbind ()
only has an effect for new allocations; if the pages inside only has an effect for new allocations; if the pages inside
the range have been already touched before setting the policy, the range have been already touched before setting the policy,
then the policy has no effect. then the policy has no effect.
Available policies are Available policies are
.BR MPOL_DEFAULT , .BR MPOL_DEFAULT ,
.BR MPOL_BIND , .BR MPOL_BIND ,
.BR MPOL_INTERLEAVE , .BR MPOL_INTERLEAVE ,
and and
.BR MPOL_PREFERRED . .BR MPOL_PREFERRED .
All policies except All policies except
.B MPOL_DEFAULT .B MPOL_DEFAULT
require the caller to specify the nodes to which the policy applies in the require the caller to specify the nodes to which the policy applies in the
.I nodemask .I nodemask
parameter. parameter.
.I nodemask .I nodemask
is a bitmask of nodes containing up to is a bitmask of nodes containing up to
.I maxnode .I maxnode
bits. bits.
The actual number of bytes transferred via this argument The actual number of bytes transferred via this argument
@ -68,46 +68,46 @@ is rounded up to the next multiple of
.IR "sizeof(unsigned long)" , .IR "sizeof(unsigned long)" ,
but the kernel will only use bits up to but the kernel will only use bits up to
.IR maxnode . .IR maxnode .
A NULL argument means an empty set of nodes. A NULL argument means an empty set of nodes.
The The
.B MPOL_DEFAULT .B MPOL_DEFAULT
policy is the default and means to use the underlying process policy policy is the default and means to use the underlying process policy
(which can be modified with (which can be modified with
.BR set_mempolicy (2)). .BR set_mempolicy (2)).
Unless the process policy has been changed this means to allocate Unless the process policy has been changed this means to allocate
memory on the node of the CPU that triggered the allocation. memory on the node of the CPU that triggered the allocation.
.I nodemask .I nodemask
should be specified as NULL. should be specified as NULL.
The The
.B MPOL_BIND .B MPOL_BIND
policy is a strict policy that restricts memory allocation to the policy is a strict policy that restricts memory allocation to the
nodes specified in nodes specified in
.IR nodemask . .IR nodemask .
There won't be allocations on other nodes. There won't be allocations on other nodes.
.B MPOL_INTERLEAVE .B MPOL_INTERLEAVE
interleaves allocations to the nodes specified in interleaves allocations to the nodes specified in
.IR nodemask . .IR nodemask .
This optimizes for bandwidth instead of latency. This optimizes for bandwidth instead of latency.
To be effective the memory area should be fairly large, To be effective the memory area should be fairly large,
at least 1MB or bigger. at least 1MB or bigger.
.B MPOL_PREFERRED .B MPOL_PREFERRED
sets the preferred node for allocation. sets the preferred node for allocation.
The kernel will try to allocate in this The kernel will try to allocate in this
node first and fall back to other nodes if the node first and fall back to other nodes if the
preferred nodes is low on free memory. preferred nodes is low on free memory.
Only the first node in the Only the first node in the
.I nodemask .I nodemask
is used. is used.
If no node is set in the mask, then the memory is allocated on If no node is set in the mask, then the memory is allocated on
the node of the CPU that triggered the allocation allocation). the node of the CPU that triggered the allocation allocation).
If If
.B MPOL_MF_STRICT .B MPOL_MF_STRICT
is passed in is passed in
.IR flags .IR flags
and and
.I policy .I policy
@ -120,64 +120,64 @@ In 2.6.16 or later the kernel will also try to move pages
to the requested node with this flag. to the requested node with this flag.
If If
.B MPOL_MF_MOVE .B MPOL_MF_MOVE
is passed in is passed in
.IR flags , .IR flags ,
then an attempt will be made to then an attempt will be made to
move all the pages in the mapping so that they follow the policy. move all the pages in the mapping so that they follow the policy.
Pages that are shared with other processes are not moved. Pages that are shared with other processes are not moved.
If If
.B MPOL_MF_STRICT .B MPOL_MF_STRICT
is also specified, then the call will fail with the error is also specified, then the call will fail with the error
.B EIO .B EIO
if some pages could not be moved. if some pages could not be moved.
If If
.B MPOL_MF_MOVE_ALL .B MPOL_MF_MOVE_ALL
is passed in is passed in
.IR flags , .IR flags ,
then all pages in the mapping will be moved regardless of whether then all pages in the mapping will be moved regardless of whether
other processes use the pages. other processes use the pages.
The calling process must be privileged The calling process must be privileged
.RB ( CAP_SYS_NICE ) .RB ( CAP_SYS_NICE )
to use this flag. to use this flag.
If If
.B MPOL_MF_STRICT .B MPOL_MF_STRICT
is also specified, then the call will fail with the error is also specified, then the call will fail with the error
.B EIO .B EIO
if some pages could not be moved. if some pages could not be moved.
.SH RETURN VALUE .SH RETURN VALUE
On success, On success,
.BR mbind () .BR mbind ()
returns 0; returns 0;
on error, \-1 is returned and on error, \-1 is returned and
.I errno .I errno
is set to indicate the error. is set to indicate the error.
.SH ERRORS .SH ERRORS
.TP .TP
.B EFAULT .B EFAULT
There was a unmapped hole in the specified memory range There was a unmapped hole in the specified memory range
or a passed pointer was not valid. or a passed pointer was not valid.
.TP .TP
.B EINVAL .B EINVAL
An invalid value was specified for An invalid value was specified for
.I flags .I flags
or or
.IR mode ; .IR mode ;
or or
.I start + len .I start + len
was less than was less than
.IR start ; .IR start ;
or or
.I policy .I policy
was was
.B MPOL_DEFAULT .B MPOL_DEFAULT
and and
.I nodemask .I nodemask
pointed to a non-empty set; pointed to a non-empty set;
or or
.I policy .I policy
was was
.B MPOL_BIND .B MPOL_BIND
or or
.B MPOL_INTERLEAVE .B MPOL_INTERLEAVE
@ -188,9 +188,9 @@ pointed to an empty set,
.B ENOMEM .B ENOMEM
System out of memory. System out of memory.
.TP .TP
.B EIO .B EIO
.B MPOL_MF_STRICT .B MPOL_MF_STRICT
was specified and an existing page was already on a node was specified and an existing page was already on a node
that does not follow the policy. that does not follow the policy.
.SH NOTES .SH NOTES
NUMA policy is not supported on file mappings. NUMA policy is not supported on file mappings.
@ -200,21 +200,21 @@ is ignored on huge page mappings right now.
It is unfortunate that the same flag, It is unfortunate that the same flag,
.BR MPOL_DEFAULT , .BR MPOL_DEFAULT ,
has different effects for has different effects for
.BR mbind (2) .BR mbind (2)
and and
.BR set_mempolicy (2). .BR set_mempolicy (2).
To select "allocation on the node of the CPU that To select "allocation on the node of the CPU that
triggered the allocation" (like triggered the allocation" (like
.BR set_mempolicy () .BR set_mempolicy ()
.BR MPOL_DEFAULT ) .BR MPOL_DEFAULT )
when calling when calling
.BR mbind (), .BR mbind (),
specify a specify a
.I policy .I policy
of of
.B MPOL_PREFERRED .B MPOL_PREFERRED
with an empty with an empty
.IR nodemask . .IR nodemask .
.SH "VERSIONS AND LIBRARY SUPPORT" .SH "VERSIONS AND LIBRARY SUPPORT"
The The
@ -222,12 +222,12 @@ The
.BR get_mempolicy (), .BR get_mempolicy (),
and and
.BR set_mempolicy () .BR set_mempolicy ()
system calls were added to the Linux kernel with version 2.6.7. system calls were added to the Linux kernel with version 2.6.7.
They are only available on kernels compiled with They are only available on kernels compiled with
.BR CONFIG_NUMA . .BR CONFIG_NUMA .
Support for huge page policy was added with 2.6.16. Support for huge page policy was added with 2.6.16.
For interleave policy to be effective on huge page mappings the For interleave policy to be effective on huge page mappings the
policied memory needs to be tens of megabytes or larger. policied memory needs to be tens of megabytes or larger.
.B MPOL_MF_MOVE .B MPOL_MF_MOVE
@ -236,31 +236,31 @@ and
are only available on Linux 2.6.16 and later. are only available on Linux 2.6.16 and later.
These system calls should not be used directly. These system calls should not be used directly.
Instead, the higher level interface provided by the Instead, the higher level interface provided by the
.BR numa (3) .BR numa (3)
functions in the functions in the
.I numactl .I numactl
package is recommended. package is recommended.
The The
.I numactl .I numactl
package is available at package is available at
.IR ftp://ftp.suse.com/pub/people/ak/numa/ . .IR ftp://ftp.suse.com/pub/people/ak/numa/ .
You can link with You can link with
.I -lnuma .I -lnuma
to get system call definitions. to get system call definitions.
.I libnuma .I libnuma
is available in the is available in the
.I numactl .I numactl
package. package.
This package also has the This package also has the
.I numaif.h .I numaif.h
header. header.
.SH CONFORMING TO .SH CONFORMING TO
This system call is Linux specific. This system call is Linux specific.
.SH SEE ALSO .SH SEE ALSO
.BR numa (3), .BR numa (3),
.BR numactl (8), .BR numactl (8),
.BR set_mempolicy (2), .BR set_mempolicy (2),
.BR get_mempolicy (2), .BR get_mempolicy (2),
.BR mmap (2) .BR mmap (2)

View File

@ -11,7 +11,7 @@
.\" manual under the conditions for verbatim copying, provided that the .\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a .\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one. .\" permission notice identical to this one.
.\" .\"
.\" Since the Linux kernel and libraries are constantly changing, this .\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no .\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" responsibility for errors or omissions, or for damages resulting from .\" responsibility for errors or omissions, or for damages resulting from
@ -19,7 +19,7 @@
.\" have taken the same level of care in the production of this manual, .\" have taken the same level of care in the production of this manual,
.\" which is licensed free of charge, as they might when working .\" which is licensed free of charge, as they might when working
.\" professionally. .\" professionally.
.\" .\"
.\" Formatted or processed versions of this manual, if unaccompanied by .\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work. .\" the source, must acknowledge the copyright and authors of this work.
.\" .\"
@ -42,13 +42,13 @@ mincore \- determine whether pages are resident in memory
.BI "int mincore(void *" start ", size_t " length ", unsigned char *" vec ); .BI "int mincore(void *" start ", size_t " length ", unsigned char *" vec );
.SH DESCRIPTION .SH DESCRIPTION
.BR mincore () .BR mincore ()
returns a vector that indicates whether pages returns a vector that indicates whether pages
of the calling process's virtual memory are resident in core (RAM), of the calling process's virtual memory are resident in core (RAM),
and so will not cause a disk access (page fault) if referenced. and so will not cause a disk access (page fault) if referenced.
The kernel returns residency information about the pages The kernel returns residency information about the pages
starting at the address starting at the address
.IR start , .IR start ,
and continuing for and continuing for
.I length .I length
bytes. bytes.
@ -57,7 +57,7 @@ The
argument must be a multiple of the system page size. argument must be a multiple of the system page size.
The The
.I length .I length
argument need not be a multiple of the page size, argument need not be a multiple of the page size,
but since residency information is returned for whole pages, but since residency information is returned for whole pages,
.I length .I length
is effectively rounded up to the next multiple of the page size. is effectively rounded up to the next multiple of the page size.
@ -68,9 +68,9 @@ The
.I vec .I vec
argument must point to an array containing at least argument must point to an array containing at least
(length+PAGE_SIZE-1) / PAGE_SIZE bytes. (length+PAGE_SIZE-1) / PAGE_SIZE bytes.
On return, On return,
the least significant bit of each byte will be set if the least significant bit of each byte will be set if
the corresponding page is currently resident in memory, the corresponding page is currently resident in memory,
and be clear otherwise. and be clear otherwise.
(The settings of the other bits in each byte are undefined; (The settings of the other bits in each byte are undefined;
these bits are reserved for possible later use.) these bits are reserved for possible later use.)
@ -121,8 +121,8 @@ contained unmapped memory.
.SH BUGS .SH BUGS
Before kernel 2.6.21, Before kernel 2.6.21,
.BR mincore () .BR mincore ()
did not return correct information for did not return correct information for
.B MAP_PRIVATE .B MAP_PRIVATE
mappings, or for non-linear mappings (established using mappings, or for non-linear mappings (established using
.BR remap_file_pages (2)). .BR remap_file_pages (2)).
.\" Linux (up to now, 2.6.5), .\" Linux (up to now, 2.6.5),
@ -143,8 +143,8 @@ mappings, or for non-linear mappings (established using
.SH "CONFORMING TO" .SH "CONFORMING TO"
.BR mincore () .BR mincore ()
is not specified in POSIX.1-2001, is not specified in POSIX.1-2001,
and it is not available on all Unix implementations. and it is not available on all Unix implementations.
.\" It is on at least NetBSD, FreeBSD, OpenBSD, Solaris 8, .\" It is on at least NetBSD, FreeBSD, OpenBSD, Solaris 8,
.\" AIX 5.1, SunOS 4.1 .\" AIX 5.1, SunOS 4.1
.SH HISTORY .SH HISTORY
The The

View File

@ -24,7 +24,8 @@ attempts to create a directory named
The parameter The parameter
.I mode .I mode
specifies the permissions to use. It is modified by the process's specifies the permissions to use.
It is modified by the process's
.I umask .I umask
in the usual way: the permissions of the created directory are in the usual way: the permissions of the created directory are
.RI ( mode " & ~" umask " & 0777)." .RI ( mode " & ~" umask " & 0777)."
@ -32,7 +33,8 @@ Other mode bits of the created directory depend on the operating system.
For Linux, see below. For Linux, see below.
The newly created directory will be owned by the effective user ID of the The newly created directory will be owned by the effective user ID of the
process. If the directory containing the file has the set-group-ID process.
If the directory containing the file has the set-group-ID
bit set, or if the filesystem is mounted with BSD group semantics, the bit set, or if the filesystem is mounted with BSD group semantics, the
new directory will inherit the group ownership from its parent; new directory will inherit the group ownership from its parent;
otherwise it will be owned by the effective group ID of the process. otherwise it will be owned by the effective group ID of the process.
@ -106,13 +108,14 @@ SVr4, BSD, POSIX.1-2001.
.\" SVr4 documents additional EIO, EMULTIHOP .\" SVr4 documents additional EIO, EMULTIHOP
.SH NOTES .SH NOTES
Under Linux apart from the permission bits, only the S_ISVTX mode bit Under Linux apart from the permission bits, only the S_ISVTX mode bit
is honored. That is, under Linux the created directory actually gets mode is honored.
That is, under Linux the created directory actually gets mode
.RI ( mode " & ~" umask " & 01777)." .RI ( mode " & ~" umask " & 01777)."
See also See also
.BR stat (2). .BR stat (2).
.PP .PP
There are many infelicities in the protocol underlying NFS. Some There are many infelicities in the protocol underlying NFS.
of these affect Some of these affect
.BR mkdir (). .BR mkdir ().
.SH "SEE ALSO" .SH "SEE ALSO"
.BR mkdir (1), .BR mkdir (1),

View File

@ -10,7 +10,7 @@
.\" manual under the conditions for verbatim copying, provided that the .\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a .\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one. .\" permission notice identical to this one.
.\" .\"
.\" Since the Linux kernel and libraries are constantly changing, this .\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no .\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" responsibility for errors or omissions, or for damages resulting from .\" responsibility for errors or omissions, or for damages resulting from
@ -18,7 +18,7 @@
.\" have taken the same level of care in the production of this manual, .\" have taken the same level of care in the production of this manual,
.\" which is licensed free of charge, as they might when working .\" which is licensed free of charge, as they might when working
.\" professionally. .\" professionally.
.\" .\"
.\" Formatted or processed versions of this manual, if unaccompanied by .\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work. .\" the source, must acknowledge the copyright and authors of this work.
.\" .\"
@ -40,37 +40,37 @@ system call operates in exactly the same way as
.BR mkdir (2), .BR mkdir (2),
except for the differences described in this manual page. except for the differences described in this manual page.
If the pathname given in If the pathname given in
.I pathname .I pathname
is relative, then it is interpreted relative to the directory is relative, then it is interpreted relative to the directory
referred to by the file descriptor referred to by the file descriptor
.IR dirfd .IR dirfd
(rather than relative to the current working directory of (rather than relative to the current working directory of
the calling process, as is done by the calling process, as is done by
.BR mkdir (2) .BR mkdir (2)
for a relative pathname). for a relative pathname).
If If
.I pathname .I pathname
is relative and is relative and
.I dirfd .I dirfd
is the special value is the special value
.BR AT_FDCWD , .BR AT_FDCWD ,
then then
.I pathname .I pathname
is interpreted relative to the current working is interpreted relative to the current working
directory of the calling process (like directory of the calling process (like
.BR mkdir (2)). .BR mkdir (2)).
If If
.IR pathname .IR pathname
is absolute, then is absolute, then
.I dirfd .I dirfd
is ignored. is ignored.
.SH "RETURN VALUE" .SH "RETURN VALUE"
On success, On success,
.BR mkdirat () .BR mkdirat ()
returns 0. returns 0.
On error, \-1 is returned and On error, \-1 is returned and
.I errno .I errno
is set to indicate the error. is set to indicate the error.
@ -79,7 +79,7 @@ The same errors that occur for
.BR mkdir (2) .BR mkdir (2)
can also occur for can also occur for
.BR mkdirat (). .BR mkdirat ().
The following additional errors can occur for The following additional errors can occur for
.BR mkdirat (): .BR mkdirat ():
.TP .TP
.B EBADF .B EBADF

View File

@ -70,7 +70,8 @@ If
already exists, or is a symbolic link, this call fails with an EEXIST error. already exists, or is a symbolic link, this call fails with an EEXIST error.
The newly created node will be owned by the effective user ID of the The newly created node will be owned by the effective user ID of the
process. If the directory containing the node has the set-group-ID process.
If the directory containing the node has the set-group-ID
bit set, or if the filesystem is mounted with BSD group semantics, the bit set, or if the filesystem is mounted with BSD group semantics, the
new node will inherit the group ownership from its parent directory; new node will inherit the group ownership from its parent directory;
otherwise it will be owned by the effective group ID of the process. otherwise it will be owned by the effective group ID of the process.
@ -144,14 +145,15 @@ does not support the type of node requested.
.I pathname .I pathname
refers to a file on a read-only filesystem. refers to a file on a read-only filesystem.
.SH "CONFORMING TO" .SH "CONFORMING TO"
SVr4, 4.4BSD, POSIX.1-2001 (but see below). SVr4, 4.4BSD, POSIX.1-2001 (but see below).
.\" The Linux version differs from the SVr4 version in that it .\" The Linux version differs from the SVr4 version in that it
.\" does not require root permission to create pipes, also in that no .\" does not require root permission to create pipes, also in that no
.\" EMULTIHOP, ENOLINK, or EINTR error is documented. .\" EMULTIHOP, ENOLINK, or EINTR error is documented.
.SH NOTES .SH NOTES
POSIX.1-2001 says: "The only portable use of POSIX.1-2001 says: "The only portable use of
.BR mknod () .BR mknod ()
is to create a FIFO-special file. If is to create a FIFO-special file.
If
.I mode .I mode
is not S_IFIFO or is not S_IFIFO or
.I dev .I dev
@ -166,8 +168,8 @@ and FIFOs with
.BR mkfifo (2). .BR mkfifo (2).
.\" Unix domain sockets with .BR socket " (and " bind ), .\" Unix domain sockets with .BR socket " (and " bind ),
There are many infelicities in the protocol underlying NFS. Some There are many infelicities in the protocol underlying NFS.
of these affect Some of these affect
.BR mknod (). .BR mknod ().
.SH "SEE ALSO" .SH "SEE ALSO"
.BR fcntl (2), .BR fcntl (2),

View File

@ -10,7 +10,7 @@
.\" manual under the conditions for verbatim copying, provided that the .\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a .\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one. .\" permission notice identical to this one.
.\" .\"
.\" Since the Linux kernel and libraries are constantly changing, this .\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no .\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" responsibility for errors or omissions, or for damages resulting from .\" responsibility for errors or omissions, or for damages resulting from
@ -18,14 +18,14 @@
.\" have taken the same level of care in the production of this manual, .\" have taken the same level of care in the production of this manual,
.\" which is licensed free of charge, as they might when working .\" which is licensed free of charge, as they might when working
.\" professionally. .\" professionally.
.\" .\"
.\" Formatted or processed versions of this manual, if unaccompanied by .\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work. .\" the source, must acknowledge the copyright and authors of this work.
.\" .\"
.\" .\"
.TH MKNODAT 2 2006-04-06 "Linux 2.6.16" "Linux Programmer's Manual" .TH MKNODAT 2 2006-04-06 "Linux 2.6.16" "Linux Programmer's Manual"
.SH NAME .SH NAME
mknodat \- create a special or ordinary file relative to a directory mknodat \- create a special or ordinary file relative to a directory
file descriptor file descriptor
.SH SYNOPSIS .SH SYNOPSIS
.nf .nf
@ -42,37 +42,37 @@ system call operates in exactly the same way as
.BR mknod (2), .BR mknod (2),
except for the differences described in this manual page. except for the differences described in this manual page.
If the pathname given in If the pathname given in
.I pathname .I pathname
is relative, then it is interpreted relative to the directory is relative, then it is interpreted relative to the directory
referred to by the file descriptor referred to by the file descriptor
.IR dirfd .IR dirfd
(rather than relative to the current working directory of (rather than relative to the current working directory of
the calling process, as is done by the calling process, as is done by
.BR mknod (2) .BR mknod (2)
for a relative pathname). for a relative pathname).
If If
.I pathname .I pathname
is relative and is relative and
.I dirfd .I dirfd
is the special value is the special value
.BR AT_FDCWD , .BR AT_FDCWD ,
then then
.I pathname .I pathname
is interpreted relative to the current working is interpreted relative to the current working
directory of the calling process (like directory of the calling process (like
.BR mknod (2)). .BR mknod (2)).
If If
.IR pathname .IR pathname
is absolute, then is absolute, then
.I dirfd .I dirfd
is ignored. is ignored.
.SH "RETURN VALUE" .SH "RETURN VALUE"
On success, On success,
.BR mknodat () .BR mknodat ()
returns 0. returns 0.
On error, \-1 is returned and On error, \-1 is returned and
.I errno .I errno
is set to indicate the error. is set to indicate the error.
@ -81,7 +81,7 @@ The same errors that occur for
.BR mknod (2) .BR mknod (2)
can also occur for can also occur for
.BR mknodat (). .BR mknodat ().
The following additional errors can occur for The following additional errors can occur for
.BR mknodat (): .BR mknodat ():
.TP .TP
.B EBADF .B EBADF

View File

@ -44,7 +44,7 @@ mlock, munlock, mlockall, munlockall \- lock and unlock memory
and and
.BR mlockall () .BR mlockall ()
respectively lock part or all of the calling process's virtual address respectively lock part or all of the calling process's virtual address
space into RAM, preventing that memory from being paged to the space into RAM, preventing that memory from being paged to the
swap area. swap area.
.BR munlock () .BR munlock ()
and and
@ -61,7 +61,7 @@ locks pages in the address range starting at
and continuing for and continuing for
.I len .I len
bytes. bytes.
All pages that contain a part of the specified address range are All pages that contain a part of the specified address range are
guaranteed to be resident in RAM when the call returns successfully; guaranteed to be resident in RAM when the call returns successfully;
the pages are guaranteed to stay in RAM until later unlocked. the pages are guaranteed to stay in RAM until later unlocked.
@ -76,9 +76,11 @@ memory range can be moved to external swap space again by the kernel.
.SS "mlockall() and munlockall()" .SS "mlockall() and munlockall()"
.BR mlockall () .BR mlockall ()
locks all pages mapped into the address space of the locks all pages mapped into the address space of the
calling process. This includes the pages of the code, data and stack calling process.
This includes the pages of the code, data and stack
segment, as well as shared libraries, user space kernel data, shared segment, as well as shared libraries, user space kernel data, shared
memory, and memory\-mapped files. All mapped pages are guaranteed memory, and memory\-mapped files.
All mapped pages are guaranteed
to be resident in RAM when the call returns successfully; to be resident in RAM when the call returns successfully;
the pages are guaranteed to stay in RAM until later unlocked. the pages are guaranteed to stay in RAM until later unlocked.
@ -93,7 +95,8 @@ the process.
.TP .TP
.B MCL_FUTURE .B MCL_FUTURE
Lock all pages which will become mapped into the address space of the Lock all pages which will become mapped into the address space of the
process in the future. These could be for instance new pages required process in the future.
These could be for instance new pages required
by a growing heap and stack as well as new memory mapped files or by a growing heap and stack as well as new memory mapped files or
shared memory regions. shared memory regions.
.PP .PP
@ -107,7 +110,7 @@ may fail if it would cause the number of locked bytes to exceed
the permitted maximum (see below). the permitted maximum (see below).
In the same circumstances, stack growth may likewise fail: In the same circumstances, stack growth may likewise fail:
the kernel will deny stack expansion and deliver a the kernel will deny stack expansion and deliver a
.BR SIGSEGV .BR SIGSEGV
signal to the process. signal to the process.
.BR munlockall () .BR munlockall ()
@ -115,13 +118,16 @@ unlocks all pages mapped into the address space of the
calling process. calling process.
.SH "NOTES" .SH "NOTES"
Memory locking has two main applications: real-time algorithms and Memory locking has two main applications: real-time algorithms and
high-security data processing. Real-time applications require high-security data processing.
Real-time applications require
deterministic timing, and, like scheduling, paging is one major cause deterministic timing, and, like scheduling, paging is one major cause
of unexpected program execution delays. Real-time applications will of unexpected program execution delays.
Real-time applications will
usually also switch to a real-time scheduler with usually also switch to a real-time scheduler with
.BR sched_setscheduler (2). .BR sched_setscheduler (2).
Cryptographic security software often handles critical bytes like Cryptographic security software often handles critical bytes like
passwords or secret keys as data structures. As a result of paging, passwords or secret keys as data structures.
As a result of paging,
these secrets could be transferred onto a persistent swap store medium, these secrets could be transferred onto a persistent swap store medium,
where they might be accessible to the enemy long after the security where they might be accessible to the enemy long after the security
software has erased the secrets in RAM and terminated. software has erased the secrets in RAM and terminated.
@ -134,11 +140,12 @@ Real-time processes that are using
to prevent delays on page faults should reserve enough to prevent delays on page faults should reserve enough
locked stack pages before entering the time-critical section, locked stack pages before entering the time-critical section,
so that no page fault can be caused by function calls. so that no page fault can be caused by function calls.
This can be achieved by calling a function that allocates a This can be achieved by calling a function that allocates a
sufficiently large automatic variable (an array) and writes to the sufficiently large automatic variable (an array) and writes to the
memory occupied by this array in order to touch these stack pages. memory occupied by this array in order to touch these stack pages.
This way, enough pages will be mapped for the stack and can be This way, enough pages will be mapped for the stack and can be
locked into RAM. The dummy writes ensure that not even copy-on-write locked into RAM.
The dummy writes ensure that not even copy-on-write
page faults can occur in the critical section. page faults can occur in the critical section.
Memory locks are not inherited by a child created via Memory locks are not inherited by a child created via
@ -208,7 +215,7 @@ This limit is not enforced if the process is privileged
half of RAM. half of RAM.
.\" In the case of mlock(), this check is somewhat buggy: it doesn't .\" In the case of mlock(), this check is somewhat buggy: it doesn't
.\" take into account whether the to-be-locked range overlaps with .\" take into account whether the to-be-locked range overlaps with
.\" already locked pages. Thus, suppose we allocate .\" already locked pages. Thus, suppose we allocate
.\" (num_physpages / 4 + 1) of memory, and lock those pages once using .\" (num_physpages / 4 + 1) of memory, and lock those pages once using
.\" mlock(), and then lock the *same* page range a second time. .\" mlock(), and then lock the *same* page range a second time.
.\" In the case, the second mlock() call will fail, since the check .\" In the case, the second mlock() call will fail, since the check
@ -218,13 +225,13 @@ half of RAM.
.B EPERM .B EPERM
(Linux 2.6.9 and later) the caller was not privileged (Linux 2.6.9 and later) the caller was not privileged
.RB ( CAP_IPC_LOCK ) .RB ( CAP_IPC_LOCK )
and its and its
.B RLIMIT_MEMLOCK .B RLIMIT_MEMLOCK
soft resource limit was 0. soft resource limit was 0.
.TP .TP
.B EPERM .B EPERM
(Linux 2.6.8 and earlier) (Linux 2.6.8 and earlier)
The calling process has insufficient privilege to call The calling process has insufficient privilege to call
.BR munlockall (). .BR munlockall ().
Under Linux the Under Linux the
.B CAP_IPC_LOCK .B CAP_IPC_LOCK
@ -270,17 +277,17 @@ flag to be inherited across a
.BR fork (2). .BR fork (2).
This was rectified in kernel 2.4.18. This was rectified in kernel 2.4.18.
Since kernel 2.6.9, if a privileged process calls Since kernel 2.6.9, if a privileged process calls
.I mlockall(MCL_FUTURE) .I mlockall(MCL_FUTURE)
and later drops privileges (loses the and later drops privileges (loses the
.B CAP_IPC_LOCK .B CAP_IPC_LOCK
capability by, for example, capability by, for example,
setting its effective UID to a non-zero value), setting its effective UID to a non-zero value),
then subsequent memory allocations (e.g., then subsequent memory allocations (e.g.,
.BR mmap (2), .BR mmap (2),
.BR brk (2)) .BR brk (2))
will fail if the will fail if the
.B RLIMIT_MEMLOCK .B RLIMIT_MEMLOCK
resource limit is encountered. resource limit is encountered.
.\" See the following LKML thread: .\" See the following LKML thread:
.\" http://marc.theaimsgroup.com/?l=linux-kernel&m=113801392825023&w=2 .\" http://marc.theaimsgroup.com/?l=linux-kernel&m=113801392825023&w=2
@ -293,8 +300,8 @@ and
.BR munlock () .BR munlock ()
are available, are available,
.B _POSIX_MEMLOCK_RANGE .B _POSIX_MEMLOCK_RANGE
is defined in <unistd.h> and the number of bytes in a page is defined in <unistd.h> and the number of bytes in a page
can be determined from the constant can be determined from the constant
.B PAGESIZE .B PAGESIZE
(if defined) in <limits.h> or by calling (if defined) in <limits.h> or by calling
.IR sysconf(_SC_PAGESIZE) . .IR sysconf(_SC_PAGESIZE) .

View File

@ -11,7 +11,7 @@
.\" manual under the conditions for verbatim copying, provided that the .\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a .\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one. .\" permission notice identical to this one.
.\" .\"
.\" Since the Linux kernel and libraries are constantly changing, this .\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no .\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" responsibility for errors or omissions, or for damages resulting from .\" responsibility for errors or omissions, or for damages resulting from
@ -19,7 +19,7 @@
.\" have taken the same level of care in the production of this manual, .\" have taken the same level of care in the production of this manual,
.\" which is licensed free of charge, as they might when working .\" which is licensed free of charge, as they might when working
.\" professionally. .\" professionally.
.\" .\"
.\" Formatted or processed versions of this manual, if unaccompanied by .\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work. .\" the source, must acknowledge the copyright and authors of this work.
.\" .\"
@ -50,7 +50,7 @@ mmap, munmap \- map or unmap files or devices into memory
.fi .fi
.SH DESCRIPTION .SH DESCRIPTION
.BR mmap () .BR mmap ()
creates a new mapping in the virtual address space of creates a new mapping in the virtual address space of
the calling process. the calling process.
The starting address for the new mapping is specified in The starting address for the new mapping is specified in
.IR start . .IR start .
@ -63,8 +63,8 @@ If
is NULL, is NULL,
then the kernel chooses the address at which to create the mapping; then the kernel chooses the address at which to create the mapping;
this is the most portable method of creating a new mapping. this is the most portable method of creating a new mapping.
If If
.I start .I start
is not NULL, is not NULL,
then the kernel takes it as a hint about where to place the mapping; then the kernel takes it as a hint about where to place the mapping;
on Linux, the mapping will be created at the next higher page boundary. on Linux, the mapping will be created at the next higher page boundary.
@ -72,7 +72,7 @@ The address of the new mapping is returned as the result of the call.
The contents of a file mapping (as opposed to an anonymous mapping; see The contents of a file mapping (as opposed to an anonymous mapping; see
.B MAP_ANONYMOUS .B MAP_ANONYMOUS
below), are initialised using below), are initialised using
.I length .I length
bytes starting at offset bytes starting at offset
.I offset .I offset
@ -84,7 +84,7 @@ must be a multiple of the page size as returned by
.LP .LP
The The
.I prot .I prot
argument describes the desired memory protection of the mapping argument describes the desired memory protection of the mapping
(and must not conflict with the open mode of the file). (and must not conflict with the open mode of the file).
It is either It is either
.B PROT_NONE .B PROT_NONE
@ -107,12 +107,12 @@ The
argument determines whether updates to the mapping argument determines whether updates to the mapping
are visible to other processes mapping the same region, are visible to other processes mapping the same region,
and whether updates are caried through to the underlying file. and whether updates are caried through to the underlying file.
This behaviour is determined by including exactly one This behaviour is determined by including exactly one
of the following values in of the following values in
.IR flags : .IR flags :
.TP 1.1i .TP 1.1i
.B MAP_SHARED .B MAP_SHARED
Share this mapping. Share this mapping.
Updates to the mapping are visible to other processes that map this file, Updates to the mapping are visible to other processes that map this file,
and are carried through to the underlying file. and are carried through to the underlying file.
The file may not actually be updated until The file may not actually be updated until
@ -158,8 +158,8 @@ the use of this option is discouraged.
This flag is ignored. This flag is ignored.
.\" Introduced in 1.1.36, removed in 1.3.24. .\" Introduced in 1.1.36, removed in 1.3.24.
(Long ago, it signalled that attempts to write to the underlying file (Long ago, it signalled that attempts to write to the underlying file
should fail with should fail with
.BR ETXTBUSY . .BR ETXTBUSY .
But this was a source of denial-of-service attacks.) But this was a source of denial-of-service attacks.)
.TP .TP
.B MAP_EXECUTABLE .B MAP_EXECUTABLE
@ -171,16 +171,16 @@ This flag is ignored.
.\" MAP_DENYWRITE? .\" MAP_DENYWRITE?
.TP .TP
.B MAP_NORESERVE .B MAP_NORESERVE
Do not reserve swap space for this mapping. Do not reserve swap space for this mapping.
When swap space is reserved, one has the guarantee When swap space is reserved, one has the guarantee
that it is possible to modify the mapping. that it is possible to modify the mapping.
When swap space is not reserved one might get SIGSEGV upon a write When swap space is not reserved one might get SIGSEGV upon a write
if no physical memory is available. if no physical memory is available.
See also the discussion of the file See also the discussion of the file
.I /proc/sys/vm/overcommit_memory .I /proc/sys/vm/overcommit_memory
in in
.BR proc (5). .BR proc (5).
In kernels before 2.6, this flag only had effect for In kernels before 2.6, this flag only had effect for
private writable mappings. private writable mappings.
.TP .TP
.BR MAP_LOCKED " (since Linux 2.5.37)" .BR MAP_LOCKED " (since Linux 2.5.37)"
@ -190,13 +190,13 @@ This flag is ignored in older kernels.
.\" If set, the mapped pages will not be swapped out. .\" If set, the mapped pages will not be swapped out.
.TP .TP
.B MAP_GROWSDOWN .B MAP_GROWSDOWN
Used for stacks. Used for stacks.
Indicates to the kernel virtual memory system that the mapping Indicates to the kernel virtual memory system that the mapping
should extend downwards in memory. should extend downwards in memory.
.TP .TP
.B MAP_ANON .B MAP_ANON
Synonym for Synonym for
.BR MAP_ANONYMOUS . .BR MAP_ANONYMOUS .
Deprecated. Deprecated.
.TP .TP
.B MAP_ANONYMOUS .B MAP_ANONYMOUS
@ -207,40 +207,41 @@ The
and and
.I offset .I offset
arguments are ignored; arguments are ignored;
however, some implementations require however, some implementations require
.I fd .I fd
to be \-1 if to be \-1 if
.B MAP_ANONYMOUS .B MAP_ANONYMOUS
(or (or
.BR MAP_ANON ) .BR MAP_ANON )
is specified, is specified,
and portable applications should ensure this. and portable applications should ensure this.
The use of The use of
.B MAP_ANONYMOUS .B MAP_ANONYMOUS
in conjunction with in conjunction with
.B MAP_SHARED .B MAP_SHARED
is only supported on Linux since kernel 2.4. is only supported on Linux since kernel 2.4.
.TP .TP
.B MAP_FILE .B MAP_FILE
Compatibility flag. Ignored. Compatibility flag.
Ignored.
.TP .TP
.B MAP_32BIT .B MAP_32BIT
Put the mapping into the first 2GB of the process address space. Put the mapping into the first 2GB of the process address space.
Ignored when Ignored when
.B MAP_FIXED .B MAP_FIXED
is set. is set.
This flag is currently only supported on x86-64 for 64bit programs. This flag is currently only supported on x86-64 for 64bit programs.
.TP .TP
.BR MAP_POPULATE " (since Linux 2.5.46)" .BR MAP_POPULATE " (since Linux 2.5.46)"
Populate (prefault) page tables for a file mapping, Populate (prefault) page tables for a file mapping,
by performing read-ahead on the file. by performing read-ahead on the file.
Later accesses to the mapping will not be blocked by page faults. Later accesses to the mapping will not be blocked by page faults.
.TP .TP
.BR MAP_NONBLOCK " (since Linux 2.5.46)" .BR MAP_NONBLOCK " (since Linux 2.5.46)"
Only meaningful in conjunction with Only meaningful in conjunction with
.BR MAP_POPULATE . .BR MAP_POPULATE .
Don't perform read-ahead: Don't perform read-ahead:
only create page tables entries for pages only create page tables entries for pages
that are already present in RAM. that are already present in RAM.
.LP .LP
Of the above flags, only Of the above flags, only
@ -248,7 +249,7 @@ Of the above flags, only
is specified in POSIX.1-2001. is specified in POSIX.1-2001.
However, most systems also support However, most systems also support
.B MAP_ANONYMOUS .B MAP_ANONYMOUS
(or its synonym (or its synonym
.BR MAP_ANON ). .BR MAP_ANON ).
.LP .LP
Some systems document the additional flags MAP_AUTOGROW, MAP_AUTORESRV, Some systems document the additional flags MAP_AUTOGROW, MAP_AUTORESRV,
@ -260,9 +261,11 @@ is preserved across
.BR fork (2), .BR fork (2),
with the same attributes. with the same attributes.
.LP .LP
A file is mapped in multiples of the page size. For a file that is not A file is mapped in multiples of the page size.
For a file that is not
a multiple of the page size, the remaining memory is zeroed when mapped, a multiple of the page size, the remaining memory is zeroed when mapped,
and writes to that region are not written out to the file. The effect of and writes to that region are not written out to the file.
The effect of
changing the size of the underlying file of a mapping on the pages that changing the size of the underlying file of a mapping on the pages that
correspond to added or removed regions of the file is unspecified. correspond to added or removed regions of the file is unspecified.
@ -270,15 +273,19 @@ The
.BR munmap () .BR munmap ()
system call deletes the mappings for the specified address range, and system call deletes the mappings for the specified address range, and
causes further references to addresses within the range to generate causes further references to addresses within the range to generate
invalid memory references. The region is also automatically unmapped invalid memory references.
when the process is terminated. On the other hand, closing the file The region is also automatically unmapped
when the process is terminated.
On the other hand, closing the file
descriptor does not unmap the region. descriptor does not unmap the region.
.LP .LP
The address The address
.I start .I start
must be a multiple of the page size. All pages containing a part must be a multiple of the page size.
All pages containing a part
of the indicated range are unmapped, and subsequent references of the indicated range are unmapped, and subsequent references
to these pages will generate SIGSEGV. It is not an error if the to these pages will generate SIGSEGV.
It is not an error if the
indicated range does not contain any mapped pages. indicated range does not contain any mapped pages.
For file-backed mappings, the For file-backed mappings, the
@ -292,17 +299,17 @@ The
.I st_ctime .I st_ctime
and and
.I st_mtime .I st_mtime
field for a file mapped with field for a file mapped with
.B PROT_WRITE .B PROT_WRITE
and and
.B MAP_SHARED .B MAP_SHARED
will be updated after will be updated after
a write to the mapped region, and before a subsequent a write to the mapped region, and before a subsequent
.BR msync () .BR msync ()
with the with the
.B MS_SYNC .B MS_SYNC
or or
.BR MS_ASYNC .BR MS_ASYNC
flag, if one occurs. flag, if one occurs.
.SH "RETURN VALUE" .SH "RETURN VALUE"
On success, On success,
@ -310,7 +317,7 @@ On success,
returns a pointer to the mapped area. returns a pointer to the mapped area.
On error, the value On error, the value
.B MAP_FAILED .B MAP_FAILED
(that is, (that is,
.I "(void *) \-1)" .I "(void *) \-1)"
is returned, and is returned, and
.I errno .I errno
@ -319,14 +326,14 @@ On success,
.BR munmap () .BR munmap ()
returns 0, on failure \-1, and returns 0, on failure \-1, and
.I errno .I errno
is set (probably to is set (probably to
.BR EINVAL ). .BR EINVAL ).
.SH NOTES .SH NOTES
It is architecture dependent whether It is architecture dependent whether
.B PROT_READ .B PROT_READ
implies implies
.B PROT_EXEC .B PROT_EXEC
or not. or not.
Portable programs should always set Portable programs should always set
.B PROT_EXEC .B PROT_EXEC
if they intend to execute code in the new mapping. if they intend to execute code in the new mapping.
@ -334,20 +341,20 @@ if they intend to execute code in the new mapping.
.TP .TP
.B EACCES .B EACCES
A file descriptor refers to a non-regular file. A file descriptor refers to a non-regular file.
Or Or
.B MAP_PRIVATE .B MAP_PRIVATE
was requested, but was requested, but
.I fd .I fd
is not open for reading. is not open for reading.
Or Or
.B MAP_SHARED .B MAP_SHARED
was requested and was requested and
.B PROT_WRITE .B PROT_WRITE
is set, but is set, but
.I fd .I fd
is not open in read/write (O_RDWR) mode. is not open in read/write (O_RDWR) mode.
Or Or
.B PROT_WRITE .B PROT_WRITE
is set, but the file is append-only. is set, but the file is append-only.
.TP .TP
.B EAGAIN .B EAGAIN
@ -356,7 +363,7 @@ The file has been locked, or too much memory has been locked (see
.TP .TP
.B EBADF .B EBADF
.I fd .I fd
is not a valid file descriptor (and is not a valid file descriptor (and
.B MAP_ANONYMOUS .B MAP_ANONYMOUS
was not set). was not set).
.TP .TP
@ -407,7 +414,7 @@ was mounted no-exec.
.\" (Since 2.4.25 / 2.6.0.) .\" (Since 2.4.25 / 2.6.0.)
.TP .TP
.B ETXTBSY .B ETXTBSY
.B MAP_DENYWRITE .B MAP_DENYWRITE
was set but the object specified by was set but the object specified by
.I fd .I fd
is open for writing. is open for writing.
@ -439,8 +446,8 @@ SVr4, 4.4BSD, POSIX.1-2001.
.\" SVr4 documents additional error codes ENXIO and ENODEV. .\" SVr4 documents additional error codes ENXIO and ENODEV.
.\" SUSv2 documents additional error codes EMFILE and EOVERFLOW. .\" SUSv2 documents additional error codes EMFILE and EOVERFLOW.
.SH BUGS .SH BUGS
On Linux there are no guarantees like those suggested above under On Linux there are no guarantees like those suggested above under
.BR MAP_NORESERVE . .BR MAP_NORESERVE .
By default, any process can be killed By default, any process can be killed
at any moment when the system runs out of memory. at any moment when the system runs out of memory.
@ -451,7 +458,7 @@ flag only has effect if
is specified as is specified as
.BR PROT_NONE . .BR PROT_NONE .
SUSv3 specifies that SUSv3 specifies that
.BR mmap () .BR mmap ()
should fail if should fail if
.I length .I length

Some files were not shown because too many files have changed in this diff Show More