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
been incorporated in changes in this release:
Andi Kleen <andi@firstfloor.org>
John Heffner <jheffner@psc.edu>
Apologies if I missed anyone!
@ -15,9 +17,6 @@ Apologies if I missed anyone!
New pages
---------
Andi Kleen <andi@firstfloor.org>
John Heffner <jheffner@psc.edu>
Global changes
--------------

View File

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

View File

@ -11,7 +11,7 @@
.\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one.
.\"
.\"
.\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" 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,
.\" which is licensed free of charge, as they might when working
.\" professionally.
.\"
.\"
.\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work.
.\"
@ -40,9 +40,10 @@ _exit, _Exit \- terminate the current process
.SH DESCRIPTION
The function
.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
inherited by process 1,
inherited by process 1,
.IR init ,
and the process's parent is sent a
.B SIGCHLD
@ -74,7 +75,7 @@ The function
is like \fBexit\fP(), but does not call any
functions registered with
.BR atexit ()
or
or
.BR on_exit ().
Whether it flushes
standard I/O buffers and removes temporary files created with
@ -83,11 +84,12 @@ is implementation dependent.
On the other hand,
.BR _exit ()
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
calling \fB_exit\fP().
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"
.BR execve (2),
.BR exit_group (2),

View File

@ -69,7 +69,7 @@ and is listening for connections after a
The argument
.I addr
is a pointer to a
is a pointer to a
.I sockaddr
structure.
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
.I addr
is determined by the socket's address family (see
.BR socket (2)
.BR socket (2)
and the respective protocol man pages).
The
.I addrlen
@ -85,7 +85,8 @@ argument is a value-result argument: it should initially contain the
size of the structure pointed to by
.IR addr ;
on return it will contain the actual length (in bytes) of the address
returned. When
returned.
When
.I addr
is NULL nothing is filled in.
.PP
@ -93,10 +94,11 @@ If no pending
connections are present on the queue, and the socket is not marked as
non-blocking,
.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,
.BR accept ()
fails with the error EAGAIN.
fails with the error EAGAIN.
.PP
In order to be notified of incoming connections on a socket, you can use
.BR select (2)
@ -105,8 +107,8 @@ or
A readable event will be delivered when a new connection is attempted and you
may then call
.BR accept ()
to get a socket for that connection. Alternatively, you can set the socket
to deliver
to get a socket for that connection.
Alternatively, you can set the socket to deliver
.B SIGIO
when activity occurs on a socket; see
.BR socket (7)
@ -117,11 +119,13 @@ such as
DECNet,
.BR accept ()
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
implied by closing the new socket. Currently only
DECNet
has these semantics on Linux.
implied by closing the new socket.
Currently only
DECNet
has these semantics on Linux.
.SH NOTES
There may not always be a connection waiting after a
.B SIGIO
@ -152,19 +156,21 @@ On error, \-1 is returned, and
.I errno
is set appropriately.
.SH "ERROR HANDLING"
Linux
Linux
.BR accept ()
passes already-pending network errors on the new socket
as an error code from
.BR accept ().
passes already-pending network errors on the new socket
as an error code from
.BR accept ().
This behaviour differs from other BSD socket
implementations. For reliable operation the application should detect
the network errors defined for the protocol after
implementations.
For reliable operation the application should detect
the network errors defined for the protocol after
.BR accept ()
and treat
them like
them like
.BR EAGAIN
by retrying. In case of TCP/IP these are
by retrying.
In case of TCP/IP these are
.BR ENETDOWN ,
.BR EPROTO ,
.BR ENOPROTOOPT ,
@ -190,7 +196,7 @@ A connection has been aborted.
.TP
.B EINTR
The system call was interrupted by a signal that was caught
before a valid connection arrived.
before a valid connection arrived.
.TP
.B EINVAL
Socket is not listening for connections, or
@ -208,7 +214,7 @@ The descriptor references a file, not a socket.
.TP
.B EOPNOTSUPP
The referenced socket is not of type
.BR SOCK_STREAM .
.BR SOCK_STREAM .
.PP
.BR accept ()
may fail if:
@ -219,7 +225,7 @@ The
argument is not in a writable part of the user address space.
.TP
.B ENOBUFS, ENOMEM
Not enough free memory.
Not enough free memory.
This often means that the memory allocation is limited by the socket buffer
limits, not by the system memory.
.TP
@ -234,7 +240,8 @@ may fail if:
Firewall rules forbid connection.
.PP
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
.BR ENOSR ,
.BR ESOCKTNOSUPPORT ,
@ -244,18 +251,18 @@ The value
.B ERESTARTSYS
may be seen during a trace.
.SH "CONFORMING TO"
SVr4, 4.4BSD,
SVr4, 4.4BSD,
.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
.\" (EBADF, ENOTSOCK, EOPNOTSUPP, EWOULDBLOCK, EFAULT).
.\" POSIX.1-2001 documents errors
.\" POSIX.1-2001 documents errors
.\" 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.
.LP
On Linux, the new socket returned by
.BR accept ()
.BR accept ()
does \fInot\fP inherit file status flags such as
.BR O_NONBLOCK
and
@ -264,9 +271,9 @@ from the listening socket.
This behaviour differs from the canonical BSD sockets implementation.
.\" Some testing seems to show that Tru64 5.1 and HP-UX 11 also
.\" do not inherit file status flags -- MTK Jun 05
Portable programs should not rely on inheritance or non-inheritance
of file status flags and always explicitly set all required flags on
the socket returned from
Portable programs should not rely on inheritance or non-inheritance
of file status flags and always explicitly set all required flags on
the socket returned from
.BR accept ().
.SH NOTE
The third argument of
@ -281,14 +288,16 @@ Quoting Linus Torvalds:
.\" .I fails: only italicizes a single line
"_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
obviously not too many) complained to them very loudly indeed. Making
it a size_t is completely broken, exactly because size_t very seldom is
the same size as "int" on 64-bit architectures, for example. And it
obviously not too many) complained to them very loudly indeed.
Making it a size_t is completely broken, exactly because size_t very
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
interface is.
Anyway, the POSIX people eventually got a clue, and created "socklen_t".
interface is.
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 felt it had to have a named type for some unfathomable reason
(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
.\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one.
.\"
.\"
.\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" 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,
.\" which is licensed free of charge, as they might when working
.\" professionally.
.\"
.\"
.\" Formatted or processed versions of this manual, if unaccompanied by
.\" 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
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
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)
call will still fail.
If the process has appropriate privileges, an implementation may
indicate success for
.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"
On success (all requested permissions granted), zero is returned.
On error (at least one bit in
@ -155,7 +157,7 @@ executed.
.SH "LINUX NOTES"
In kernels before 2.6.20,
.BR access ()
ignored the effect of the
ignored the effect of the
.B MS_NOEXEC
flag if it was used to
.BR mount (2)

View File

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

View File

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

View File

@ -11,7 +11,7 @@
.\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one.
.\"
.\"
.\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" 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,
.\" which is licensed free of charge, as they might when working
.\" professionally.
.\"
.\"
.\" Formatted or processed versions of this manual, if unaccompanied by
.\" 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 );
.fi
.SH DESCRIPTION
.BR alarm ()
arranges for a
.BR alarm ()
arranges for a
.B SIGALRM
signal to be delivered to the process in
.I seconds
@ -60,7 +60,7 @@ alarm was due to be delivered, or zero if there was no previously
scheduled alarm.
.SH NOTES
.BR alarm ()
and
and
.BR setitimer ()
share the same timer; calls to one will interfere with use of the
other.

View File

@ -10,7 +10,7 @@
.\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one.
.\"
.\"
.\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" 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,
.\" which is licensed free of charge, as they might when working
.\" professionally.
.\"
.\"
.\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work.
.\"
@ -27,7 +27,7 @@
alloc_hugepages, free_hugepages \- allocate or free huge pages
.SH SYNOPSIS
.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 );
.\" asmlinkage unsigned long sys_alloc_hugepages(int key, unsigned long addr,
.\" 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.
.LP
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
several sizes. These system calls serve to map huge pages into the
and huge pages (2 or 4 MiB).
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.
Huge pages are locked into memory, and are not swapped.
.LP
The
.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.
When positive the pages are shared with other applications using the same
.IR key ,
@ -75,8 +78,8 @@ Addresses must be properly aligned.
.LP
The
.I len
parameter is the length of the required segment. It must be
a multiple of the huge page size.
parameter is the length of the required segment.
It must be a multiple of the huge page size.
.LP
The
.I prot
@ -87,18 +90,21 @@ The
.I flag
parameter is ignored, unless
.I key
is positive. In that case, if
is positive.
In that case, if
.I flag
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.
.IR
.IR
.SH "RETURN VALUE"
On success,
.BR alloc_hugepages ()
returns the allocated virtual address, and
.BR free_hugepages ()
returns zero. On error, \-1 is returned, and
returns zero.
On error, \-1 is returned, and
.I errno
is set appropriately.
.SH ERRORS
@ -108,7 +114,8 @@ The system call is not supported on this kernel.
.SH "CONFORMING TO"
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
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
on a future kernel.
.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
in the three variables HugePages_Total, HugePages_Free, Hugepagesize.
.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
using
.BR mmap ()

View File

@ -10,7 +10,7 @@
.\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one.
.\"
.\"
.\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" 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,
.\" which is licensed free of charge, as they might when working
.\" professionally.
.\"
.\"
.\" Formatted or processed versions of this manual, if unaccompanied by
.\" 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"
@ -36,13 +36,13 @@ function sets architecture specific process or thread state.
.I code
selects a subfunction
and passes argument
.I addr
to it.
.I addr
to it.
.LP
Sub functions for x86-64 are:
.TP
.B ARCH_SET_FS
Set the 64bit base for the
Set the 64bit base for the
.I FS
register to
.IR addr .
@ -50,14 +50,14 @@ register to
.B ARCH_GET_FS
Return the 64bit base value for the
.I FS
register of the current thread in the
register of the current thread in the
.I unsigned long
pointed to by the
.I address
pointed to by the
.I address
parameter
.TP
.B ARCH_SET_GS
Set the 64bit base for the
Set the 64bit base for the
.I GS
register to
.IR addr .
@ -65,10 +65,10 @@ register to
.B ARCH_GET_GS
Return the 64bit base value for the
.I GS
register of the current thread in the
register of the current thread in the
.I unsigned long
pointed to by the
.I address
pointed to by the
.I address
parameter.
.SH NOTES
.BR arch_prctl ()
@ -79,13 +79,14 @@ The 64bit base changes when a new 32bit segment selector is loaded.
.B ARCH_SET_GS
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
an LDT with
.BR modify_ldt (2)
or using the
or using the
.BR set_thread_area (2)
system call in a 2.5 kernel.
system call in a 2.5 kernel.
.BR arch_prctl ()
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
@ -99,16 +100,16 @@ As of version 2.3.5, glibc provides no prototype for
You have to declare it yourself for now.
This may be fixed in future glibc versions.
.I FS
.I FS
may be already used by the threading library.
.SH ERRORS
.TP
.B EFAULT
.I addr
.I addr
points to an unmapped address or is outside the process address space.
.TP
.B EINVAL
.I code
.I code
is not a valid subcommand.
.TP
.B EPERM
@ -118,7 +119,7 @@ is outside the process address space.
Man page written by Andi Kleen.
.SH "CONFORMING TO"
.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.
.SH "SEE ALSO"
.BR mmap (2),

View File

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

View File

@ -66,7 +66,7 @@ is set to
On success,
.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
.I errno
is set to
@ -75,7 +75,7 @@ is set to
4.3BSD; SUSv1, marked LEGACY in SUSv2, removed in POSIX.1-2001.
.BR brk ()
and
and
.BR sbrk ()
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).
@ -94,24 +94,24 @@ The return value described above for
.BR brk ()
is the behaviour provided by the glibc wrapper function for the Linux
.BR brk ()
system call.
(On most other implementations, the return value from
.BR brk ()
system call.
(On most other implementations, the return value from
.BR brk ()
is the same.)
However,
However,
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
.I brk(0)
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.
On Linux,
On Linux,
.BR sbrk ()
is implemented as a library function that uses the
.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.
.SH "SEE ALSO"
.BR execve (2),

View File

@ -33,7 +33,8 @@ cacheflush \- flush contents of instruction and/or data cache
.SH DESCRIPTION
.BR cacheflush ()
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
.B ICACHE
Flush the instruction cache.
@ -42,12 +43,14 @@ Flush the instruction cache.
Write back to memory and invalidate the affected valid cache lines.
.TP
.B BCACHE
Same as
Same as
.BR (ICACHE|DCACHE) .
.SH "RETURN VALUE"
.BR cacheflush ()
returns 0 on success or \-1 on error. If errors are detected,
errno will indicate the error.
returns 0 on success or \-1 on error.
If errors are detected,
.I errno
will indicate the error.
.SH ERRORS
.TP
.B EFAULT
@ -56,12 +59,12 @@ Some or all of the address range addr to (addr+nbytes-1) is not accessible.
.B EINVAL
cache parameter is not one of ICACHE, DCACHE, or BCACHE.
.SH BUGS
The current implementation ignores the
.I addr
and
.I nbytes
arguments.
The current implementation ignores the
.I addr
and
.I nbytes
arguments.
Therefore, the whole cache is always flushed.
.SH NOTE
This system call is only available on MIPS based systems. It should
not be used in programs intended to be portable.
This system call is only available on MIPS based systems.
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.
.PP
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
these functions (in particular the format of the
.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
use the easier-to-use interfaces
.BR capsetp (3)
and
and
.BR capgetp (3).
.SS "Current details"
Now that you have been warned, some current kernel details.
@ -66,46 +67,48 @@ typedef struct __user_cap_data_struct {
.fi
.in -4n
.sp
The calls will return EINVAL, and set the
.I version
The calls will return EINVAL, and set the
.I version
field of
.I hdr
to _LINUX_CAPABILITY_VERSION when another version was specified.
The calls operate on the capabilities of the thread specified by the
.I pid
The calls operate on the capabilities of the thread specified by the
.I pid
field of
.I hdr
when that is non-zero, or on the capabilities of the calling thread if
.I pid
is 0.
If
If
.I pid
refers to a single-threaded process, then
refers to a single-threaded process, then
.I pid
can be specified as a traditional process 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).
For
.BR capset (),
For
.BR capset (),
.I pid
can also be: \-1, meaning perform the change on all threads except the
caller and
.IR init (8);
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.
For details on the data, see
.BR capabilities (7).
.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
is set appropriately.
.SH ERRORS
.TP
.B EFAULT
Bad memory address. Neither of
Bad memory address.
Neither of
.I hdrp
and
.I datap
@ -126,12 +129,12 @@ to modify the capabilities of a thread other than itself,
but lacked sufficient privilege; the
.B CAP_SETPCAP
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
own capabilities by specifying the
.I pid
field as a non-zero value (i.e., the value returned by
.BR getpid (2))
.BR getpid (2))
instead of 0.)
.TP
.B ESRCH
@ -147,5 +150,5 @@ library and is available from here:
.B ftp://ftp.kernel.org/pub/linux/libs/security/linux-privs
.SH "SEE ALSO"
.BR clone (2),
.BR gettid (2),
.BR gettid (2),
.BR capabilities (7)

View File

@ -10,7 +10,7 @@
.\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one.
.\"
.\"
.\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" 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,
.\" which is licensed free of charge, as they might when working
.\" professionally.
.\"
.\"
.\" Formatted or processed versions of this manual, if unaccompanied by
.\" 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
open file descriptor.
.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
is set appropriately.
.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
.BR chdir ()
are listed below:
.TP
.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
.IR path .
(See also
@ -113,7 +115,7 @@ The current working directory is left unchanged by
The prototype for
.BR fchdir ()
is only available if
.B _BSD_SOURCE
.B _BSD_SOURCE
is defined, or
.B _XOPEN_SOURCE
is defined with the value 500.

View File

@ -10,7 +10,7 @@
.\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one.
.\"
.\"
.\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" 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,
.\" which is licensed free of charge, as they might when working
.\" professionally.
.\"
.\"
.\" Formatted or processed versions of this manual, if unaccompanied by
.\" 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
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.
.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
is set appropriately.
.SH ERRORS
Depending on the file system, other errors can be returned. The more
general errors for
Depending on the file system, other errors can be returned.
The more general errors for
.BR chmod ()
are listed below:
.TP

View File

@ -11,7 +11,7 @@
.\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one.
.\"
.\"
.\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" 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,
.\" which is licensed free of charge, as they might when working
.\" professionally.
.\"
.\"
.\" Formatted or processed versions of this manual, if unaccompanied by
.\" 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.
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
.BR chown ();
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
.BR chown ().
.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
is set appropriately.
.SH ERRORS
Depending on the file system, other errors can be returned. The more
general errors for
Depending on the file system, other errors can be returned.
The more general errors for
.BR chown ()
are listed below.
.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
.\" ENOMEM. POSIX.1 does not document ENOMEM or ELOOP error conditions.
.\" fchown():
.\" SVr4 documents additional EINVAL, EIO, EINTR, and ENOLINK
.\" SVr4 documents additional EINVAL, EIO, EINTR, and ENOLINK
.\" error conditions.
.SH RESTRICTIONS
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()
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
been changed to allow access for a user and the time where the file can
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
.\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one.
.\"
.\"
.\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" 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,
.\" which is licensed free of charge, as they might when working
.\" professionally.
.\"
.\"
.\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work.
.\"
@ -41,8 +41,8 @@ chroot \- change root directory
.BR chroot ()
changes the root directory to that specified in
.IR path .
This directory will be used for pathnames beginning with /. The root
directory is inherited by all children of the current process.
This directory will be used for pathnames beginning with /.
The root directory is inherited by all children of the current process.
Only a privileged process (Linux: one with the
.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
descriptors may allow access to files outside the chroot tree.
.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
is set appropriately.
.SH ERRORS
Depending on the file system, other errors can be returned. The more
general errors are listed below:
Depending on the file system, other errors can be returned.
The more general errors are listed below:
.TP
.B EACCES
Search permission is denied on a component of the path prefix.
@ -103,7 +104,7 @@ is not a directory.
.B EPERM
The caller has insufficient privilege.
.SH "CONFORMING TO"
SVr4, 4.4BSD, SUSv2 (marked LEGACY).
SVr4, 4.4BSD, SUSv2 (marked LEGACY).
This function is not part of POSIX.1-2001.
.\" SVr4 documents additional EINTR, ENOLINK and EMULTIHOP 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
.BR jail ()
system call.
.\" FIXME -- eventually say something about containers,
.\" FIXME -- eventually say something about containers,
.\" virtual servers, etc.?
.SH "SEE ALSO"
.BR chdir (2),

View File

@ -13,7 +13,7 @@
.\" Mostly upgraded to 2.4.x
.\" Added prototype for sys_clone() plus description
.\" 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"
.\" Added CLONE_PTRACE and CLONE_VFORK
.\" Added EPERM and EINVAL error codes
@ -57,7 +57,7 @@ creates a new process, in a manner similar to
.BR fork (2).
.BR clone ()
is a library function layered on top
of the underlying
of the underlying
.BR clone ()
system call, hereinafter referred to as
.BR sys_clone .
@ -67,13 +67,14 @@ is given towards the end of this page.
Unlike
.BR fork (2),
these calls
these calls
allow the child process to share parts of its execution context with
the calling process, such as the memory space, the table of file
descriptors, and the table of signal handlers. (Note that on this manual
page, "calling process" normally corresponds to "parent process". But see
the description of
.B CLONE_PARENT
descriptors, and the table of signal handlers.
(Note that on this manual
page, "calling process" normally corresponds to "parent process".
But see the description of
.B CLONE_PARENT
below.)
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.
When the child process is created with
.BR clone (),
.BR clone (),
it executes the function
application
.IR fn ( arg ).
.IR fn ( arg ).
(This differs from
.BR fork (2),
.BR fork (2),
where execution continues in the child from the point
of the
.BR fork (2)
of the
.BR fork (2)
call.)
The
.I fn
@ -102,22 +103,23 @@ argument is passed to the
.I fn
function.
When the
When the
.IR fn ( arg )
function application returns, the child process terminates. The
integer returned by
function application returns, the child process terminates.
The integer returned by
.I fn
is the exit code for the child process. The child process may also
terminate explicitly by calling
is the exit code for the child process.
The child process may also terminate explicitly by calling
.BR exit (2)
or after receiving a fatal signal.
The
.I child_stack
argument specifies the location of the stack used by the child
process. Since the child and calling process may share memory,
argument specifies the location of the stack used by the child process.
Since the child and calling process may share memory,
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
space to
.BR clone ().
@ -135,11 +137,11 @@ sent to the parent when the child dies.
If this signal is specified as anything other than
.BR SIGCHLD ,
then the parent process must specify the
.B __WALL
or
.B __WALL
or
.B __WCLONE
options when waiting for the child with
.BR wait (2).
options when waiting for the child with
.BR wait (2).
If no signal is specified, then the parent process is not signaled
when the child terminates.
@ -161,20 +163,22 @@ is not set, then (as with
.BR fork (2))
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),
which is signaled when the child terminates, so that
if
if
.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.
.TP
.B CLONE_FS
If
.B CLONE_FS
is set, the caller and the child processes share the same file system
information. This includes the root of the file system, the current
working directory, and the umask. Any call to
information.
This includes the root of the file system, the current
working directory, and the umask.
Any call to
.BR chroot (2),
.BR chdir (2),
or
@ -182,7 +186,7 @@ or
performed by the calling process or the child process also affects the
other process.
If
If
.B CLONE_FS
is not set, the child process works on a copy of the file system
information of the calling process at the time of the
@ -199,7 +203,7 @@ If
.B CLONE_FILES
is set, the calling process and the child processes share the same file
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.
Similarly, if one of the processes closes a file descriptor,
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
.BR clone ().
(The duplicated file descriptors in the child refer to the
same open file descriptions (see
same open file descriptions (see
.BR open (2))
as the corresponding file descriptors in the calling process.)
Subsequent operations that open or close file descriptors,
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.
.TP
.BR CLONE_NEWNS " (since Linux 2.4.19)"
Start the child in a new namespace.
Every process lives in a namespace. The
Every process lives in a namespace.
The
.I namespace
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)
or
.BR clone (2)
@ -265,12 +271,15 @@ call.
If
.B CLONE_SIGHAND
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)
to change the behavior associated with a signal, the behavior is
changed in the other process as well. However, the calling process and child
to change the behavior associated with a signal, the behavior is
changed in the other process as well.
However, the calling process and child
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)
without affecting the other process.
@ -279,7 +288,8 @@ If
is not set, the child process inherits a copy of the signal handlers
of the calling process at the time
.BR clone ()
is called. Calls to
is called.
Calls to
.BR sigaction (2)
performed later by one of the processes have no effect on the other
process.
@ -293,14 +303,14 @@ if
is specified
.TP
.B CLONE_PTRACE
If
If
.B CLONE_PTRACE
is specified, and the calling process is being traced,
then trace the child also (see
.BR ptrace (2)).
.TP
.BR CLONE_UNTRACED " (since Linux 2.5.46)"
If
If
.B CLONE_UNTRACED
is specified, then a tracing process cannot force
.B CLONE_PTRACE
@ -324,10 +334,10 @@ resources via a call to
.BR execve (2)
or
.BR _exit (2)
(as with
(as with
.BR vfork (2)).
If
If
.B CLONE_VFORK
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
@ -337,7 +347,8 @@ in any particular order.
If
.B CLONE_VM
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.
Moreover, any memory mapping or unmapping performed with
.BR mmap (2)
@ -357,9 +368,11 @@ processes do not affect the other, as with
.BR CLONE_PID " (obsolete)"
If
.B CLONE_PID
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
of not much use. Since 2.3.21 this flag can be
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
of not much use.
Since 2.3.21 this flag can be
specified only by the system boot process (PID 0).
It disappeared in Linux 2.5.16.
.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.
Internally, this shared PID is the so-called
thread group identifier (TGID) for the thread group.
Since Linux 2.4, calls to
Since Linux 2.4, calls to
.BR getpid (2)
return the TGID of the caller.
@ -389,7 +402,7 @@ and a thread can obtain
its own TID using
.BR gettid (2).
When a call is made to
When a call is made to
.BR clone ()
without specifying
.BR CLONE_THREAD ,
@ -403,13 +416,13 @@ A new thread created with
.B CLONE_THREAD
has the same parent process as the caller of
.BR clone ()
(i.e., like
(i.e., like
.BR CLONE_PARENT ),
so that calls to
.BR getppid (2)
return the same value for all of the threads in a thread group.
When a
.B CLONE_THREAD
.B CLONE_THREAD
thread terminates, the thread that created it using
.BR clone ()
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
whole process and the signals that are pending for the calling thread.
If
If
.BR kill (2)
is used to send a signal to a thread group,
and the thread group has installed a handler for the signal, then
the handler will be invoked in exactly one, arbitrarily selected
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),
the kernel will arbitrarily select one of these threads
to receive a signal sent using
to receive a signal sent using
.BR kill (2).
.TP
.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.
The address involved may be changed by the
.BR set_tid_address (2)
system call. This is used by threading libraries.
system call.
This is used by threading libraries.
.SS "sys_clone"
The
.B sys_clone
system call corresponds more closely to
.BR fork (2)
in that execution in the child continues from the point of the
call. Thus,
call.
Thus,
.B sys_clone
only requires the
.I flags
and
and
.I child_stack
arguments, which have the same meaning as for
.BR clone ().
arguments, which have the same meaning as for
.BR clone ().
(Note that the order of these arguments differs from
.BR clone ().)
.BR clone ().)
Another difference for
Another difference for
.B sys_clone
is that the
.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
the stack. In this case, for correct operation, the
the stack.
In this case, for correct operation, the
.B CLONE_VM
option should not be specified.
@ -555,7 +571,8 @@ will be written in case CLONE_CHILD_SETTID was specified.
.\" gettid() returns current->pid;
.\" getpid() returns current->tgid;
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
.I errno
will be set appropriately.
@ -592,9 +609,9 @@ were specified in
.IR flags .
.TP
.B EINVAL
Returned by
Returned by
.BR clone ()
when a zero value is specified for
when a zero value is specified for
.IR child_stack .
.TP
.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
.B CLONE_THREAD
flag implied the
.B CLONE_PARENT
.B CLONE_PARENT
flag (as in kernel 2.6).
For a while there was
.B CLONE_DETACHED
For a while there was
.B CLONE_DETACHED
(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
together with
.B CLONE_THREAD
together with
.B CLONE_THREAD
disappeared.
This flag is still defined, but has no effect.
@ -641,7 +658,7 @@ On x86,
should not be called through vsyscall, but directly through
.IR "int $0x80" .
On IA-64, a different system call is used:
On IA-64, a different system call is used:
.nf
.BI "int clone2(int (*" "fn" ")(void *), "
@ -653,7 +670,7 @@ On IA-64, a different system call is used:
.PP
The
.BR clone2 ()
system call operates in the same way as
system call operates in the same way as
.BR clone (),
except that
.I child_stack_base
@ -671,10 +688,10 @@ calls are Linux specific and should not be used in programs
intended to be portable.
.SH BUGS
Versions of the GNU C library that include the NPTL threading library
contain a wrapper function for
contain a wrapper function for
.BR getpid ()
that performs caching of PIDs.
In programs linked against such libraries, calls to
In programs linked against such libraries, calls to
.BR getpid ()
may return the same value, even when the threads were not created using
.B CLONE_THREAD

View File

@ -11,7 +11,7 @@
.\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one.
.\"
.\"
.\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" 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,
.\" which is licensed free of charge, as they might when working
.\" professionally.
.\"
.\"
.\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work.
.\"
@ -79,24 +79,28 @@ call was interrupted by a signal.
.B EIO
An I/O error occurred.
.SH "CONFORMING TO"
SVr4, 4.3BSD, POSIX.1-2001.
SVr4, 4.3BSD, POSIX.1-2001.
.\" SVr4 documents an additional ENOLINK error condition.
.SH NOTES
Not checking the return value of
Not checking the return value of
.BR close ()
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
.BR write (2)
operation are first reported at the final
.BR close ().
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.
.PP
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
to flush the buffers when the stream is closed. If you need to be sure that
saved to disk, as the kernel defers writes.
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
.BR fsync (2).
(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
.\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one.
.\"
.\"
.\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" 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,
.\" which is licensed free of charge, as they might when working
.\" professionally.
.\"
.\"
.\" Formatted or processed versions of this manual, if unaccompanied by
.\" 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
.IR serv_addr .
The
.IR addrlen
.IR addrlen
argument specifies the size of
.IR serv_addr .
The format of the address in
@ -100,7 +100,8 @@ is of type
then
.I serv_addr
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
or
.BR SOCK_SEQPACKET ,
@ -112,21 +113,22 @@ Generally, connection-based protocol sockets may successfully
.BR connect ()
only once; connectionless protocol sockets may use
.BR connect ()
multiple times to change their association. Connectionless sockets may
dissolve the association by connecting to an address with the
multiple times to change their association.
Connectionless sockets may
dissolve the association by connecting to an address with the
.I sa_family
member of
.B sockaddr
set to
.B sockaddr
set to
.BR AF_UNSPEC .
.SH "RETURN VALUE"
If the connection or binding succeeds, zero is returned. On error, \-1 is
returned, and
If the connection or binding succeeds, zero is returned.
On error, \-1 is returned, and
.I errno
is set appropriately.
.SH ERRORS
The following are general socket errors only. There may be other
domain-specific error codes.
The following are general socket errors only.
There may be other domain-specific error codes.
.TP
.B EACCES
For Unix domain sockets, which are identified by pathname:
@ -137,7 +139,7 @@ in the path prefix.
.BR path_resolution (2).)
.TP
.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
firewall rule.
.TP
@ -145,17 +147,18 @@ firewall rule.
Local address is already in use.
.TP
.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
field.
.TP
.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
see the
see the
.B net.ipv4.ip_local_port_range
sysctl in
.BR ip (7)
sysctl in
.BR ip (7)
on how to increase the number of local ports.
.TP
.B EALREADY
@ -173,25 +176,27 @@ The socket structure address is outside the user's address space.
.TP
.B EINPROGRESS
The socket is non-blocking and the connection cannot be completed
immediately. It is possible to
immediately.
It is possible to
.BR select (2)
or
.BR poll (2)
for completion by selecting the socket for writing. After
or
.BR poll (2)
for completion by selecting the socket for writing.
After
.BR select (2)
indicates writability, use
.BR getsockopt (2)
to read the
to read the
.B SO_ERROR
option at level
option at level
.B SOL_SOCKET
to determine whether
to determine whether
.BR connect ()
completed successfully
completed successfully
.RB ( SO_ERROR
is zero) or unsuccessfully
is zero) or unsuccessfully
.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).
.TP
.B EINTR
@ -209,23 +214,25 @@ Network is unreachable.
The file descriptor is not associated with a socket.
.TP
.B ETIMEDOUT
Timeout while attempting connection. The server may be too
busy to accept new connections. Note that for IP sockets the timeout may
Timeout while attempting connection.
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.
.SH "CONFORMING TO"
SVr4, 4.4BSD, (the
.BR connect ()
function first appeared in 4.2BSD), POSIX.1-2001.
function first appeared in 4.2BSD), POSIX.1-2001.
.\" SVr4 documents the additional
.\" general error codes
.\" .BR EADDRNOTAVAIL ,
.\" .BR EINVAL ,
.\" .BR EAFNOSUPPORT ,
.\" .BR EALREADY ,
.\" .BR EINTR ,
.\" .BR EPROTOTYPE ,
.\" general error codes
.\" .BR EADDRNOTAVAIL ,
.\" .BR EINVAL ,
.\" .BR EAFNOSUPPORT ,
.\" .BR EALREADY ,
.\" .BR EINTR ,
.\" .BR EPROTOTYPE ,
.\" and
.\" .BR ENOSR .
.\" .BR ENOSR .
.\" It also
.\" documents many additional error conditions not described here.
.SH NOTE
@ -234,7 +241,7 @@ The third argument of
is in reality an
.I int
(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 ,
also used by glibc.
See also

View File

@ -2,7 +2,7 @@
.\" This file is distributed according to the GNU General Public License.
.\" 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
.\"
.TH CREATE_MODULE 2 "2002" Linux "Linux Module Support"
@ -49,7 +49,7 @@ capability).
.BR create_module ()
is Linux specific.
.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.
.\" Removed in Linux-2.5.48
.SH "SEE ALSO"

View File

@ -2,7 +2,7 @@
.\" This file is distributed according to the GNU General Public License.
.\" 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
.\"
.TH DELETE_MODULE 2 "2002" Linux "Linux Module Support"
@ -23,7 +23,8 @@ is NULL,
all unused modules marked auto-clean will be removed.
This system call requires privilege.
.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
is set appropriately.
.SH ERRORS

View File

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

View File

@ -34,13 +34,15 @@ Open an
file descriptor by requesting the kernel allocate
an event backing store dimensioned for
.I size
descriptors. The
descriptors.
The
.I size
is not the maximum size of the backing store but
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
.B epoll
interface. The file descriptor returned by
interface.
The file descriptor returned by
.BR epoll_create (2)
must be closed by using
.BR close (2).
@ -48,7 +50,7 @@ must be closed by using
When successful,
.BR epoll_create (2)
returns a non-negative integer identifying the descriptor.
When an error occurs,
When an error occurs,
.BR epoll_create (2)
returns \-1 and
.I errno

View File

@ -74,9 +74,9 @@ The associated file is available for
operations.
.TP
.BR EPOLLRDHUP " (since kernel 2.6.17)"
Stream socket peer closed connection,
Stream socket peer closed 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.)
.TP
.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.
The default behaviour for
.B epoll
is Level Triggered. See
is Level Triggered.
See
.BR epoll (7)
for more detailed information about Edge and Level Triggered event
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
will be reported by the
.B epoll
interface. The user must call
interface.
The user must call
.BR epoll_ctl (2)
with
.B EPOLL_CTL_MOD
@ -157,9 +159,10 @@ The
is ignored and can be NULL (but see BUGS below).
.RE
.SH "RETURN VALUE"
When successful,
When successful,
.BR epoll_ctl (2)
returns zero. When an error occurs,
returns zero.
When an error occurs,
.BR epoll_ctl (2)
returns \-1 and
.I errno
@ -180,12 +183,12 @@ is already in
.IR epfd .
.TP
.B EINVAL
.IR epfd
.IR epfd
is not an
.B epoll
file descriptor,
or
.IR fd
.IR fd
is the same as
.IR epfd ,
or the requested operation
@ -216,13 +219,13 @@ is Linux specific, and was introduced in kernel 2.5.44.
.SH BUGS
In kernel versions before 2.6.9, the
.B EPOLL_CTL_DEL
operation required a non-NULL pointer in
operation required a non-NULL pointer in
.IR event ,
even though this argument is ignored.
Since kernel 2.6.9,
.I event
can be specified as NULL
when using
when using
.BR EPOLL_CTL_DEL .
.SH "SEE ALSO"
.BR epoll_create (2),

View File

@ -19,7 +19,7 @@
.\" 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.
.\"
.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
.B #include <sys/epoll.h>
.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);
.fi
.SH DESCRIPTION
@ -39,7 +39,8 @@ file descriptor
.I epfd
for a maximum time of
.I timeout
milliseconds. The memory area pointed to by
milliseconds.
The memory area pointed to by
.I events
will contain the events that will be available for the caller.
Up to
@ -48,7 +49,8 @@ are returned by
.BR epoll_wait (2).
The
.I maxevents
parameter must be greater than zero. Specifying a
parameter must be greater than zero.
Specifying a
.I timeout
of \-1 makes
.BR epoll_wait (2)
@ -56,7 +58,7 @@ wait indefinitely, while specifying a
.I timeout
equal to zero makes
.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).
The
.I struct epoll_event
@ -87,12 +89,13 @@ while the
.I events
member will contain the returned event bit field.
.SH "RETURN VALUE"
When successful,
When successful,
.BR epoll_wait (2)
returns the number of file descriptors ready for the requested I/O, or zero
if no file descriptor became ready during the requested
.I timeout
milliseconds. When an error occurs,
milliseconds.
When an error occurs,
.BR epoll_wait (2)
returns \-1 and
.I errno
@ -115,7 +118,7 @@ requested events occurred or the
expired.
.TP
.B EINVAL
.IR epfd
.IR epfd
is not an
.B epoll
file descriptor, or

View File

@ -11,7 +11,7 @@
.\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one.
.\"
.\"
.\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" 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,
.\" which is licensed free of charge, as they might when working
.\" professionally.
.\"
.\"
.\" Formatted or processed versions of this manual, if unaccompanied by
.\" 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.
\fIenvp\fP is an array of strings, conventionally of the form
\fBkey=value\fR, which are passed as environment to the new
program. Both \fIargv\fP and \fIenvp\fP must be terminated by a null
pointer. The argument vector and environment can be accessed by the
\fBkey=value\fR, which are passed as environment to the new program.
Both \fIargv\fP and \fIenvp\fP must be terminated by a null pointer.
The argument vector and environment can be accessed by the
called program's main function, when it is defined as \fBint main(int
argc, char *argv[], char *envp[])\fR.
\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
loaded.
loaded.
If the current program is being ptraced, a \fBSIGTRAP\fP is sent to it
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;
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.
If the executable is an a.out dynamically-linked
If the executable is an a.out dynamically-linked
binary executable containing
shared-library stubs, the Linux dynamic linker
.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
and link the executable with them.
If the executable is a dynamically-linked ELF executable, the
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
version 5, or \fI/lib/ld-linux.so.2\fR for binaries linked with the
GNU libc version 2.
@ -106,7 +107,7 @@ in
The set of pending signals is cleared
.RB ( sigpending (2)).
.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.
.IP * 4
Any alternate signal stack is not preserved
@ -141,27 +142,27 @@ Exit handlers are not preserved
.RB ( atexit (3),
.BR on_exit (3)).
.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.
The following Linux-specific process attributes are also
The following Linux-specific process attributes are also
not preserved during an
.BR execve ():
.IP * 4
The
The
.BR prctl (2)
.B PR_SET_DUMPABLE
.B PR_SET_DUMPABLE
flag is set,
unless a set-user-ID or set-group ID program is being executed,
in which case it is cleared.
.IP * 4
The
The
.BR prctl (2)
.B PR_SET_KEEPCAPS
flag is cleared.
.IP * 4
The process name, as set by
.BR prctl (2)
.BR PR_SET_NAME
.BR PR_SET_NAME
(and displayed by
.IR "ps -o comm" ),
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
is executed at program start-up.
.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.
POSIX.1-2001 specifies one exception: if SIGCHLD is being ignored,
then an implementation may leave the disposition unchanged or
POSIX.1-2001 specifies one exception: if SIGCHLD is being ignored,
then an implementation may leave the disposition unchanged or
reset it to the default; Linux does the former.
.IP * 4
Any outstanding asynchronous I/O operations are cancelled
.RB ( aio_read (3),
.BR aio_write (3)).
.IP * 4
For the handling of capabilities during
For the handling of capabilities during
.BR execve (2),
see
.BR capabilities (7).
@ -200,9 +201,9 @@ is set appropriately.
.SH ERRORS
.TP
.B E2BIG
The total number of bytes in the environment
The total number of bytes in the environment
.RI ( envp )
and argument list
and argument list
.RI ( argv )
is too large.
.TP
@ -256,7 +257,7 @@ is too long.
The system limit on the total number of open files has been reached.
.TP
.B ENOENT
The file
The file
.I filename
or a script or ELF interpreter does not exist, or a shared library
needed for file or interpreter cannot be found.
@ -277,7 +278,7 @@ or a script or ELF interpreter is not a directory.
.B EPERM
The file system is mounted
.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.
.TP
.B EPERM
@ -287,9 +288,9 @@ file has the set-user-ID or set-group-ID bit set.
.B ETXTBSY
Executable was open for writing by one or more processes.
.SH "CONFORMING TO"
SVr4, 4.3BSD, POSIX.1-2001.
SVr4, 4.3BSD, POSIX.1-2001.
POSIX.1-2001 does not document the #! behavior
but is otherwise compatible.
but is otherwise compatible.
.\" SVr4 documents additional error
.\" conditions EAGAIN, EINTR, ELIBACC, ENOLINK, EMULTIHOP; POSIX does not
.\" 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
.I nosuid
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
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 ()
successfully.
A maximum line length of 127 characters is allowed for the first line in
a #! executable shell script.
a #! executable shell script.
.\" .SH BUGS
.\" Some Linux versions have failed to check permissions on ELF
.\" 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
.\" ELF binary. There are no known problems with 2.0.34 or 2.2.15.
.SH HISTORICAL
With Unix V6 the argument list of an
With Unix V6 the argument list of an
.BR exec ()
call was ended by 0,
while the argument list of
.I main
was ended by \-1. Thus, this
argument list was not directly usable in a further
.BR exec ()
argument list was not directly usable in a further
.BR exec ()
call.
Since Unix V7 both are NULL.
.SH "SEE ALSO"

View File

@ -8,7 +8,7 @@
.\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one.
.\"
.\"
.\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" 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,
.\" which is licensed free of charge, as they might when working
.\" professionally.
.\"
.\"
.\" Formatted or processed versions of this manual, if unaccompanied by
.\" 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
.\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one.
.\"
.\"
.\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" 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,
.\" which is licensed free of charge, as they might when working
.\" professionally.
.\"
.\"
.\" Formatted or processed versions of this manual, if unaccompanied by
.\" 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),
except for the differences described in this manual page.
If the pathname given in
If the pathname given in
.I pathname
is relative, then it is interpreted relative to the directory
referred to by the file descriptor
.IR dirfd
(rather than relative to the current working directory of
.IR dirfd
(rather than relative to the current working directory of
the calling process, as is done by
.BR access (2)
for a relative pathname).
If
If
.I pathname
is relative and
is relative and
.I dirfd
is the special value
.BR AT_FDCWD ,
then
.I pathname
is interpreted relative to the current working
is interpreted relative to the current working
directory of the calling process (like
.BR access (2)).
If
.IR pathname
is absolute, then
.I dirfd
is absolute, then
.I dirfd
is ignored.
.I flags
is constructed by ORing together zero or more of the following values:
.TP
.B AT_EACCESS
Perform access checks using the effective user and group IDs.
By default,
Perform access checks using the effective user and group IDs.
By default,
.BR faccessat ()
uses the real IDs (like
.BR access (2)).
.TP
.B AT_SYMLINK_NOFOLLOW
If
If
.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.
.SH "RETURN VALUE"
On success, (all requested permissions granted)
.BR faccessat ()
returns 0.
.BR faccessat ()
returns 0.
On error, \-1 is returned and
.I errno
is set to indicate the error.
@ -98,7 +98,7 @@ The same errors that occur for
.BR access (2)
can also occur for
.BR faccessat ().
The following additional errors can occur for
The following additional errors can occur for
.BR faccessat ():
.TP
.B EBADF
@ -127,9 +127,9 @@ The
.B AT_EACCESS
and
.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 ().
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)
to determine access permissions.
.SH VERSIONS

View File

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

View File

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

View File

@ -14,7 +14,7 @@
.\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one.
.\"
.\"
.\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" 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,
.\" which is licensed free of charge, as they might when working
.\" professionally.
.\"
.\"
.\" Formatted or processed versions of this manual, if unaccompanied by
.\" 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>
.\" Added notes on capability requirements
.\" 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
.\" Described behaviour of F_SETOWN/F_SETSIG in
.\" multi-threaded processes, and generally cleaned
.\" 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
.\" and earlier. Added text on permissions required to send signal.
.\"
@ -90,7 +90,7 @@ See
for further details.
.SS "File descriptor flags"
The following commands manipulate the flags associated with
a file descriptor.
a file descriptor.
Currently, only one such flag is defined:
.BR FD_CLOEXEC ,
the close-on-exec flag.
@ -114,7 +114,7 @@ initialized by
.\" .BR creat (2),
and possibly modified by
.BR fcntl (2).
Duplicated file descriptors
Duplicated file descriptors
(made with
.BR dup (),
.BR fcntl (F_DUPFD),
@ -131,7 +131,7 @@ Read the file status flags.
.B F_SETFL
Set the file status flags to the value specified by
.IR arg .
File access mode
File access mode
.RB ( O_RDONLY ", " O_WRONLY ", " O_RDWR )
and file creation flags
(i.e.,
@ -140,12 +140,12 @@ in
.I arg
are ignored.
On Linux this command can only change the
.BR O_APPEND ,
.BR O_APPEND ,
.BR O_ASYNC ,
.BR O_DIRECT ,
.BR O_NOATIME ,
and
.BR O_NONBLOCK
and
.BR O_NONBLOCK
flags.
.\" FIXME According to POSIX.1-2001, O_SYNC should also be modifiable
.\" 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
should be avoided; use
.BR read (2)
and
and
.BR write (2)
instead.
.SS "Mandatory locking"
@ -331,9 +331,9 @@ The above record locks may be either advisory or mandatory,
and are advisory by default.
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.,
.BR read (2)
or
@ -342,33 +342,33 @@ on a file region that has an incompatible mandatory lock,
then the result depends upon whether the
.B O_NONBLOCK
flag is enabled for its open file description.
If the
If the
.B O_NONBLOCK
flag is not enabled, then
system call is blocked until the lock is removed
or converted to a mode that is compatible with the access.
If the
.B O_NONBLOCK
If the
.B O_NONBLOCK
flag is enabled, then the system call fails with the error
.BR EAGAIN
.BR EAGAIN
or
.BR EWOULDBLOCK.
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.
Mandatory locking is enabled on a file system
using the "\-o mand" option to
.BR mount (8),
or the
or the
.B MS_MANDLOCK
flag for
flag for
.BR mount (2).
Mandatory locking is enabled on a file by disabling
group execute permission on the file and enabling the set-group-ID
permission bit (see
.BR chmod (1)
and
and
.BR chmod (2)).
.SS "Managing signals"
.BR F_GETOWN ", " F_SETOWN ", " F_GETSIG " and " F_SETSIG
@ -398,8 +398,8 @@ If you set the
.B O_ASYNC
status flag on a file descriptor (either by providing this flag with the
.BR open (2)
.\" 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
.\" 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
.\" effective.
.\" See http://bugzilla.kernel.org/show_bug.cgi?id=5993
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
.BR kill (2),
where the sending process is the one that employs
.BR F_SETOWN
.BR F_SETOWN
(but see BUGS below).
.sp
If the file descriptor
@ -427,15 +427,16 @@ refers to a socket,
.B F_SETOWN
also selects
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)
would report the socket as having an "exceptional condition".)
.\" 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
.\" it is not the foreground process group of the terminal.
.\" -- MTK, 8 Apr 05
.\"
.\"
.\" If the file descriptor
.\" .I fd
.\" refers to a terminal device, then SIGIO
@ -445,10 +446,10 @@ If a non-zero value is given to
.B F_SETSIG
in a multi-threaded process running with a threading library
that supports thread groups (e.g., NPTL),
then a positive value given to
then a positive value given to
.B F_SETOWN
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
instead of being a process ID identifying a whole 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,
depending on the value given to
.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()
.\" to directly call send_group_sig_info()
.\" to directly call send_group_sig_info()
.\" -- MTK, Apr 2005 (kernel 2.6.11)
Note also that Linux imposes a limit on the
number of real-time signals that may be queued to a
@ -483,20 +484,22 @@ process (see
.BR getrlimit (2)
and
.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
process rather than to a specific thread.
.\" See fs/fcntl.c::send_sigio_to_task() (2.4/2.6) sources -- MTK, Apr 05
.TP
.B F_GETSIG
Get the signal sent when input or output becomes possible. A value of
zero means SIGIO is sent. Any other value (including SIGIO) is the
Get the signal sent when input or output becomes possible.
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
the signal handler if installed with SA_SIGINFO.
.TP
.B F_SETSIG
Sets the signal sent when input or output becomes possible. A value of
zero means to send the default SIGIO signal. Any other value (including
Sets the signal sent when input or output becomes possible.
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
is available to the signal handler if installed with SA_SIGINFO.
.sp
@ -505,7 +508,7 @@ Additionally, passing a non-zero value to
changes the signal recipient from a whole process to a specific thread
within a process.
See the description of
.B F_SETOWN
.B F_SETOWN
for more details.
.sp
By using
@ -521,7 +524,8 @@ If the
.I si_code
field indicates the source is SI_SIGIO, the
.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
should use the usual mechanisms
.RB ( select (2),
@ -532,8 +536,9 @@ with
set etc.) to determine which file descriptors are available for I/O.
.sp
By selecting a real time signal (value >= SIGRTMIN), multiple
I/O events may be queued using the same signal numbers. (Queuing is
dependent on available memory). Extra information is available
I/O events may be queued using the same signal numbers.
(Queuing is dependent on available memory).
Extra information is available
if SA_SIGINFO is set for the signal handler, as above.
.PP
Using these mechanisms, a program can implement fully asynchronous I/O
@ -551,7 +556,8 @@ is specific to BSD and Linux.
.B F_GETSIG
and
.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
structure to achieve similar things; these are also available
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 following became true in kernel 2.6.10:
.\" 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.
.TP
.B F_WRLCK
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.
A write lease may be placed on a file only if no other process
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.
If the lease breaker's blocked
.BR open ()
or
.BR open ()
or
.BR truncate ()
is interrupted by a signal handler,
then the system call fails with the error
.BR EINTR ,
is interrupted by a signal handler,
then the system call fails with the error
.BR EINTR ,
but the other steps still occur as described above.
If the lease breaker is killed by a signal while blocked in
.BR open ()
or
If the lease breaker is killed by a signal while blocked in
.BR open ()
or
.BR truncate (),
then the other steps still occur as described above.
If the lease breaker specifies the
.B O_NONBLOCK
flag when calling
If the lease breaker specifies the
.B O_NONBLOCK
flag when calling
.BR open (),
then the call immediately fails with the error
.BR EWOULDBLOCK ,
then the call immediately fails with the error
.BR EWOULDBLOCK ,
but the other steps still occur as described above.
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])
.TE
.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.)
.sp
Directory notifications are normally "one-shot", and the application
@ -766,10 +772,11 @@ so that multiple notifications can be queued.
.B NOTE:
New applications should consider using the
.I inotify
.I inotify
interface (available since kernel 2.6.13),
which provides a superior interface for obtaining notifications of
file system events. See
which provides a superior interface for obtaining notifications of
file system events.
See
.BR inotify (7).
.SH "RETURN VALUE"
For a successful call, the return value depends on the operation:
@ -830,14 +837,16 @@ the command was interrupted by a signal.
For
.BR F_GETLK " and " F_SETLK ,
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.
.TP
.B EINVAL
For
.BR F_DUPFD ,
.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 ,
.I arg
is not an allowable signal number.
@ -869,7 +878,8 @@ and
POSIX.1-2001 allows
.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
.IR l_start + l_len
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
.B F_SETOWN
to specify the owner
of a socket file descriptor
of a socket file descriptor
as a process (group) other than the caller.
In this case,
.BR fcntl ()
@ -920,9 +930,9 @@ has permission to send signals to.
Despite this error return, the file descriptor owner is set,
and signals will be sent to the owner.
.SH "CONFORMING TO"
SVr4, 4.3BSD, POSIX.1-2001.
SVr4, 4.3BSD, POSIX.1-2001.
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_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
.\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one.
.\"
.\"
.\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" 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,
.\" which is licensed free of charge, as they might when working
.\" professionally.
.\"
.\"
.\" Formatted or processed versions of this manual, if unaccompanied by
.\" 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
.BR fdatasync ()
flushes all data buffers of a file to disk (before the system
call returns). It resembles
call returns).
It resembles
.BR fsync ()
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
.BR fsync ()
immediately in order to ensure that the written data is physically
stored on the harddisk. Unfortunately,
stored on the harddisk.
Unfortunately,
.BR fsync ()
will always initiate two write operations: one for the newly written
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
.BR fdatasync ()
can be used to avoid unnecessary inode disk write operations.
.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
is set appropriately.
.SH ERRORS

View File

@ -1,6 +1,6 @@
.\" 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
.\"
.\" 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
.\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one.
.\"
.\"
.\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" 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,
.\" which is licensed free of charge, as they might when working
.\" professionally.
.\"
.\"
.\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work.
.\"
@ -73,7 +73,7 @@ Locks created by
.BR flock ()
are associated with an open file table entry.
This means that duplicate file descriptors (created by, for example,
.BR fork (2)
.BR fork (2)
or
.BR dup (2))
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
mode in which the file was opened.
.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
is set appropriately.
.SH ERRORS
@ -142,7 +143,8 @@ possibly implemented in terms of
appears on most Unix systems.
.SH NOTES
.BR flock (2)
does not lock files over NFS. Use
does not lock files over NFS.
Use
.BR fcntl (2)
instead: that does work over NFS, given a sufficiently recent version of
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.
Between these two steps,
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
was specified.
(This is the original BSD behaviour,

View File

@ -12,7 +12,7 @@
.\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one.
.\"
.\"
.\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" 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,
.\" which is licensed free of charge, as they might when working
.\" professionally.
.\"
.\"
.\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work.
.\"
@ -48,8 +48,8 @@ fork \- create a child process
.SH DESCRIPTION
.BR fork ()
creates a new process by duplicating the calling process.
The new process, referred to as the \fIchild\fP,
is an exact duplicate of the calling process,
The new process, referred to as the \fIchild\fP,
is an exact duplicate of the calling process,
referred to as the \fIparent\fP, except for the following points:
.IP * 4
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),
.BR mlockall (2)).
.IP * 4
Process resource utilisations
Process resource utilisations
.RB ( getrusage (2))
and CPU time counters
.RB ( times (2))
@ -82,30 +82,30 @@ The parent does not inherit timers from its parent
.BR alarm (3),
.BR timer_create (3)).
.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
.RB ( aio_read (3),
.BR aio_write (3)).
.PP
The process attributes in the preceding list are all specified
.PP
The process attributes in the preceding list are all specified
in POSIX.1-2001.
The parent and child also differ with respect to the following
Linux-specific process attributes:
.IP * 4
The child does not inherit directory change notifications (dnotify)
The child does not inherit directory change notifications (dnotify)
from its parent
(see the description of
.B F_NOTIFY
in
.B F_NOTIFY
in
.BR fcntl (2)).
.IP * 4
The
.BR prctl (2)
.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.
.IP * 4
Memory mappings that have been marked with the
Memory mappings that have been marked with the
.BR madvise (2)
.B MADV_DONTFORK
flag are not inherited across a
@ -117,42 +117,42 @@ The termination signal of the child is always SIGCHLD
.PP
Note the following further points:
.IP * 4
The child process is created with a single thread \(em the
one that called
The child process is created with a single thread \(em the
one that called
.BR fork (2).
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
.BR pthread_atfork (3)
may be helpful for dealing with problems that this can cause.
.IP * 4
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
.BR open (2))
as the corresponding file descriptor in the parent.
This means that the two descriptors share open file status flags,
current file offset,
This means that the two descriptors share open file status flags,
current file offset,
and signal-driven I/O attributes (see the description of
.B F_SETOWN
and
and
.B F_SETSIG
in
in
.BR fcntl (2)).
.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
.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
as the corresponding descriptor in the parent.
This means that the two descriptors share the same flags
.RI ( mq_flags ).
.SH "RETURN VALUE"
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
failure, a \-1 will be returned in the parent's context, no child process
will be created, and
of execution, and a 0 is returned in the child's thread of execution.
On failure, a \-1 will be returned in the parent's context,
no child process will be created, and
.I errno
will be set appropriately.
.SH ERRORS

View File

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

View File

@ -11,7 +11,7 @@
.\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one.
.\"
.\"
.\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" 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,
.\" which is licensed free of charge, as they might when working
.\" professionally.
.\"
.\"
.\" Formatted or processed versions of this manual, if unaccompanied by
.\" 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 );
.SH DESCRIPTION
.BR fsync ()
transfers ("flushes") all modified in-core data of
(i.e., modified buffer cache pages for) the
transfers ("flushes") all modified in-core data of
(i.e., modified buffer cache pages for) the
file referred to by the file descriptor
.I fd
to the disk device (or other permanent storage device)
to the disk device (or other permanent storage device)
where that file resides.
The call blocks until the device reports that the transfer has completed.
It also flushes metadata information associated with the file (see
.BR stat (2)).
.BR stat (2)).
Calling
.BR fsync ()
@ -64,18 +64,18 @@ For that an explicit
on a file descriptor for the directory is also needed.
.BR fdatasync ()
is similar to
is similar to
.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
correctly handled.
For example, changes to
.I st_atime
or
For example, changes to
.I st_atime
or
.I st_mtime
(respectively, time of last access and
time of last modification; see
.BR stat (2))
.BR stat (2))
do not require flushing because they are not necessary for
a subsequent data read to be handled correctly.
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
require all metadata to be synchronised with the disk.
.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
is set appropriately.
.SH ERRORS
@ -107,8 +108,8 @@ is bound to a special file which does not support synchronization.
.SH NOTES
If the underlying hard disk has write caching enabled, then
the data may not really be on permanent storage when
.BR fsync ()
/
.BR fsync ()
/
.BR fdatasync ()
return.
.\" See

View File

@ -7,8 +7,8 @@
.\" Modified 2004-10-07 aeb, added FUTEX_REQUEUE, FUTEX_CMP_REQUEUE
.\"
.\" FIXME
.\" 2.6.18 adds (Ingo Molnar) priority inheritance support:
.\" FUTEX_LOCK_PI, FUTEX_UNLOCK_PI, and FUTEX_TRYLOCK_PI. These need
.\" 2.6.18 adds (Ingo Molnar) priority inheritance support:
.\" FUTEX_LOCK_PI, FUTEX_UNLOCK_PI, and FUTEX_TRYLOCK_PI. These need
.\" to be documented in the manual page. Probably there is sufficient
.\" 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
different locations will correspond for
.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
described in
.BR futex (7).
.PP
When a
When a
.BR futex (7)
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.
.PP
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
still contains the value
.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
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
and
.I val3
@ -84,7 +88,7 @@ For
.BR futex (7),
this call is executed if decrementing the count gave a negative value
(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
.B FUTEX_WAKE
This operation wakes at most \fIval\fR
@ -117,7 +121,7 @@ and
.I val3
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.
.\" 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)"
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
futex. This call wakes up
futex.
This call wakes up
.I val
processes, and requeues all other waiters on the futex at address
.IR uaddr2 .
@ -139,7 +144,8 @@ are ignored.
.TP
.BR FUTEX_CMP_REQUEUE " (since Linux 2.6.7)"
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
.I uaddr
still contains the value
@ -154,9 +160,12 @@ Depending on which operation was executed, the returned value can have
differing meanings.
.TP
.B FUTEX_WAIT
Returns 0 if the process was woken by a FUTEX_WAKE call. In case of timeout,
ETIMEDOUT is returned. If the futex was not equal to the expected value,
the operation returns EWOULDBLOCK. Signals (or other spurious wakeups)
Returns 0 if the process was woken by a FUTEX_WAKE call.
In case of timeout,
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.
.TP
.B FUTEX_WAKE
@ -193,7 +202,8 @@ The system limit on the total number of open files has been reached.
.SH "NOTES"
.PP
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.
.\" .SH "AUTHORS"
.\" .PP
@ -205,16 +215,19 @@ read the sources of the futex userspace library referenced below.
.SH "VERSIONS"
.PP
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
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
from what was described above.
A 4-parameter system call with the semantics
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.
.SH "CONFORMING TO"
This system call is Linux specific.
.SH "SEE ALSO"
.PP
.BR futex (7),
.BR futex (7),
`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
<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
.\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one.
.\"
.\"
.\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" 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,
.\" which is licensed free of charge, as they might when working
.\" professionally.
.\"
.\"
.\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work.
.\"
@ -32,7 +32,7 @@ directory file descriptor
.B #define _ATFILE_SOURCE
.B #include <fcntl.h>
.sp
.BI "int futimesat(int " dirfd ", const char *" pathname ,
.BI "int futimesat(int " dirfd ", const char *" pathname ,
.BI " const struct timeval " times [2]);
.fi
.SH DESCRIPTION
@ -42,36 +42,36 @@ system call operates in exactly the same way as
.BR utimes (2),
except for the differences described in this manual page.
If the pathname given in
If the pathname given in
.I pathname
is relative, then it is interpreted relative to the directory
referred to by the file descriptor
.IR dirfd
(rather than relative to the current working directory of
.IR dirfd
(rather than relative to the current working directory of
the calling process, as is done by
.BR utimes (2)
for a relative pathname).
If
.I pathname
is relative and
is relative and
.I dirfd
is the special value
.BR AT_FDCWD ,
then
.I pathname
is interpreted relative to the current working
is interpreted relative to the current working
directory of the calling process (like
.BR utimes (2)).
If
.IR pathname
is absolute, then
.I dirfd
is absolute, then
.I dirfd
is ignored.
.SH "RETURN VALUE"
On success,
.BR futimesat ()
.BR futimesat ()
returns a 0.
On error, \-1 is returned and
.I errno
@ -81,7 +81,7 @@ The same errors that occur for
.BR utimes (2)
can also occur for
.BR futimesat ().
The following additional errors can occur for
The following additional errors can occur for
.BR futimesat ():
.TP
.B EBADF
@ -100,7 +100,7 @@ A similar system call exists on Solaris.
.SH GLIBC NOTES
If
.I pathname
is NULL, then the glibc
is NULL, then the glibc
.BR futimes ()
wrapper function updates the times for the file referred to by
.IR dirfd .

View File

@ -2,7 +2,7 @@
.\" This file is distributed according to the GNU General Public License.
.\" 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
.\"
.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.
.PP
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.
.SH "RETURN VALUE"
Returns the number of symbols copied to
.IR table .
.IR table .
There is no possible error return.
.SH "CONFORMING TO"
.BR get_kernel_syms ()
@ -61,7 +61,7 @@ favor of
(which is itself nowadays deprecated
in favor of other interfaces described on its manual page).
.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.
.\" Removed in Linux-2.5.48
.SH "SEE ALSO"

View File

@ -8,26 +8,26 @@
.\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one.
.\"
.\"
.\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" 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
.\" the source, must acknowledge the copyright and authors of this work.
.\"
.\"
.\" 2006-02-03, mtk, substantial wording changes and other improvements
.\"
.TH GET_MEMPOLICY 2 "2006-02-07" "SuSE Labs" "Linux Programmer's Manual"
.SH SYNOPSIS
get_mempolicy \- Retrieve NUMA memory policy for a process
.SH NAME
.B "#include <numaif.h>"
.B "#include <numaif.h>"
.nf
.sp
.BI "int get_mempolicy(int *" policy ", unsigned long *" nodemask ,
.BI " unsigned long " maxnode ", unsigned long " addr ,
.BI "int get_mempolicy(int *" policy ", unsigned long *" nodemask ,
.BI " unsigned long " maxnode ", unsigned long " addr ,
.BI " unsigned long " flags );
.fi
.\" TBD rewrite this. it is confusing.
@ -39,18 +39,18 @@ depending on the setting of
A NUMA machine has different
memory controllers with different distances to specific CPUs.
The memory policy defines in which node memory is allocated for
the process.
The memory policy defines in which node memory is allocated for
the process.
If
.IR flags
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
.BR set_mempolicy (2))
is returned.
If
If
.I flags
specifies
.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
.IR addr .
If
If
.I policy
is not NULL, then it is used to return the policy.
If
.IR nodemask
is not NULL, then it is used to return the nodemask associated
If
.IR nodemask
is not NULL, then it is used to return the nodemask associated
with the policy.
.I maxnode
is the maximum bit number plus one that can be stored into
.I maxnode
is the maximum bit number plus one that can be stored into
.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" .
.\"
.\"
.\" If
.\" .I flags
.\" .I flags
.\" specifies both
.\" .B MPOL_F_NODE
.\" and
.\" and
.\" .BR MPOL_F_ADDR ,
.\" then
.\" then
.\" .I policy
.\" instead returns the number of the node on which the address
.\" .I addr
.\" is allocated.
.\"
.\"
.\" If
.\" .I flags
.\" .I flags
.\" specifies
.\" .B MPOL_F_NODE
.\" but not
.\" .BR MPOL_F_ADDR ,
.\" and the process's current policy is
.\" .BR MPOL_INTERLEAVE ,
.\" then
.\" then
.\" checkme: Andi's text below says that the info is returned in
.\" 'nodemask', not '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.
.\" FIXME .
.\" The other valid flag is
.\" The other valid flag is
.\" .I MPOL_F_NODE.
.\" It is only valid when the policy is
.\" It is only valid when the policy is
.\" .I MPOL_INTERLEAVE.
.\" 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.
.\" Other flag values are reserved.
@ -118,15 +118,15 @@ On success,
.BR get_mempolicy ()
returns 0;
on error, \-1 is returned and
.I errno
.I errno
is set to indicate the error.
.\" .SH ERRORS
.\" FIXME writeme -- no errors are listed on this page
.\" .
.\" .TP
.\" .B EINVAL
.\" .I nodemask
.\" is non-NULL, and
.\" .I nodemask
.\" is non-NULL, and
.\" .I maxnode
.\" is too small;
.\" or
@ -144,15 +144,15 @@ is set to indicate the error.
.\" is NULL.
.\" (And there are other EINVAL cases.)
.SH NOTES
This manual page is incomplete:
This manual page is incomplete:
it does not document the details the
.BR MPOL_F_NODE
flag,
which modifies the operation of
.BR MPOL_F_NODE
flag,
which modifies the operation of
.BR get_mempolicy ().
This is deliberate: this flag is not intended for application use,
and its operation may change or it may be removed altogether in
future kernel versions.
This is deliberate: this flag is not intended for application use,
and its operation may change or it may be removed altogether in
future kernel versions.
.B Do not use it.
.SH "VERSIONS AND LIBRARY SUPPORT"
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 );
.SH "DESCRIPTION"
.BR get_thread_area ()
returns an entry in the current thread's Thread Local Storage (TLS) array.
The index of the entry corresponds to the value
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
returns an entry in the current thread's Thread Local Storage (TLS) array.
The index of the entry corresponds to the value
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
TLS entry into the area pointed to by \fIu_info\fR.
.SH "RETURN VALUE"
.BR get_thread_area ()
returns 0 on success.
returns 0 on success.
Otherwise, it returns \-1 and sets
.I errno
appropriately.

View File

@ -8,7 +8,7 @@
.\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one.
.\"
.\"
.\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" 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,
.\" which is licensed free of charge, as they might when working
.\" professionally.
.\"
.\"
.\" Formatted or processed versions of this manual, if unaccompanied by
.\" 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.
.LP
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(),
or \fBmakecontext\fP(), or passed as third argument to a signal
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,
then old standard text says that "program execution continues with the
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".
.SH "RETURN VALUE"
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.
.SH ERRORS
None defined.
.SH NOTES
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
\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()
is from the first call, or via a \fBsetcontext\fP() call.
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
a new context is created by the kernel for the signal handler.
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.
.SH "CONFORMING TO"
SUSv2, POSIX.1-2001.

View File

@ -8,7 +8,7 @@
.\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one.
.\"
.\"
.\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" 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,
.\" which is licensed free of charge, as they might when working
.\" professionally.
.\"
.\"
.\" Formatted or processed versions of this manual, if unaccompanied by
.\" 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
The system call
.BR getdents ()
reads several
reads several
.I dirent
structures from the directory
pointed at by
.I fd
into the memory area pointed to by
.IR dirp .
The parameter
The parameter
.I count
is the size of the memory area.
.PP

View File

@ -10,7 +10,7 @@
.\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one.
.\"
.\"
.\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" 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,
.\" which is licensed free of charge, as they might when working
.\" professionally.
.\"
.\"
.\" Formatted or processed versions of this manual, if unaccompanied by
.\" 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 ()
returns the first \fIlen\fP bytes (glibc) or returns an error (libc).
.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
is set appropriately.
.SH ERRORS

View File

@ -10,7 +10,7 @@
.\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one.
.\"
.\"
.\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" 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,
.\" which is licensed free of charge, as they might when working
.\" professionally.
.\"
.\"
.\" Formatted or processed versions of this manual, if unaccompanied by
.\" 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.
.SH NOTES
.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)
and returns the current
.B RLIMIT_NOFILE
@ -54,7 +55,7 @@ SVr4, 4.4BSD (the
.BR getdtablesize ()
function first appeared in 4.2BSD).
It is not specified in POSIX.1-2001;
portable applications should employ
portable applications should employ
.I sysconf(_SC_OPEN_MAX)
instead of this call.
.SH "SEE ALSO"

View File

@ -10,7 +10,7 @@
.\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one.
.\"
.\"
.\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" 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,
.\" which is licensed free of charge, as they might when working
.\" professionally.
.\"
.\"
.\" Formatted or processed versions of this manual, if unaccompanied by
.\" 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
.\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one.
.\"
.\"
.\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" 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,
.\" which is licensed free of charge, as they might when working
.\" professionally.
.\"
.\"
.\" Formatted or processed versions of this manual, if unaccompanied by
.\" 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
.IR list .
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)
and add or remove the resulting value.)
If
@ -71,7 +72,8 @@ On error, \-1 is returned, and
is set appropriately.
.TP
.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
is set appropriately.
.SH ERRORS
@ -93,7 +95,7 @@ For
is less than the number of supplementary group IDs, but is not zero.
.TP
.B EPERM
The calling process has insufficient privilege to call
The calling process has insufficient privilege to call
.BR setgroups ().
.SH NOTES
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
.\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one.
.\"
.\"
.\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" 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,
.\" which is licensed free of charge, as they might when working
.\" professionally.
.\"
.\"
.\" Formatted or processed versions of this manual, if unaccompanied by
.\" 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
.BI "int sethostid(long " hostid );
.SH DESCRIPTION
Get or set a unique 32-bit identifier for the current machine. The 32-bit
identifier is intended to be unique among all UNIX systems in
existence. This normally resembles the Internet address for the local
Get or set a unique 32-bit identifier for the current machine.
The 32-bit identifier is intended to be unique among all UNIX systems in
existence.
This normally resembles the Internet address for the local
machine, as returned by
.BR gethostbyname (3),
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).
.SH "CONFORMING TO"
4.2BSD; these functions were dropped in 4.4BSD.
SVr4 includes
SVr4 includes
.BR gethostid ()
but not
.BR sethostid ().
POSIX.1-2001 specifies
POSIX.1-2001 specifies
.BR gethostid ()
but not
.BR sethostid ().

View File

@ -10,7 +10,7 @@
.\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one.
.\"
.\"
.\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" 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,
.\" which is licensed free of charge, as they might when working
.\" professionally.
.\"
.\"
.\" Formatted or processed versions of this manual, if unaccompanied by
.\" 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 ())
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
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.
.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
is set appropriately.
.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
the terminating null byte) are limited to HOST_NAME_MAX bytes'.
.SH "GLIBC NOTES"
The GNU C library implements
.BR gethostname ()
as a library function that calls
The GNU C library implements
.BR gethostname ()
as a library function that calls
.BR uname (2)
and copies up to
and copies up to
.I len
bytes from the returned
.I nodename
bytes from the returned
.I nodename
field into
.IR name .
Having performed the copy, the function then checks if the length of the
.I nodename
was greater than or equal to
.IR len ,
and if it is, then the function returns \-1 with
.I errno
and if it is, then the function returns \-1 with
.I errno
set to
.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
handle the case where the length of the
.I nodename
was greater than or equal to
.IR len
differently: nothing is copied into
differently: nothing is copied into
.I name
and the function returns \-1 with
.I errno
.I errno
set to
.BR ENAMETOOLONG .
.SH "SEE ALSO"

View File

@ -17,8 +17,9 @@ getitimer, setitimer \- get or set value of an interval timer
.BI " struct itimerval *" ovalue );
.fi
.SH DESCRIPTION
The system provides each process with three interval timers, each decrementing
in a distinct time domain. When any timer expires, a signal is sent to the
The system provides each process with three interval timers,
each decrementing in a distinct time domain.
When any timer expires, a signal is sent to the
process, and the timer (potentially) restarts.
.TP 1.5i
.B ITIMER_REAL
@ -33,10 +34,11 @@ upon expiration.
.TP
.B ITIMER_PROF
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 ,
this timer is usually used to profile the time spent by the application in user
and kernel space.
this timer is usually used to profile the time spent by the
application in user and kernel space.
.B SIGPROF
is delivered upon expiration.
.LP
@ -71,7 +73,8 @@ or
The element
.I it_value
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
is set to the reset value.
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.
If the timer expires while the process is active (always true for
.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.
.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
is set appropriately.
.SH ERRORS
@ -130,7 +135,7 @@ or
A child created via
.BR fork (2)
does not inherit its parent's interval timers.
Interval timers are preserved across an
Interval timers are preserved across an
.BR execve (2).
.SH "CONFORMING TO"
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.
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
(defined in
.IR include/linux/jiffies.h ),
@ -161,7 +166,7 @@ this means that the ceiling value for a timer is
approximately 99.42 days.
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.
This bug is fixed in kernel 2.6.12.
.\" 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.
However, Linux does not give an error, but instead silently
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:
existing applications should be fixed now to ensure that they supply
a properly formed

View File

@ -8,7 +8,7 @@
.\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one.
.\"
.\"
.\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" 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,
.\" which is licensed free of charge, as they might when working
.\" professionally.
.\"
.\"
.\" Formatted or processed versions of this manual, if unaccompanied by
.\" 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
it has been dropped;
HP-UX does not have this call.
Portable applications should employ
Portable applications should employ
.I sysconf(_SC_PAGESIZE)
instead of this call.
.SH NOTES
@ -75,7 +75,8 @@ If it is, it returns the kernel symbol PAGE_SIZE,
which is architecture and machine model dependent.
Generally, one uses binaries that are architecture but not
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,
but use an actual system call, at least for those architectures
(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
by
.IR name .
On return it contains the actual size of the name returned (in bytes). The
name is truncated if the buffer provided is too small.
On return it contains the actual size of the name returned (in bytes).
The name is truncated if the buffer provided is too small.
.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
is set appropriately.
.SH ERRORS
@ -67,7 +68,7 @@ The argument
is not a valid descriptor.
.TP
.B EFAULT
The
The
.I name
parameter points to memory not in a valid part of the
process address space.
@ -92,13 +93,13 @@ SVr4, 4.4BSD (the
.BR getpeername ()
function call first appeared in 4.2BSD), POSIX.1-2001.
.SH NOTE
The third argument of
The third argument of
.BR getpeername ()
is in reality an
is in reality an
.I int *
(and this is what 4.x BSD and libc4 and libc5 have).
Some POSIX confusion resulted in the present
.IR socklen_t ,
Some POSIX confusion resulted in the present
.IR socklen_t ,
also used by glibc.
See also
.BR accept (2).

View File

@ -9,7 +9,7 @@
.\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one.
.\"
.\"
.\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" 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,
.\" which is licensed free of charge, as they might when working
.\" professionally.
.\"
.\"
.\" Formatted or processed versions of this manual, if unaccompanied by
.\" 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"
@ -33,7 +33,8 @@ getpid, getppid \- get process identification
.B pid_t getppid(void);
.SH DESCRIPTION
.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.)
.BR getppid ()

View File

@ -70,9 +70,9 @@ is one of
.BR PRIO_PGRP ,
or
.BR PRIO_USER ,
and
and
.I who
is interpreted relative to
is interpreted relative to
.I which
(a process identifier for
.BR PRIO_PROCESS ,
@ -93,10 +93,12 @@ lower priorities cause more favorable scheduling.
The
.BR getpriority ()
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 ()
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"
Since
.BR getpriority ()
@ -121,7 +123,7 @@ or
.BR PRIO_USER .
.TP
.B ESRCH
No process was located using the
No process was located using the
.I which
and
.I who
@ -134,7 +136,7 @@ may fail if:
.B EPERM
A process was located, but its effective user ID did not match
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
capability).
But see NOTES below.
@ -145,7 +147,7 @@ have the required privilege (on Linux: did not have the
.B CAP_SYS_NICE
capability).
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
soft resource limit of the target process; see
.BR getrlimit (2)
@ -154,20 +156,20 @@ for details.
A child created by
.BR fork (2)
inherits its parent's nice value.
The nice value is preserved across
.BR execve (2).
The nice value is preserved across
.BR execve (2).
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
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
the real user of the process \fIwho\fP (instead of its effective user ID).
Linux 2.6.12 and later require
the effective user ID of the caller to match
the real or effective user ID of the process \fIwho\fP.
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.
.LP
The actual priority range varies between kernel versions.

View File

@ -10,7 +10,7 @@
.\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one.
.\"
.\"
.\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" 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,
.\" which is licensed free of charge, as they might when working
.\" professionally.
.\"
.\"
.\" Formatted or processed versions of this manual, if unaccompanied by
.\" 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
.BI "int getresuid(uid_t *" ruid ", uid_t *" euid ", uid_t *" suid );
.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
.BR getresuid ()
and
@ -42,7 +42,8 @@ and
get the real UID, effective UID, and saved set-user-ID (resp. group ID's)
of the current process.
.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
is set appropriately.
.SH ERRORS
@ -51,7 +52,7 @@ is set appropriately.
One of the arguments specified an address outside the calling program's
address space.
.SH "CONFORMING TO"
These calls are non-standard;
These calls are non-standard;
they also appear on HP-UX and some of the BSDs.
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
.\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one.
.\"
.\"
.\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" 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,
.\" which is licensed free of charge, as they might when working
.\" professionally.
.\"
.\"
.\" Formatted or processed versions of this manual, if unaccompanied by
.\" 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>
.\" 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
.\" is now covered in its own getrusage.2.
.\"
@ -75,13 +75,13 @@ getrlimit, setrlimit \- get/set resource limits
and
.BR setrlimit ()
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
structure (the
.I rlim
argument to both
.BR getrlimit ()
and
and
.BR setrlimit ()):
.PP
.in +0.5i
@ -96,7 +96,7 @@ struct rlimit {
The soft limit is the value that the kernel enforces for the
corresponding resource.
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.
A privileged process (under Linux: one with the
.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,
uninitialized data, and heap).
This limit affects calls to
.BR brk ()
and
.BR brk ()
and
.BR sbrk (),
which fail with the error
.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
.B SIGXFSZ
signal.
By default, this signal terminates a process, but a process can
catch this signal instead, in which case the relevant system call (e.g.,
By default, this signal terminates a process, but a process can
catch this signal instead, in which case the relevant system call (e.g.,
.BR write ()
.BR truncate ())
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
A limit on the combined number of
.BR flock ()
locks and
locks and
.BR fcntl ()
leases that this process may establish.
.TP
@ -193,9 +193,9 @@ The maximum number of bytes of memory that may be locked
into RAM.
In effect this limit is rounded down to the nearest multiple
of the system page size.
This limit affects
This limit affects
.BR mlock (2)
and
and
.BR mlockall (2)
and the
.BR mmap (2)
@ -204,16 +204,16 @@ operation.
Since Linux 2.6.9 it also affects the
.BR shmctl (2)
.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
.BR shmget (2))
that may be locked by the real user ID of the calling process.
The
The
.BR shmctl (2)
.B SHM_LOCK
locks are accounted for separately from the per-process memory
locks established by
.BR mlock (2),
locks established by
.BR mlock (2),
.BR mlockall (2),
and
.BR mmap (2)
@ -238,10 +238,10 @@ against this limit according to the formula:
bytes = attr.mq_maxmsg * sizeof(struct msg_msg *) +
attr.mq_maxmsg * attr.mq_msgsize
.fi
where
.fi
where
.I attr
is the
is the
.I mq_attr
structure specified as the fourth argument to
.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.
Attempts
.RB ( open (),
.BR pipe (),
.BR dup (),
.BR pipe (),
.BR dup (),
etc.)
to exceed this limit yield the error
.BR EMFILE .
.TP
.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.
Upon encountering this limit,
Upon encountering this limit,
.BR fork ()
fails with the error
.BR EAGAIN .
@ -291,11 +291,11 @@ affects calls to
specifying
.BR MADV_WILLNEED .
.\" 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
.TP
.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
.BR sched_setscheduler (2)
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.
Both standard and real-time signals are counted for the purpose of
checking this limit.
However, the limit is only enforced for
However, the limit is only enforced for
.BR sigqueue (2);
it is always possible to use
.BR kill (2)
@ -324,10 +324,11 @@ To handle this signal, a process must employ an alternate signal stack
.RB ( sigaltstack (2)).
.PP
.B RLIMIT_OFILE
is the BSD name for
is the BSD name for
.BR RLIMIT_NOFILE .
.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
is set appropriately.
.SH ERRORS
@ -341,7 +342,7 @@ points outside the accessible address space.
is not valid;
or, for
.BR setrlimit ():
.IR rlim->rlim_cur
.IR rlim->rlim_cur
was greater than
.IR rlim->rlim_max .
.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.
This was fixed in kernel 2.6.8.
In 2.6.x kernels before 2.6.17, a
.B RLIMIT_CPU
limit of 0 is wrongly treated as "no limit" (like
In 2.6.x kernels before 2.6.17, a
.B RLIMIT_CPU
limit of 0 is wrongly treated as "no limit" (like
.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.
.\" see http://marc.theaimsgroup.com/?l=linux-kernel&m=114008066530167&w=2
@ -375,12 +376,12 @@ A kernel bug means that
.B RLIMIT_RTPRIO
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
.BR getpriority (2)
and
.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
.IR "19\ \-\ rlim_cur" .
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
.B EINVAL
for
for
.BR setrlimit ()
when
.IR rlim->rlim_cur
.IR rlim->rlim_cur
was greater than
.IR rlim->rlim_max .
.SH NOTES
@ -403,7 +404,7 @@ Resource limits are preserved across
.SH "CONFORMING TO"
SVr4, 4.3BSD, POSIX.1-2001.
.BR RLIMIT_MEMLOCK
and
and
.BR RLIMIT_NPROC
derive from BSD and are not specified in POSIX.1-2001;
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
.\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one.
.\"
.\"
.\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" 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,
.\" which is licensed free of charge, as they might when working
.\" professionally.
.\"
.\"
.\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work.
.\"
.\" 2004-11-16 -- mtk: the getrlimit.2 page, which formerly included
.\" coverage of getrusage(2), has been split, so that the latter is
.\" now covered in its own getrusage.2. For older details of change
.\" 2004-11-16 -- mtk: the getrlimit.2 page, which formerly included
.\" coverage of getrusage(2), has been split, so that the latter is
.\" now covered in its own getrusage.2. For older details of change
.\" history, etc, see getrlimit.2
.\"
.\" Modified 2004-11-16, mtk, Noted that the non-conformance
@ -44,14 +44,14 @@ getrusage \- get resource usage
.PP
.BR getrusage ()
returns current resource usages, for a \fIwho\fP
of either
of either
.B RUSAGE_SELF
or
or
.BR RUSAGE_CHILDREN .
The former asks for resources used by the current process,
the latter for resources used by those of its children
that have terminated and have been waited for.
.PP
.PP
.in +0.5i
.nf
struct rusage {
@ -75,7 +75,8 @@ struct rusage {
.fi
.in -0.5i
.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
is set appropriately.
.SH ERRORS
@ -88,8 +89,8 @@ points outside the accessible address space.
.I who
is invalid.
.SH "CONFORMING TO"
SVr4, 4.3BSD.
POSIX.1-2001 specifies
SVr4, 4.3BSD.
POSIX.1-2001 specifies
.BR getrusage (),
but only specifies the fields
.I ru_utime
@ -123,9 +124,9 @@ In linux 2.4 only the fields
.IR ru_stime ,
.IR ru_minflt ,
and
.IR ru_majflt
.IR ru_majflt
are maintained.
Since Linux 2.6,
Since Linux 2.6,
.I ru_nvcsw
and
.I ru_nivcsw

View File

@ -46,9 +46,10 @@ getsockname \- get socket name
.fi
.SH DESCRIPTION
.BR getsockname ()
returns the current
returns the current
.I name
for the specified socket. The
for the specified socket.
The
.I namelen
parameter should be initialized to indicate
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
returned (in bytes).
.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
is set appropriately.
.SH ERRORS
@ -67,7 +69,7 @@ The argument
is not a valid descriptor.
.TP
.B EFAULT
The
The
.I name
parameter points to memory not in a valid part of the
process address space.
@ -89,9 +91,9 @@ SVr4, 4.4BSD (the
.BR getsockname ()
function call appeared in 4.2BSD), POSIX.1-2001.
.\" SVr4 documents additional ENOMEM
.\" and ENOSR error codes.
.\" and ENOSR error codes.
.SH NOTE
The third argument of
The third argument of
.BR getsockname ()
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.

View File

@ -36,7 +36,7 @@
.\" 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 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.
.\"
.TH GETSOCKOPT 2 1999-05-24 "Linux Man Page" "Linux Programmer's Manual"
@ -60,7 +60,8 @@ and
.BR setsockopt ()
manipulate the
.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
.B socket
level.
@ -73,7 +74,8 @@ is specified as
.BR SOL_SOCKET .
To manipulate options at any
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
.B TCP
protocol,
@ -92,23 +94,26 @@ are used to access option values for
For
.BR getsockopt ()
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 (),
.I optlen
is a value-result parameter, initially containing the
size of the buffer pointed to by
.IR optval ,
and modified on return to indicate the actual size of
the value returned. If no option value is
to be supplied or returned,
the value returned.
If no option value is to be supplied or returned,
.I optval
may be NULL.
.I Optname
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>
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
entries in section 4 of the manual.
@ -125,7 +130,8 @@ For a description of the available socket options see
.BR socket (7)
and the appropriate protocol man pages.
.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
is set appropriately.
.SH ERRORS
@ -136,9 +142,10 @@ The argument
is not a valid descriptor.
.TP
.B EFAULT
The address pointed to by
The address pointed to by
.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 (),
this error may also be returned if
.I optlen
@ -146,7 +153,7 @@ is not in a valid part of the process address space.
.TP
.B EINVAL
.I optlen
invalid in
invalid in
.BR setsockopt ().
.TP
.B ENOPROTOOPT
@ -157,22 +164,22 @@ The argument
.I s
is a file, not a socket.
.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.
.\" 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
.\" options
.SH NOTE
The
The
.I optlen
argument of
argument of
.BR getsockopt " and " setsockopt
is in reality an
is in reality an
.I "int [*]"
(and this is what 4.x BSD and libc4 and libc5 have).
Some POSIX confusion resulted in the present
.IR socklen_t ,
Some POSIX confusion resulted in the present
.IR socklen_t ,
also used by glibc.
See also
.BR accept (2).

View File

@ -9,7 +9,7 @@
.\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one.
.\"
.\"
.\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" 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,
.\" which is licensed free of charge, as they might when working
.\" professionally.
.\"
.\"
.\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work.
.\"
@ -38,13 +38,15 @@ gettid \- get thread identification
.fi
.B pid_t gettid(void);
.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
.BR getpid (2)),
unless the process is part of a thread group (created by specifying
the CLONE_THREAD flag to the
.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.
.SH "RETURN VALUE"
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
.\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one.
.\"
.\"
.\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" 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,
.\" which is licensed free of charge, as they might when working
.\" professionally.
.\"
.\"
.\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work.
.\"
@ -53,11 +53,11 @@ The functions
and
.BR settimeofday ()
can get and set the time as well as a timezone.
The
The
.I tv
argument is a
.I struct timeval
(as specified in
argument is a
.I struct timeval
(as specified in
.IR <sys/time.h> ):
.sp
.in +0.25i
@ -71,9 +71,9 @@ struct timeval {
.sp
and gives the number of seconds and microseconds since the Epoch (see
.BR time (2)).
The
The
.I tz
argument is a
argument is a
.IR "struct timezone" :
.sp
.in +0.25i
@ -87,7 +87,7 @@ struct timezone {
.PP
If either
.I tv
or
or
.I tz
is NULL, the corresponding structure is not set or returned.
.\" 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
.\" .BR settimeofday ().
.PP
The use of the
.I timezone
The use of the
.I timezone
structure is obsolete; the
.I tz
argument should normally be specified as NULL.
@ -105,17 +105,19 @@ The
field has never been used under Linux; it has not
been and will not be supported by libc or glibc.
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.
The field
.I tz_dsttime
contains a symbolic constant (values are given below)
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
algorithm.)
The daylight saving time algorithms defined are as follows :
The daylight saving time algorithms defined are as follows :
.PP
\fB DST_NONE\fP /* not on dst */
.br
@ -143,8 +145,10 @@ Of course it turned out that the period in which
Daylight Saving Time is in force cannot be given
by a simple algorithm, one per country; indeed,
this period is determined by unpredictable political
decisions. So this method of representing time zones
has been abandoned. Under Linux, in a call to
decisions.
So this method of representing time zones
has been abandoned.
Under Linux, in a call to
.BR settimeofday ()
the
.I tz_dsttime
@ -160,12 +164,13 @@ argument, the
.I tv
argument is NULL and the
.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
to get UTC system time.
No doubt it is a bad idea to use this feature.
.PP
The following macros are defined to operate on a
The following macros are defined to operate on a
.IR "struct timeval" :
.sp
.nf
@ -192,7 +197,7 @@ is set appropriately).
.SH ERRORS
.TP
.B EFAULT
One of
One of
.I tv
or
.I tz
@ -202,7 +207,7 @@ pointed outside the accessible address space.
Timezone (or something else) is invalid.
.TP
.B EPERM
The calling process has insufficient privilege to call
The calling process has insufficient privilege to call
.BR settimeofday ();
under Linux the
.B CAP_SYS_TIME
@ -220,14 +225,14 @@ are (since glibc2.2.2) only available if
.B _BSD_SOURCE
is defined.
.LP
Traditionally, the fields of
.I struct timeval
Traditionally, the fields of
.I struct timeval
were longs.
.SH "CONFORMING TO"
SVr4, 4.3BSD.
SVr4, 4.3BSD.
POSIX.1-2001 describes
.BR gettimeofday ()
but not
but not
.BR settimeofday ().
.SH "SEE ALSO"
.BR date (1),

View File

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

View File

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

View File

@ -12,7 +12,7 @@
.\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one.
.\"
.\"
.\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" 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,
.\" which is licensed free of charge, as they might when working
.\" professionally.
.\"
.\"
.\" Formatted or processed versions of this manual, if unaccompanied by
.\" 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.
.\" 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
.\"
.TH INIT_MODULE 2 "2002" "Linux" "Linux Module Support"
@ -60,7 +60,8 @@ the rest of the module.
.PP
This system call requires privilege.
.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
is set appropriately.
.SH ERRORS
@ -81,7 +82,7 @@ slot is filled in incorrectly,
.I image->name
does not correspond to the original module name, some
.I image->deps
entry does not correspond to a loaded module,
entry does not correspond to a loaded module,
or some other similar inconsistency.
.TP
.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 );
.SH DESCRIPTION
.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
.IR pathname ;
the caller must have read permission for this file.
The
The
.I fd
argument is a file descriptor referring to the
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
.BR inotify_add_watch ()
returns the unique watch descriptor associated with
returns the unique watch descriptor associated with
.I pathname
for this inotify instance.
If
If
.I pathname
was not previously being watched by this inotify instance,
then the watch descriptor is newly allocated.
then the watch descriptor is newly allocated.
If
.I pathname
was already being watched, then the descriptor
@ -69,10 +69,10 @@ for the existing watch is returned.
The watch descriptor is returned by later
.BR read (2)s
from the inotify file descriptor.
from the inotify file descriptor.
These reads fetch
.I inotify_event
structures indicating file system events;
structures indicating file system events;
the returned watch descriptor identifies
the object for which the event occurred.
.SH "RETURN VALUE"
@ -111,5 +111,5 @@ Inotify was merged into the 2.6.13 Linux kernel.
This system call is Linux specific.
.SH "SEE ALSO"
.BR inotify_init (2),
.BR inotify_rm_watch (2),
.BR inotify_rm_watch (2),
.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.
.SH "SEE ALSO"
.BR inotify_add_watch (2),
.BR inotify_rm_watch (2),
.BR inotify_rm_watch (2),
.BR inotify (7).

View File

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

View File

@ -56,8 +56,9 @@ A _syscall macro
desired system call
.SS Setup
The important thing to know about a system call is its prototype. You
need to know how many arguments, their types, and the function return type.
The important thing to know about a system call is its prototype.
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.
They have the form:
.sp
@ -65,7 +66,7 @@ They have the form:
.RI _syscall X ( type , name , type1 , arg1 , type2 , arg2 ,...)
.RS
.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
.HP
\fItype\fP is the return type of the system call
@ -79,7 +80,8 @@ system call
.RE
.sp
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.
.SH EXAMPLE
.sp
@ -94,7 +96,7 @@ _syscall1(int, sysinfo, struct sysinfo *, info);
/* Note: if you copy directly from the nroff source, remember to
REMOVE the extra backslashes in the printf statement. */
int
int
main(void)
{
struct sysinfo s_info;
@ -126,11 +128,13 @@ Swap: total 27881472 / free 24698880
Number of processes = 40
.fi
.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.
.sp
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.
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
@ -141,7 +145,8 @@ For the error codes, see
.sp
Some system calls, such as
.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.
.sp
When defining a system call, the argument types MUST be passed by-value
@ -152,19 +157,19 @@ about yet is via
.BR syscall (2).
However, this mechanism can only be used if using a libc
(such as glibc) that supports
.BR syscall (2),
and if the
.BR syscall (2),
and if the
.I <sys/syscall.h>
header file contains the required SYS_foo definition.
Otherwise, the use of a _syscall macro is required.
Some architectures, notably ia64, do not provide the _syscall macros.
On these architectures,
.BR syscall (2)
.BR syscall (2)
must be used.
.SH "CONFORMING 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
.BR standards (7).
.SH FILES

View File

@ -27,23 +27,23 @@ io_cancel \- cancel an outstanding asynchronous I/O operation
.nf
.\" .ad l
.\" .hy 0
.\"
.\"
.B #include <libaio.h>
.\"#include <linux/aio.h>
.sp
.\" .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 );
.\" .ad
.\" .hy
.fi
.SH "DESCRIPTION"
.PP
\fBio_cancel\fR() attempts to cancel an asynchronous I/O operation
previously submitted with the \fBio_submit\fR system call.
\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
into the memory pointed to by \fIresult\fR without being placed
\fBio_cancel\fR() attempts to cancel an asynchronous I/O operation
previously submitted with the \fBio_submit\fR system call.
\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
into the memory pointed to by \fIresult\fR without being placed
into the completion queue.
.SH "RETURN VALUE"
.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.
.SH "CONFORMING TO"
.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.
.SH "SEE ALSO"
.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).
.\" .SH "NOTES"
.\"
.\"
.\" .PP
.\" The asynchronous I/O system calls were written by Benjamin LaHaise.
.\"
.\"
.\" .SH AUTHOR
.\" Kent Yoder.

View File

@ -37,9 +37,9 @@ io_destroy \- destroy an asynchronous I/O context
.fi
.SH "DESCRIPTION"
.PP
\fBio_destroy\fR() removes the asynchronous I/O context from the list of
I/O contexts and then destroys it.
\fBio_destroy\fR() can also cancel any outstanding asynchronous I/O
\fBio_destroy\fR() removes the asynchronous I/O context from the list of
I/O contexts and then destroys it.
\fBio_destroy\fR() can also cancel any outstanding asynchronous I/O
actions on \fIctx\fR and block on completion.
.SH "RETURN VALUE"
.PP
@ -58,19 +58,19 @@ The context pointed to is invalid.
\fBio_destroy\fR() is not implemented on this architecture.
.SH "CONFORMING TO"
.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.
.SH "VERSIONS"
.PP
The asynchronous I/O system calls first appeared in Linux 2.5, August 2002.
.SH "SEE ALSO"
.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).
.\" .SH "NOTES"
.\"
.\"
.\" .PP
.\" The asynchronous I/O system calls were written by Benjamin LaHaise.
.\"
.\"
.\" .SH AUTHOR
.\" Kent Yoder.

View File

@ -32,7 +32,7 @@ io_getevents \- read asynchronous I/O events from the completion queue
.\" #include <linux/aio.h>
.sp
.\" .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 \
", struct timespec *" timeout );
.\" .ad
@ -40,24 +40,24 @@ io_getevents \- read asynchronous I/O events from the completion queue
.fi
.SH "DESCRIPTION"
.PP
\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
specified by \fIctx_id\fR.
\fItimeout\fR specifies the amount of time to wait for events,
\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
specified by \fIctx_id\fR.
\fItimeout\fR specifies the amount of time to wait for events,
where a NULL timeout waits until at least \fImin_nr\fR events
have been seen.
Note that \fItimeout\fR is relative and will be updated if not NULL
have been seen.
Note that \fItimeout\fR is relative and will be updated if not NULL
and the operation blocks.
.SH "RETURN VALUE"
.PP
On success,
\fBio_getevents\fR() returns the number of events read: 0 if no events are
On success,
\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;
on failure, it returns one of the errors listed under ERRORS.
.SH "ERRORS"
.TP
.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.
.TP
.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.
.SH "CONFORMING TO"
.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.
.SH "VERSIONS"
.PP
The asynchronous I/O system calls first appeared in Linux 2.5, August 2002.
.SH "SEE ALSO"
.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).
.\" .SH "NOTES"
.\"
.\"
.\" .PP
.\" The asynchronous I/O system calls were written by Benjamin LaHaise.
.\"
.\"
.\" .SH AUTHOR
.\" Kent Yoder.

View File

@ -37,20 +37,20 @@ io_setup \- create an asynchronous I/O context
.fi
.SH "DESCRIPTION"
.PP
\fBio_setup\fR() creates an asynchronous I/O context capable of receiving
at least \fInr_events\fR.
\fIctxp\fR must not point to an AIO context that already exists, and must
be initialized to 0 prior to the call.
On successful creation of the AIO context, \fI*ctxp\fR is filled in
\fBio_setup\fR() creates an asynchronous I/O context capable of receiving
at least \fInr_events\fR.
\fIctxp\fR must not point to an AIO context that already exists, and must
be initialized to 0 prior to the call.
On successful creation of the AIO context, \fI*ctxp\fR is filled in
with the resulting handle.
.SH "RETURN VALUE"
.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.
.SH "ERRORS"
.TP
.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.
.TP
.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.
.SH "CONFORMING TO"
.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.
.SH "VERSIONS"
.PP
The asynchronous I/O system calls first appeared in Linux 2.5, August 2002.
.SH "SEE ALSO"
.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).
.\" .SH "NOTES"
.\" .PP

View File

@ -37,22 +37,22 @@ io_submit \- submit asynchronous I/O blocks for processing
.fi
.SH "DESCRIPTION"
.PP
\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
\fInr\fR AIO request blocks,
\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
\fInr\fR AIO request blocks,
which will be submitted to context \fIctx_id\fR.
.SH "RETURN VALUE"
.PP
On success,
On success,
\fBio_submit\fR() returns the number of \fIiocb\fRs submitted (which may be
0 if \fInr\fR is zero);
on failure, it returns one of the errors listed under ERRORS.
.SH "ERRORS"
.TP
.B EINVAL
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
initialized, or the operation specified is invalid for the file descriptor
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
initialized, or the operation specified is invalid for the file descriptor
in the \fIiocb\fR.
.TP
.B EFAULT
@ -68,14 +68,14 @@ Insufficient resources are available to queue any \fIiocb\fRs.
\fBio_submit\fR() is not implemented on this architecture.
.SH "CONFORMING TO"
.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.
.SH "VERSIONS"
.PP
The asynchronous I/O system calls first appeared in Linux 2.5, August 2002.
.SH "SEE ALSO"
.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).
.\" .SH "NOTES"
.\" .PP

View File

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

View File

@ -2,31 +2,32 @@
.\" Sun 17 Sep 1995
.\" Michael Elizabeth Chastain
.\" <mec@duracef.shout.net>
.\"
.\"
.\" // Copyright
.\"
.\"
.\" Ioctl List 1.3.27 is copyright 1995 by Michael Elizabeth Chastain.
.\" It is licensed under the Gnu Public License, Version 2.
.\"
.\"
.\"
.\"
.\"
.\"
.\" // Change Log
.\"
.\"
.\" 1.3.27 421 ioctls.
.\" Type information for non-pointer args.
.\" SIOCDEVPRIVATE, SIOCPROTOPRIVATE ioctls.
.\" Descriptions of extended arguments.
.\"
.\"
.\" 1.2.9 365 ioctls.
.\" First public version.
.\"
.\"
.\"
.\"
.TH IOCTL_LIST 2 2003-03-30 "Linux 1.3" "Linux Programmer's Manual"
.SH NAME
ioctl_list \- list of ioctl calls in Linux/i386 kernel
.SH DESCRIPTION
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
type are given.
.PP
@ -36,7 +37,8 @@ If the kernel uses the argument for both input and output, this is
marked with // I-O.
.PP
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.
.PP
This list is very incomplete.
@ -49,9 +51,12 @@ tried to build some structure into them.
.LP
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
indicating the driver. Sometimes the major number was used: 0x03
for the HDIO_* ioctls, 0x06 for the LP* ioctls. And sometimes
one or more ASCII letters were used. For example, TCGETS has value
indicating the driver.
Sometimes the major number was used: 0x03
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
CYGETTIMEOUT has value 0x00435906, with 0x43 0x59 = 'C' 'Y'
indicating the cyclades driver.
@ -78,7 +83,8 @@ it does not help in checking, but it causes varying values
for the various architectures.
.SH "RETURN VALUE"
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.
This is not yet indicated below.
.nf
@ -567,16 +573,18 @@ This is not yet indicated below.
// More arguments.
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 *'.
The 'buf' field points to an output buffer
of length 'nframes * CD_FRAMESIZE_RAW'.
CDROMREADCOOKED, CDROMREADMODE1, CDROMREADMODE2, and CDROMREADRAW take
an input pointer 'const struct cdrom_msf *'. They use the same pointer
as an output pointer to 'char []'. The length varies by request. For
CDROMREADMODE1, most drivers use 'CD_FRAMESIZE', but the Optics Storage
an input pointer 'const struct cdrom_msf *'.
They use the same pointer as an output pointer to 'char []'.
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
2048).
@ -596,29 +604,35 @@ The 'ifr_data' field is a pointer to another structure as follows:
EQL_GETMASTERCFG 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'.
If 'flags & FD_RAW_READ' is non-zero, then 'data' points to an output
buffer of length 'length'.
GIO_FONTX and PIO_FONTX take a 'struct console_font_desc *' or
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.
GIO_UNIMAP and PIO_UNIMAP take a 'struct unimapdesc *' or
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.
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
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
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.
SIOCADDRT and SIOCDELRT take an input pointer whose type depends on
@ -628,7 +642,8 @@ the protocol:
AX.25 const struct ax25_route *
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
type 'struct ifreq []'.
@ -637,8 +652,10 @@ SIOCSIFHWADDR takes an input pointer whose type depends on the protocol:
Most protocols const struct ifreq *
AX.25 const char [AX25_ADDR_LEN]
TIOCLINUX takes a 'const char *'. It uses this to distinguish several
independent sub-cases. In the table below, 'N + foo' means 'foo' after
TIOCLINUX takes a 'const char *'.
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
in 'drivers/char/selection.c'

View File

@ -3,7 +3,7 @@
.\" Copyright (c) 1993 Michael Haardt
.\" (michael@moria.de)
.\" Fri Apr 2 11:32:09 MET DST 1993
.\"
.\"
.\" This is free documentation; you can redistribute it and/or
.\" modify it under the terms of the GNU General Public License as
.\" published by the Free Software Foundation; either version 2 of
@ -25,7 +25,7 @@
.\" USA.
.\"
.\" 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>
.\" 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>
@ -46,26 +46,27 @@ ioperm \- set port input/output permissions
.SH DESCRIPTION
\fBioperm\fP() sets the port access permission bits for the process for
\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
.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
.BR iopl ()
function must be used.
Permissions are not inherited on
.BR fork (),
but on
.BR fork (),
but on
.BR exec ()
they are.
they are.
This is useful for giving port access permissions to non-privileged tasks.
This call is mostly for the i386 architecture.
On many other architectures it does not exist or will always
return an error.
.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
is set appropriately.
.SH ERRORS
@ -91,7 +92,7 @@ intended to be portable.
.SH NOTES
Libc5 treats it as a system call and has a prototype in
.IR <unistd.h> .
Glibc1 does not have a prototype.
Glibc1 does not have a prototype.
Glibc2 has a prototype both in
.I <sys/io.h>
and in

View File

@ -11,7 +11,7 @@
.\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one.
.\"
.\"
.\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" 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,
.\" which is licensed free of charge, as they might when working
.\" professionally.
.\"
.\"
.\" Formatted or processed versions of this manual, if unaccompanied by
.\" 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>
.\" 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>
@ -43,18 +43,19 @@ changes the I/O privilege level of the current process, as specified in
.IR level .
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 ()
call is not sufficient.
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
will probably crash the system, and is not recommended.
I/O privilege level also allows the process to disable interrupts.
This will probably crash the system, and is not recommended.
Permissions are inherited by
.BR fork ()
and
.BR exec ().
.BR fork ()
and
.BR exec ().
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
return an error.
.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
is set appropriately.
.SH ERRORS
@ -75,7 +77,7 @@ is greater than 3.
This call is unimplemented.
.TP
.B EPERM
The calling process has insufficient privilege to call
The calling process has insufficient privilege to call
.BR iopl ();
the
.B CAP_SYS_RAWIO
@ -86,7 +88,8 @@ intended to be portable.
.SH NOTES
Libc5 treats it as a system call and has a prototype in
.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>
and in
.IR <sys/perm.h> .

View File

@ -138,7 +138,8 @@ See the NOTES section for more
information on scheduling classes and priorities.
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
dirtying the memory, and thus program-specific priorities do not apply.
.SH "RETURN VALUE"
@ -235,7 +236,8 @@ These nice levels are grouped in three scheduling classes
each one containing one or more priority levels:
.TP
.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:
processes from this class are
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)"
This is the idle scheduling class.
Processes running at this level only get I/O
time when no one else needs the disk. The idle class has no class
data.
time when no one else needs the disk.
The idle class has no class
data.
Attention is required when assigning this priority class to a process,
since it may become starved if higher priority processes are
constantly accessing the disk.

View File

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

View File

@ -10,7 +10,7 @@
.\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one.
.\"
.\"
.\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" 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,
.\" which is licensed free of charge, as they might when working
.\" professionally.
.\"
.\"
.\" Formatted or processed versions of this manual, if unaccompanied by
.\" 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.
.LP
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
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
\fIkill\fP().
.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,
.BR kill ()
failed with the error
.B EPERM
failed with the error
.B EPERM
if the caller did have permission to send the signal to \fIany\fP (rather
than \fIall\fP) of the members of the process group.
Notwithstanding this error return, the signal was still delivered
than \fIall\fP) of the members of the process group.
Notwithstanding this error return, the signal was still delivered
to all of the processes for which the caller had permission to signal.
.SH "LINUX HISTORY"
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 2004-06-16 by Michael Kerrisk <mtk-manpages@gmx.net>
.\" 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"
.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
processes belong to the same session.
.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
is set appropriately.
.SH ERRORS
@ -94,8 +95,9 @@ The process group was given as 0 but the sending process does not
have a process group.
.SH NOTES
There are various differences between the permission checking
in BSD-type systems and System V-type systems. See the POSIX rationale
for
in BSD-type systems and System V-type systems.
See the POSIX rationale
for
.BR kill ().
A difference not mentioned by POSIX concerns the return
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
.\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one.
.\"
.\"
.\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" 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,
.\" which is licensed free of charge, as they might when working
.\" professionally.
.\"
.\"
.\" Formatted or processed versions of this manual, if unaccompanied by
.\" 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
\`original'.
.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
is set appropriately.
.SH ERRORS
@ -127,13 +128,14 @@ even if the same filesystem is mounted on both.)
.SH NOTES
Hard links, as created by
.BR link (),
cannot span filesystems. Use
cannot span filesystems.
Use
.BR symlink ()
if this is required.
POSIX.1-2001 says that
.BR link ()
should dereference
should dereference
.I oldpath
if it is a symbolic link.
However, Linux does not do so: if
@ -141,7 +143,7 @@ However, Linux does not do so: if
is a symbolic link, then
.I newpath
is created as a (hard) link to the same symbolic link file
(i.e.,
(i.e.,
.I newpath
becomes a symbolic link to the same file that
.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.
.SH BUGS
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)
to find out if the link got created.
.SH "SEE ALSO"

View File

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

View File

@ -35,7 +35,7 @@
.\" Modified 950727 by aeb, following a suggestion by Urs Thuermann
.\" <urs@isnogud.escape.de>
.\" 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>
.\"
.TH LISTEN 2 1993-07-23 "BSD Man Page" "Linux Programmer's Manual"
@ -64,29 +64,32 @@ or
The
.I backlog
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
.B ECONNREFUSED
or, if the underlying protocol supports retransmission, the request may be
ignored so that retries succeed.
.SH NOTES
The behaviour of the
.I backlog
The behaviour of the
.I backlog
parameter on TCP sockets changed with Linux 2.2.
Now it specifies the queue length for
.I completely
Now it specifies the queue length for
.I completely
established sockets waiting to be accepted, instead of the number of incomplete
connection requests. The maximum length of the queue for incomplete sockets
can be set using the
connection requests.
The maximum length of the queue for incomplete sockets
can be set using the
.B tcp_max_syn_backlog
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.
See
See
.BR tcp (7)
for more information.
.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
is set appropriately.
.SH ERRORS
@ -112,18 +115,18 @@ operation.
4.4BSD, POSIX.1-2001.
The
.BR listen ()
function call first appeared in 4.2BSD.
function call first appeared in 4.2BSD.
.SH BUGS
If the socket is of type
.BR AF_INET ,
If the socket is of type
.BR AF_INET ,
and the
.I backlog
argument is greater
than the constant
.B SOMAXCONN
than the constant
.B SOMAXCONN
(128 in Linux 2.0 & 2.2), it is silently truncated
to
.BR SOMAXCONN .
to
.BR SOMAXCONN .
.\" The following is now rather historic information (MTK, Jun 05)
.\" Don't rely on this value in portable applications since BSD
.\" (and some BSD-derived systems) limit the backlog to 5.

View File

@ -64,7 +64,7 @@ The length of the attribute name
is returned.
.PP
.BR llistxattr ()
is identical to
is identical to
.BR listxattr (),
except in the case of a symbolic link, where the list of names of
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
.\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one.
.\"
.\"
.\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" 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,
.\" which is licensed free of charge, as they might when working
.\" professionally.
.\"
.\"
.\" Formatted or processed versions of this manual, if unaccompanied by
.\" 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 <errno.h>
.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)
/* Using \fBsyscall\fP(2) may be preferable; see \fBintro\fP(2) */
.sp
.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 );
.fi
.SH DESCRIPTION
@ -83,4 +83,4 @@ This function is Linux specific, and should not be used in programs
intended to be portable.
.SH "SEE ALSO"
.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
.\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one.
.\"
.\"
.\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" 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,
.\" which is licensed free of charge, as they might when working
.\" professionally.
.\"
.\"
.\" Formatted or processed versions of this manual, if unaccompanied by
.\" 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
.I cookie
.
The cookie is an opaque identifier uniquely identifying a particular directory
entry. The buffer given is filled in with the full path of the directory
entry.
The cookie is an opaque identifier uniquely identifying a particular
directory entry.
The buffer given is filled in with the full path of the directory entry.
For
.BR lookup_dcookie ()
to return successfully,
to return successfully,
the kernel must still hold a cookie reference to the directory entry.
.SH "NOTES"
.BR lookup_dcookie ()
@ -73,7 +73,7 @@ The kernel could not allocate memory for the temporary buffer holding
the path.
.TP
.B EPERM
The process does not have the capability
The process does not have the capability
.B CAP_SYS_ADMIN
required to look up cookie values.
.TP

View File

@ -81,13 +81,13 @@ The
function allows the file offset to be set beyond the end
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
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.
.SH "RETURN VALUE"
Upon successful completion,
.BR lseek ()
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
.I errno
is set to indicate the error.
@ -107,7 +107,7 @@ or beyond the end of a seekable device.
.TP
.B 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 .
.TP
.B ESPIPE
@ -117,7 +117,7 @@ is associated with a pipe, socket, or FIFO.
SVr4, 4.3BSD, POSIX.1-2001.
.SH RESTRICTIONS
Some devices are incapable of seeking and POSIX does not specify which
devices must support
devices must support
.BR lseek ().
Linux specific restrictions: using \fBlseek\fP() on a tty device returns
@ -157,4 +157,4 @@ subject to race conditions.
.BR open (2),
.BR fseek (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
.\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one.
.\"
.\"
.\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" 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,
.\" which is licensed free of charge, as they might when working
.\" professionally.
.\"
.\"
.\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work.
.\"
@ -49,21 +49,24 @@ the address range beginning at address
.I start
and with size
.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
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
.BR MADV_DONTNEED ),
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
The advice is indicated in the
The advice is indicated in the
.I advice
parameter which can be
.TP
.B MADV_NORMAL
No special treatment. This is the default.
No special treatment.
This is the default.
.TP
.B MADV_RANDOM
Expect page references in random order.
@ -89,13 +92,13 @@ without an underlying file.
.TP
.BR MADV_REMOVE " (Since Linux 2.6.16)"
Free up a given range of pages
and its associated backing store.
and its associated backing store.
Currently,
.\" 2.6.18-rc5
only shmfs/tmpfs supports this; other filesystems return -ENOSYS.
.\" Databases want to use this feature to drop a section of their
.\" bufferpool (shared memory segments) - without writing back to
.\" disk/swap space. This feature is also useful for supporting
only shmfs/tmpfs supports this; other filesystems return -ENOSYS.
.\" Databases want to use this feature to drop a section of their
.\" bufferpool (shared memory segments) - without writing back to
.\" disk/swap space. This feature is also useful for supporting
.\" hot-plug memory on UML.
.TP
.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
DMAs into the page(s).)
.\" [PATCH] madvise MADV_DONTFORK/MADV_DOFORK
.\" Currently, copy-on-write may change the physical address of
.\" a page even if the user requested that the page is pinned in
.\" memory (either by mlock or by get_user_pages). This happens
.\" if the process forks meanwhile, and the parent writes to that
.\" page. As a result, the page is orphaned: in case of
.\" 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,
.\" Currently, copy-on-write may change the physical address of
.\" a page even if the user requested that the page is pinned in
.\" memory (either by mlock or by get_user_pages). This happens
.\" if the process forks meanwhile, and the parent writes to that
.\" page. As a result, the page is orphaned: in case of
.\" 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,
.\" 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.
.\"
.\" This patch adds madvise options to control whether memory range is
.\" inherited across fork. Useful e.g. for when hardware is doing DMA
.\" from/into these pages. Could also be useful to an application
.\" wanting to speed up its forks by cutting large areas out of
.\"
.\" This patch adds madvise options to control whether memory range is
.\" inherited across fork. Useful e.g. for when hardware is doing DMA
.\" from/into these pages. Could also be useful to an application
.\" wanting to speed up its forks by cutting large areas out of
.\" consideration.
.TP
.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
.BR fork (2).
.SH "RETURN VALUE"
On success
On success
.BR madvise ()
returns zero. On error, it returns \-1 and
returns zero.
On error, it returns \-1 and
.I errno
is set appropriately.
.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.
.TP
.B EINVAL
The value
The value
.IR len
is negative,
.\" .I len
.\" is zero,
.I start
is not page-aligned,
.I advice
.I advice
is not a valid value, or the application is attempting
to release locked or shared pages (with MADV_DONTNEED).
.TP
@ -179,10 +183,11 @@ The Linux implementation requires that the address
.I start
be page-aligned, and allows
.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
.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
from the system call, as it should).
.SH HISTORY
@ -194,7 +199,7 @@ POSIX.1b.
POSIX.1-2001 describes
.BR posix_madvise ()
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
.BR posix_fadvise ()
for file access.

View File

@ -8,15 +8,15 @@
.\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one.
.\"
.\"
.\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" 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
.\" the source, must acknowledge the copyright and authors of this work.
.\"
.\"
.\" 2006-02-03, mtk, substantial wording changes and other improvements
.\"
.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
.B "#include <numaif.h>"
.sp
.BI "int mbind(void *" start ", unsigned long " len ", int " policy ,
.BI " unsigned long *" nodemask ", unsigned long " maxnode ,
.BI "int mbind(void *" start ", unsigned long " len ", int " policy ,
.BI " unsigned long *" nodemask ", unsigned long " maxnode ,
.BI " unsigned " flags );
.sp
.BI "cc ... -lnuma"
.fi
.SH DESCRIPTION
.BR mbind ()
sets the NUMA memory
.I policy
sets the NUMA memory
.I policy
for the memory range starting with
.I start
and continuing for
.IR len
bytes.
.IR len
bytes.
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 ()
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,
then the policy has no effect.
Available policies are
Available policies are
.BR MPOL_DEFAULT ,
.BR MPOL_BIND ,
.BR MPOL_INTERLEAVE ,
and
.BR MPOL_PREFERRED .
All policies except
All policies except
.B MPOL_DEFAULT
require the caller to specify the nodes to which the policy applies in the
.I nodemask
.I nodemask
parameter.
.I nodemask
is a bitmask of nodes containing up to
.I nodemask
is a bitmask of nodes containing up to
.I maxnode
bits.
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)" ,
but the kernel will only use bits up to
.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
policy is the default and means to use the underlying process policy
(which can be modified with
.BR set_mempolicy (2)).
.BR set_mempolicy (2)).
Unless the process policy has been changed this means to allocate
memory on the node of the CPU that triggered the allocation.
.I nodemask
memory on the node of the CPU that triggered the allocation.
.I nodemask
should be specified as NULL.
The
.B MPOL_BIND
policy is a strict policy that restricts memory allocation to the
nodes specified in
policy is a strict policy that restricts memory allocation to the
nodes specified in
.IR nodemask .
There won't be allocations on other nodes.
.B MPOL_INTERLEAVE
interleaves allocations to the nodes specified in
interleaves allocations to the nodes specified in
.IR nodemask .
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.
.B MPOL_PREFERRED
sets the preferred node for allocation.
sets the preferred node for allocation.
The kernel will try to allocate in this
node first and fall back to other nodes if the
preferred nodes is low on free memory.
Only the first node in the
.I nodemask
is used.
If no node is set in the mask, then the memory is allocated on
node first and fall back to other nodes if the
preferred nodes is low on free memory.
Only the first node in the
.I nodemask
is used.
If no node is set in the mask, then the memory is allocated on
the node of the CPU that triggered the allocation allocation).
If
.B MPOL_MF_STRICT
is passed in
is passed in
.IR flags
and
.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.
If
.B MPOL_MF_MOVE
is passed in
.B MPOL_MF_MOVE
is passed in
.IR flags ,
then an attempt will be made to
move all the pages in the mapping so that they follow the policy.
Pages that are shared with other processes are not moved.
If
move all the pages in the mapping so that they follow the policy.
Pages that are shared with other processes are not moved.
If
.B MPOL_MF_STRICT
is also specified, then the call will fail with the error
.B EIO
.B EIO
if some pages could not be moved.
If
.B MPOL_MF_MOVE_ALL
is passed in
.IR flags ,
then all pages in the mapping will be moved regardless of whether
.B MPOL_MF_MOVE_ALL
is passed in
.IR flags ,
then all pages in the mapping will be moved regardless of whether
other processes use the pages.
The calling process must be privileged
.RB ( CAP_SYS_NICE )
to use this flag.
If
If
.B MPOL_MF_STRICT
is also specified, then the call will fail with the error
.B EIO
.B EIO
if some pages could not be moved.
.SH RETURN VALUE
On success,
.BR mbind ()
returns 0;
on error, \-1 is returned and
.I errno
.I errno
is set to indicate the error.
.SH ERRORS
.TP
.TP
.B EFAULT
There was a unmapped hole in the specified memory range
or a passed pointer was not valid.
.TP
.TP
.B EINVAL
An invalid value was specified for
.I flags
or
.IR mode ;
or
or
.I start + len
was less than
was less than
.IR start ;
or
.I policy
was
was
.B MPOL_DEFAULT
and
.I nodemask
pointed to a non-empty set;
or
.I policy
was
was
.B MPOL_BIND
or
.B MPOL_INTERLEAVE
@ -188,9 +188,9 @@ pointed to an empty set,
.B ENOMEM
System out of memory.
.TP
.B EIO
.B EIO
.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.
.SH NOTES
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,
.BR MPOL_DEFAULT ,
has different effects for
has different effects for
.BR mbind (2)
and
.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
.BR set_mempolicy ()
.BR MPOL_DEFAULT )
when calling
when calling
.BR mbind (),
specify a
.I policy
of
specify a
.I policy
of
.B MPOL_PREFERRED
with an empty
with an empty
.IR nodemask .
.SH "VERSIONS AND LIBRARY SUPPORT"
The
@ -222,12 +222,12 @@ The
.BR get_mempolicy (),
and
.BR set_mempolicy ()
system calls were added to the Linux kernel with version 2.6.7.
They are only available on kernels compiled with
system calls were added to the Linux kernel with version 2.6.7.
They are only available on kernels compiled with
.BR CONFIG_NUMA .
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.
.B MPOL_MF_MOVE
@ -236,31 +236,31 @@ and
are only available on Linux 2.6.16 and later.
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)
functions in the
.I numactl
functions in the
.I numactl
package is recommended.
The
.I numactl
package is available at
.IR ftp://ftp.suse.com/pub/people/ak/numa/ .
You can link with
You can link with
.I -lnuma
to get system call definitions.
.I libnuma
is available in the
to get system call definitions.
.I libnuma
is available in the
.I numactl
package.
This package also has the
package.
This package also has the
.I numaif.h
header.
.SH CONFORMING TO
This system call is Linux specific.
.SH SEE ALSO
.BR numa (3),
.BR numactl (8),
.BR numa (3),
.BR numactl (8),
.BR set_mempolicy (2),
.BR get_mempolicy (2),
.BR get_mempolicy (2),
.BR mmap (2)

View File

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

View File

@ -24,7 +24,8 @@ attempts to create a directory named
The parameter
.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
in the usual way: the permissions of the created directory are
.RI ( mode " & ~" umask " & 0777)."
@ -32,7 +33,8 @@ Other mode bits of the created directory depend on the operating system.
For Linux, see below.
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
new directory will inherit the group ownership from its parent;
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
.SH NOTES
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)."
See also
.BR stat (2).
.PP
There are many infelicities in the protocol underlying NFS. Some
of these affect
There are many infelicities in the protocol underlying NFS.
Some of these affect
.BR mkdir ().
.SH "SEE ALSO"
.BR mkdir (1),

View File

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

View File

@ -70,7 +70,8 @@ If
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
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
new node will inherit the group ownership from its parent directory;
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
refers to a file on a read-only filesystem.
.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
.\" does not require root permission to create pipes, also in that no
.\" EMULTIHOP, ENOLINK, or EINTR error is documented.
.SH NOTES
POSIX.1-2001 says: "The only portable use of
.BR mknod ()
is to create a FIFO-special file. If
is to create a FIFO-special file.
If
.I mode
is not S_IFIFO or
.I dev
@ -166,8 +168,8 @@ and FIFOs with
.BR mkfifo (2).
.\" Unix domain sockets with .BR socket " (and " bind ),
There are many infelicities in the protocol underlying NFS. Some
of these affect
There are many infelicities in the protocol underlying NFS.
Some of these affect
.BR mknod ().
.SH "SEE ALSO"
.BR fcntl (2),

View File

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

View File

@ -44,7 +44,7 @@ mlock, munlock, mlockall, munlockall \- lock and unlock memory
and
.BR mlockall ()
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.
.BR munlock ()
and
@ -61,7 +61,7 @@ locks pages in the address range starting at
and continuing for
.I len
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;
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()"
.BR mlockall ()
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
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;
the pages are guaranteed to stay in RAM until later unlocked.
@ -93,7 +95,8 @@ the process.
.TP
.B MCL_FUTURE
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
shared memory regions.
.PP
@ -107,7 +110,7 @@ may fail if it would cause the number of locked bytes to exceed
the permitted maximum (see below).
In the same circumstances, stack growth may likewise fail:
the kernel will deny stack expansion and deliver a
.BR SIGSEGV
.BR SIGSEGV
signal to the process.
.BR munlockall ()
@ -115,13 +118,16 @@ unlocks all pages mapped into the address space of the
calling process.
.SH "NOTES"
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
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
.BR sched_setscheduler (2).
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,
where they might be accessible to the enemy long after the security
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
locked stack pages before entering the time-critical section,
so that no page fault can be caused by function calls.
This can be achieved by calling a function that allocates a
sufficiently large automatic variable (an array) and writes to the
memory occupied by this array in order to touch these stack pages.
This can be achieved by calling a function that allocates a
sufficiently large automatic variable (an array) and writes to the
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
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.
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.
.\" In the case of mlock(), this check is somewhat buggy: it doesn't
.\" 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
.\" mlock(), and then lock the *same* page range a second time.
.\" In the case, the second mlock() call will fail, since the check
@ -218,13 +225,13 @@ half of RAM.
.B EPERM
(Linux 2.6.9 and later) the caller was not privileged
.RB ( CAP_IPC_LOCK )
and its
and its
.B RLIMIT_MEMLOCK
soft resource limit was 0.
.TP
.B EPERM
(Linux 2.6.8 and earlier)
The calling process has insufficient privilege to call
The calling process has insufficient privilege to call
.BR munlockall ().
Under Linux the
.B CAP_IPC_LOCK
@ -270,17 +277,17 @@ flag to be inherited across a
.BR fork (2).
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)
and later drops privileges (loses the
.B CAP_IPC_LOCK
capability by, for example,
setting its effective UID to a non-zero value),
then subsequent memory allocations (e.g.,
and later drops privileges (loses the
.B CAP_IPC_LOCK
capability by, for example,
setting its effective UID to a non-zero value),
then subsequent memory allocations (e.g.,
.BR mmap (2),
.BR brk (2))
will fail if the
.B RLIMIT_MEMLOCK
will fail if the
.B RLIMIT_MEMLOCK
resource limit is encountered.
.\" See the following LKML thread:
.\" http://marc.theaimsgroup.com/?l=linux-kernel&m=113801392825023&w=2
@ -293,8 +300,8 @@ and
.BR munlock ()
are available,
.B _POSIX_MEMLOCK_RANGE
is defined in <unistd.h> and the number of bytes in a page
can be determined from the constant
is defined in <unistd.h> and the number of bytes in a page
can be determined from the constant
.B PAGESIZE
(if defined) in <limits.h> or by calling
.IR sysconf(_SC_PAGESIZE) .

View File

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

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