mirror of https://github.com/mkerrisk/man-pages
Add section numbers to references to other pages
This commit is contained in:
parent
2f7b7b571f
commit
0bfa087b03
13
man2/_exit.2
13
man2/_exit.2
|
@ -53,7 +53,7 @@ The value
|
||||||
.I status
|
.I status
|
||||||
is returned to the parent process as the process's exit status, and
|
is returned to the parent process as the process's exit status, and
|
||||||
can be collected using one of the
|
can be collected using one of the
|
||||||
.BR wait ()
|
.BR wait (2)
|
||||||
family of calls.
|
family of calls.
|
||||||
.LP
|
.LP
|
||||||
The function
|
The function
|
||||||
|
@ -72,11 +72,11 @@ exit status, zombie processes, signals sent, etc., see
|
||||||
.LP
|
.LP
|
||||||
The function
|
The function
|
||||||
.BR _exit ()
|
.BR _exit ()
|
||||||
is like \fBexit\fP(), but does not call any
|
is like \fBexit\fP(3), but does not call any
|
||||||
functions registered with
|
functions registered with
|
||||||
.BR atexit ()
|
.BR atexit (3)
|
||||||
or
|
or
|
||||||
.BR on_exit ().
|
.BR on_exit (3).
|
||||||
Whether it flushes
|
Whether it flushes
|
||||||
standard I/O buffers and removes temporary files created with
|
standard I/O buffers and removes temporary files created with
|
||||||
.BR tmpfile (3)
|
.BR tmpfile (3)
|
||||||
|
@ -86,8 +86,9 @@ On the other hand,
|
||||||
does close open file descriptors, and this may cause an unknown delay,
|
does close open file descriptors, and this may cause an unknown delay,
|
||||||
waiting for pending output to finish.
|
waiting for pending output to finish.
|
||||||
If the delay is undesired,
|
If the delay is undesired,
|
||||||
it may be useful to call functions like \fItcflush\fP() before
|
it may be useful to call functions like
|
||||||
calling \fB_exit\fP().
|
.BR tcflush (3)
|
||||||
|
before calling \fB_exit\fP().
|
||||||
Whether any pending I/O is cancelled, and which pending I/O may be
|
Whether any pending I/O is cancelled, and which pending I/O may be
|
||||||
cancelled upon \fB_exit\fP(), is implementation-dependent.
|
cancelled upon \fB_exit\fP(), is implementation-dependent.
|
||||||
.SH "SEE ALSO"
|
.SH "SEE ALSO"
|
||||||
|
|
|
@ -61,17 +61,17 @@ scheduled alarm.
|
||||||
.SH NOTES
|
.SH NOTES
|
||||||
.BR alarm ()
|
.BR alarm ()
|
||||||
and
|
and
|
||||||
.BR setitimer ()
|
.BR setitimer (2)
|
||||||
share the same timer; calls to one will interfere with use of the
|
share the same timer; calls to one will interfere with use of the
|
||||||
other.
|
other.
|
||||||
.PP
|
.PP
|
||||||
.BR sleep ()
|
.BR sleep (3)
|
||||||
may be implemented using
|
may be implemented using
|
||||||
.BR SIGALRM ;
|
.BR SIGALRM ;
|
||||||
mixing calls to
|
mixing calls to
|
||||||
.BR alarm ()
|
.BR alarm ()
|
||||||
and
|
and
|
||||||
.BR sleep ()
|
.BR sleep (3)
|
||||||
is a bad idea.
|
is a bad idea.
|
||||||
|
|
||||||
Scheduling delays can, as ever, cause the execution of the process to
|
Scheduling delays can, as ever, cause the execution of the process to
|
||||||
|
|
|
@ -131,7 +131,7 @@ The system calls are gone.
|
||||||
Now the hugetlbfs filesystem can be used instead.
|
Now the hugetlbfs filesystem can be used instead.
|
||||||
Memory backed by huge pages (if the CPU supports them) is obtained by
|
Memory backed by huge pages (if the CPU supports them) is obtained by
|
||||||
using
|
using
|
||||||
.BR mmap ()
|
.BR mmap (2)
|
||||||
to map files in this virtual filesystem.
|
to map files in this virtual filesystem.
|
||||||
.LP
|
.LP
|
||||||
The maximal number of huge pages can be specified using the
|
The maximal number of huge pages can be specified using the
|
||||||
|
|
|
@ -103,7 +103,8 @@ Caller does not have the
|
||||||
.B CAP_SYS_ADMIN
|
.B CAP_SYS_ADMIN
|
||||||
capability.
|
capability.
|
||||||
.SH "CONFORMING TO"
|
.SH "CONFORMING TO"
|
||||||
\fBbdflush\fP() is Linux specific and should not be used in programs
|
.BR bdflush ()
|
||||||
|
is Linux specific and should not be used in programs
|
||||||
intended to be portable.
|
intended to be portable.
|
||||||
.SH "SEE ALSO"
|
.SH "SEE ALSO"
|
||||||
.BR fsync (2),
|
.BR fsync (2),
|
||||||
|
|
|
@ -568,8 +568,8 @@ was specified, and
|
||||||
which points to the location (in child memory) where the child thread ID
|
which points to the location (in child memory) where the child thread ID
|
||||||
will be written in case CLONE_CHILD_SETTID was specified.
|
will be written in case CLONE_CHILD_SETTID was specified.
|
||||||
.SH "RETURN VALUE"
|
.SH "RETURN VALUE"
|
||||||
.\" gettid() returns current->pid;
|
.\" gettid(2) returns current->pid;
|
||||||
.\" getpid() returns current->tgid;
|
.\" getpid(2) returns current->tgid;
|
||||||
On success, the thread ID of the child process is returned
|
On success, the thread ID of the child process is returned
|
||||||
in the caller's thread of execution.
|
in the caller's thread of execution.
|
||||||
On failure, a \-1 will be returned
|
On failure, a \-1 will be returned
|
||||||
|
@ -689,10 +689,10 @@ intended to be portable.
|
||||||
.SH BUGS
|
.SH BUGS
|
||||||
Versions of the GNU C library that include the NPTL threading library
|
Versions of the GNU C library that include the NPTL threading library
|
||||||
contain a wrapper function for
|
contain a wrapper function for
|
||||||
.BR getpid ()
|
.BR getpid (2)
|
||||||
that performs caching of PIDs.
|
that performs caching of PIDs.
|
||||||
In programs linked against such libraries, calls to
|
In programs linked against such libraries, calls to
|
||||||
.BR getpid ()
|
.BR getpid (2)
|
||||||
may return the same value, even when the threads were not created using
|
may return the same value, even when the threads were not created using
|
||||||
.B CLONE_THREAD
|
.B CLONE_THREAD
|
||||||
(and thus are not in the same thread group).
|
(and thus are not in the same thread group).
|
||||||
|
|
|
@ -88,7 +88,7 @@ is out of the allowed range for file descriptors.
|
||||||
(Linux only) This may be returned by
|
(Linux only) This may be returned by
|
||||||
.BR dup2 ()
|
.BR dup2 ()
|
||||||
during a race condition with
|
during a race condition with
|
||||||
.BR open ()
|
.BR open (2)
|
||||||
and
|
and
|
||||||
.BR dup ().
|
.BR dup ().
|
||||||
.TP
|
.TP
|
||||||
|
@ -118,7 +118,7 @@ like
|
||||||
If
|
If
|
||||||
.I newfd
|
.I newfd
|
||||||
was open, any errors that would have been reported at
|
was open, any errors that would have been reported at
|
||||||
.BR close ()
|
.BR close (2)
|
||||||
time, are lost.
|
time, are lost.
|
||||||
A careful programmer will not use
|
A careful programmer will not use
|
||||||
.BR dup2 ()
|
.BR dup2 ()
|
||||||
|
|
|
@ -97,11 +97,11 @@ The relationship between
|
||||||
and
|
and
|
||||||
.BR epoll_pwait ()
|
.BR epoll_pwait ()
|
||||||
is analogous to the relationship between
|
is analogous to the relationship between
|
||||||
.BR select ()
|
.BR select (2)
|
||||||
and
|
and
|
||||||
.BR pselect ():
|
.BR pselect (2):
|
||||||
like
|
like
|
||||||
.BR pselect (),
|
.BR pselect (2),
|
||||||
.BR epoll_pwait ()
|
.BR epoll_pwait ()
|
||||||
allows an application to safely wait until either a file descriptor
|
allows an application to safely wait until either a file descriptor
|
||||||
becomes ready or until a signal is caught.
|
becomes ready or until a signal is caught.
|
||||||
|
|
|
@ -372,7 +372,8 @@ but is otherwise compatible.
|
||||||
.\" document ETXTBSY, EPERM, EFAULT, ELOOP, EIO, ENFILE, EMFILE, EINVAL,
|
.\" document ETXTBSY, EPERM, EFAULT, ELOOP, EIO, ENFILE, EMFILE, EINVAL,
|
||||||
.\" EISDIR or ELIBBAD error conditions.
|
.\" EISDIR or ELIBBAD error conditions.
|
||||||
.SH NOTES
|
.SH NOTES
|
||||||
Set-user-ID and set-group-ID processes can not be \fBptrace\fP()d.
|
Set-user-ID and set-group-ID processes can not be
|
||||||
|
.BR ptrace (2)d.
|
||||||
|
|
||||||
Linux ignores the set-user-ID and set-group-ID bits on scripts.
|
Linux ignores the set-user-ID and set-group-ID bits on scripts.
|
||||||
|
|
||||||
|
|
30
man2/fcntl.2
30
man2/fcntl.2
|
@ -116,9 +116,9 @@ and possibly modified by
|
||||||
.BR fcntl (2).
|
.BR fcntl (2).
|
||||||
Duplicated file descriptors
|
Duplicated file descriptors
|
||||||
(made with
|
(made with
|
||||||
.BR dup (),
|
.BR dup (2),
|
||||||
.BR fcntl (F_DUPFD),
|
.BR fcntl (F_DUPFD),
|
||||||
.BR fork (),
|
.BR fork (2),
|
||||||
etc.) refer to the same open file description, and thus
|
etc.) refer to the same open file description, and thus
|
||||||
share the same file status flags.
|
share the same file status flags.
|
||||||
.sp
|
.sp
|
||||||
|
@ -391,7 +391,7 @@ Most commonly, the calling process specifies itself as the owner
|
||||||
(that is,
|
(that is,
|
||||||
.I arg
|
.I arg
|
||||||
is specified as
|
is specified as
|
||||||
.BR getpid ()).
|
.BR getpid (2)).
|
||||||
|
|
||||||
.\" From glibc.info:
|
.\" From glibc.info:
|
||||||
If you set the
|
If you set the
|
||||||
|
@ -456,18 +456,18 @@ it is a thread ID identifying a specific thread within a process.
|
||||||
Consequently, it may be necessary to pass
|
Consequently, it may be necessary to pass
|
||||||
.B F_SETOWN
|
.B F_SETOWN
|
||||||
the result of
|
the result of
|
||||||
.BR gettid ()
|
.BR gettid (2)
|
||||||
instead of
|
instead of
|
||||||
.BR getpid ()
|
.BR getpid (2)
|
||||||
to get sensible results when
|
to get sensible results when
|
||||||
.B F_SETSIG
|
.B F_SETSIG
|
||||||
is used.
|
is used.
|
||||||
(In current Linux threading implementations,
|
(In current Linux threading implementations,
|
||||||
a main thread's thread ID is the same as its process ID.
|
a main thread's thread ID is the same as its process ID.
|
||||||
This means that a single-threaded program can equally use
|
This means that a single-threaded program can equally use
|
||||||
.BR gettid ()
|
.BR gettid (2)
|
||||||
or
|
or
|
||||||
.BR getpid ()
|
.BR getpid (2)
|
||||||
in this scenario.)
|
in this scenario.)
|
||||||
Note, however, that the statements in this paragraph do not apply
|
Note, however, that the statements in this paragraph do not apply
|
||||||
to the SIGURG signal generated for out-of-band data on a socket:
|
to the SIGURG signal generated for out-of-band data on a socket:
|
||||||
|
@ -625,9 +625,9 @@ read, a write, or no lease on the file.
|
||||||
is omitted.)
|
is omitted.)
|
||||||
.PP
|
.PP
|
||||||
When a process (the "lease breaker") performs an
|
When a process (the "lease breaker") performs an
|
||||||
.BR open ()
|
.BR open (2)
|
||||||
or
|
or
|
||||||
.BR truncate ()
|
.BR truncate (2)
|
||||||
that conflicts with a lease established via
|
that conflicts with a lease established via
|
||||||
.BR F_SETLEASE ,
|
.BR F_SETLEASE ,
|
||||||
the system call is blocked by the kernel and
|
the system call is blocked by the kernel and
|
||||||
|
@ -663,22 +663,22 @@ and assuming the lease breaker has not unblocked its system call,
|
||||||
the kernel permits the lease breaker's system call to proceed.
|
the kernel permits the lease breaker's system call to proceed.
|
||||||
|
|
||||||
If the lease breaker's blocked
|
If the lease breaker's blocked
|
||||||
.BR open ()
|
.BR open (2)
|
||||||
or
|
or
|
||||||
.BR truncate ()
|
.BR truncate (2)
|
||||||
is interrupted by a signal handler,
|
is interrupted by a signal handler,
|
||||||
then the system call fails with the error
|
then the system call fails with the error
|
||||||
.BR EINTR ,
|
.BR EINTR ,
|
||||||
but the other steps still occur as described above.
|
but the other steps still occur as described above.
|
||||||
If the lease breaker is killed by a signal while blocked in
|
If the lease breaker is killed by a signal while blocked in
|
||||||
.BR open ()
|
.BR open (2)
|
||||||
or
|
or
|
||||||
.BR truncate (),
|
.BR truncate (2),
|
||||||
then the other steps still occur as described above.
|
then the other steps still occur as described above.
|
||||||
If the lease breaker specifies the
|
If the lease breaker specifies the
|
||||||
.B O_NONBLOCK
|
.B O_NONBLOCK
|
||||||
flag when calling
|
flag when calling
|
||||||
.BR open (),
|
.BR open (2),
|
||||||
then the call immediately fails with the error
|
then the call immediately fails with the error
|
||||||
.BR EWOULDBLOCK ,
|
.BR EWOULDBLOCK ,
|
||||||
but the other steps still occur as described above.
|
but the other steps still occur as described above.
|
||||||
|
@ -866,7 +866,7 @@ Attempted to clear the
|
||||||
flag on a file that has the append-only attribute set.
|
flag on a file that has the append-only attribute set.
|
||||||
.SH NOTES
|
.SH NOTES
|
||||||
The errors returned by
|
The errors returned by
|
||||||
.BR dup2 ()
|
.BR dup2 (2)
|
||||||
are different from those returned by
|
are different from those returned by
|
||||||
.BR F_DUPFD .
|
.BR F_DUPFD .
|
||||||
|
|
||||||
|
|
|
@ -40,16 +40,16 @@ fdatasync \- synchronize a file's in-core data with that on disk
|
||||||
flushes all data buffers of a file to disk (before the system
|
flushes all data buffers of a file to disk (before the system
|
||||||
call returns).
|
call returns).
|
||||||
It resembles
|
It resembles
|
||||||
.BR fsync ()
|
.BR fsync (2)
|
||||||
but is not required to update the metadata such as access time.
|
but is not required to update the metadata such as access time.
|
||||||
|
|
||||||
Applications that access databases or log files often write a tiny
|
Applications that access databases or log files often write a tiny
|
||||||
data fragment (e.g., one line in a log file) and then call
|
data fragment (e.g., one line in a log file) and then call
|
||||||
.BR fsync ()
|
.BR fsync (2)
|
||||||
immediately in order to ensure that the written data is physically
|
immediately in order to ensure that the written data is physically
|
||||||
stored on the harddisk.
|
stored on the harddisk.
|
||||||
Unfortunately,
|
Unfortunately,
|
||||||
.BR fsync ()
|
.BR fsync (2)
|
||||||
will always initiate two write operations: one for the newly written
|
will always initiate two write operations: one for the newly written
|
||||||
data and another one in order to update the modification time stored
|
data and another one in order to update the modification time stored
|
||||||
in the inode.
|
in the inode.
|
||||||
|
@ -78,7 +78,7 @@ is bound to a special file which does not support synchronization.
|
||||||
Currently (Linux 2.2)
|
Currently (Linux 2.2)
|
||||||
.BR fdatasync ()
|
.BR fdatasync ()
|
||||||
is equivalent to
|
is equivalent to
|
||||||
.BR fsync ().
|
.BR fsync (2).
|
||||||
.SH AVAILABILITY
|
.SH AVAILABILITY
|
||||||
On POSIX systems on which
|
On POSIX systems on which
|
||||||
.BR fdatasync ()
|
.BR fdatasync ()
|
||||||
|
|
|
@ -178,7 +178,7 @@ locks have different semantics with respect to forked processes and
|
||||||
On systems that implement
|
On systems that implement
|
||||||
.BR flock ()
|
.BR flock ()
|
||||||
using
|
using
|
||||||
.BR fcntl (),
|
.BR fcntl (2),
|
||||||
the semantics of
|
the semantics of
|
||||||
.BR flock ()
|
.BR flock ()
|
||||||
will be different from those described in this manual page.
|
will be different from those described in this manual page.
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
.\"
|
.\"
|
||||||
.TH FUTIMESAT 2 2006-05-05 "Linux 2.6.16" "Linux Programmer's Manual"
|
.TH FUTIMESAT 2 2006-05-05 "Linux 2.6.16" "Linux Programmer's Manual"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
futimes \- change timestamps of a file relative to a \
|
futimesat \- change timestamps of a file relative to a \
|
||||||
directory file descriptor
|
directory file descriptor
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
.nf
|
.nf
|
||||||
|
@ -101,7 +101,7 @@ A similar system call exists on Solaris.
|
||||||
If
|
If
|
||||||
.I pathname
|
.I pathname
|
||||||
is NULL, then the glibc
|
is NULL, then the glibc
|
||||||
.BR futimes ()
|
.BR futimesat ()
|
||||||
wrapper function updates the times for the file referred to by
|
wrapper function updates the times for the file referred to by
|
||||||
.IR dirfd .
|
.IR dirfd .
|
||||||
.\" The Solaris futimesat() also has this strangeness.
|
.\" The Solaris futimesat() also has this strangeness.
|
||||||
|
|
|
@ -34,8 +34,8 @@ In a System V-like environment, one has the two types
|
||||||
\fImcontext_t\fP and \fIucontext_t\fP defined in
|
\fImcontext_t\fP and \fIucontext_t\fP defined in
|
||||||
.I <ucontext.h>
|
.I <ucontext.h>
|
||||||
and the four functions
|
and the four functions
|
||||||
\fBgetcontext\fP(), \fBsetcontext\fP(), \fBmakecontext\fP()
|
\fBgetcontext\fP(), \fBsetcontext\fP(), \fBmakecontext\fP(3)
|
||||||
and \fBswapcontext\fP()
|
and \fBswapcontext\fP(3)
|
||||||
that allow user-level context switching between multiple
|
that allow user-level context switching between multiple
|
||||||
threads of control within a process.
|
threads of control within a process.
|
||||||
.LP
|
.LP
|
||||||
|
@ -59,7 +59,7 @@ with \fIsigset_t\fP and \fIstack_t\fP defined in
|
||||||
.IR <signal.h> .
|
.IR <signal.h> .
|
||||||
Here \fIuc_link\fP points to the context that will be resumed
|
Here \fIuc_link\fP points to the context that will be resumed
|
||||||
when the current context terminates (in case the current context
|
when the current context terminates (in case the current context
|
||||||
was created using \fBmakecontext\fP()), \fIuc_sigmask\fP is the
|
was created using \fBmakecontext\fP(3)), \fIuc_sigmask\fP is the
|
||||||
set of signals blocked in this context (see
|
set of signals blocked in this context (see
|
||||||
.BR sigprocmask (2)),
|
.BR sigprocmask (2)),
|
||||||
\fIuc_stack\fP is the stack used by this context (see
|
\fIuc_stack\fP is the stack used by this context (see
|
||||||
|
@ -75,18 +75,18 @@ The function \fBsetcontext\fP() restores the user context
|
||||||
pointed at by \fIucp\fP.
|
pointed at by \fIucp\fP.
|
||||||
A successful call does not return.
|
A successful call does not return.
|
||||||
The context should have been obtained by a call of \fBgetcontext\fP(),
|
The context should have been obtained by a call of \fBgetcontext\fP(),
|
||||||
or \fBmakecontext\fP(), or passed as third argument to a signal
|
or \fBmakecontext\fP(3), or passed as third argument to a signal
|
||||||
handler.
|
handler.
|
||||||
.LP
|
.LP
|
||||||
If the context was obtained by a call of \fBgetcontext\fP(),
|
If the context was obtained by a call of \fBgetcontext\fP(),
|
||||||
program execution continues as if this call just returned.
|
program execution continues as if this call just returned.
|
||||||
.LP
|
.LP
|
||||||
If the context was obtained by a call of \fBmakecontext\fP(),
|
If the context was obtained by a call of \fBmakecontext\fP(3),
|
||||||
program execution continues by a call to the function \fIfunc\fP
|
program execution continues by a call to the function \fIfunc\fP
|
||||||
specified as the second argument of that call to \fBmakecontext\fP().
|
specified as the second argument of that call to \fBmakecontext\fP(3).
|
||||||
When the function \fIfunc\fP returns, we continue with the
|
When the function \fIfunc\fP returns, we continue with the
|
||||||
\fIuc_link\fP member of the structure \fIucp\fP specified as the
|
\fIuc_link\fP member of the structure \fIucp\fP specified as the
|
||||||
first argument of that call to \fBmakecontext\fP().
|
first argument of that call to \fBmakecontext\fP(3).
|
||||||
When this member is NULL, the thread exits.
|
When this member is NULL, the thread exits.
|
||||||
.LP
|
.LP
|
||||||
If the context was obtained by a call to a signal handler,
|
If the context was obtained by a call to a signal handler,
|
||||||
|
@ -104,10 +104,10 @@ appropriately.
|
||||||
None defined.
|
None defined.
|
||||||
.SH NOTES
|
.SH NOTES
|
||||||
The earliest incarnation of this mechanism was the
|
The earliest incarnation of this mechanism was the
|
||||||
\fIsetjmp\fP()/\fIlongjmp\fP() mechanism.
|
\fIsetjmp\fP(3)/\fIlongjmp\fP(3) mechanism.
|
||||||
Since that does not define
|
Since that does not define
|
||||||
the handling of the signal context, the next stage was the
|
the handling of the signal context, the next stage was the
|
||||||
\fIsigsetjmp\fP()/\fIsiglongjmp\fP() pair.
|
\fIsigsetjmp\fP(3)/\fIsiglongjmp\fP(3) pair.
|
||||||
The present mechanism gives much more control.
|
The present mechanism gives much more control.
|
||||||
On the other hand,
|
On the other hand,
|
||||||
there is no easy way to detect whether a return from \fBgetcontext\fP()
|
there is no easy way to detect whether a return from \fBgetcontext\fP()
|
||||||
|
@ -117,9 +117,9 @@ variable won't do since registers are restored.
|
||||||
.LP
|
.LP
|
||||||
When a signal occurs, the current user context is saved and
|
When a signal occurs, the current user context is saved and
|
||||||
a new context is created by the kernel for the signal handler.
|
a new context is created by the kernel for the signal handler.
|
||||||
Do not leave the handler using \fIlongjmp\fP(): it is undefined
|
Do not leave the handler using \fIlongjmp\fP(3): it is undefined
|
||||||
what would happen with contexts.
|
what would happen with contexts.
|
||||||
Use \fIsiglongjmp\fP() or
|
Use \fIsiglongjmp\fP(3) or
|
||||||
\fIsetcontext\fP() instead.
|
\fIsetcontext\fP() instead.
|
||||||
.SH "CONFORMING TO"
|
.SH "CONFORMING TO"
|
||||||
SUSv2, POSIX.1-2001.
|
SUSv2, POSIX.1-2001.
|
||||||
|
|
|
@ -36,7 +36,7 @@ used where it says in the description of
|
||||||
that files are mapped in page-sized units.
|
that files are mapped in page-sized units.
|
||||||
|
|
||||||
The size of the kind of pages that
|
The size of the kind of pages that
|
||||||
.BR mmap ()
|
.BR mmap (2)
|
||||||
uses, is found using
|
uses, is found using
|
||||||
|
|
||||||
.RS
|
.RS
|
||||||
|
|
|
@ -163,9 +163,9 @@ perform an orderly termination upon first receipt of
|
||||||
The maximum size of the process's data segment (initialized data,
|
The maximum size of the process's data segment (initialized data,
|
||||||
uninitialized data, and heap).
|
uninitialized data, and heap).
|
||||||
This limit affects calls to
|
This limit affects calls to
|
||||||
.BR brk ()
|
.BR brk (2)
|
||||||
and
|
and
|
||||||
.BR sbrk (),
|
.BR sbrk (2),
|
||||||
which fail with the error
|
which fail with the error
|
||||||
.B ENOMEM
|
.B ENOMEM
|
||||||
upon encountering the soft limit of this resource.
|
upon encountering the soft limit of this resource.
|
||||||
|
@ -177,17 +177,17 @@ Attempts to extend a file beyond this limit result in delivery of a
|
||||||
signal.
|
signal.
|
||||||
By default, this signal terminates a process, but a process can
|
By default, this signal terminates a process, but a process can
|
||||||
catch this signal instead, in which case the relevant system call (e.g.,
|
catch this signal instead, in which case the relevant system call (e.g.,
|
||||||
.BR write ()
|
.BR write (2)
|
||||||
.BR truncate ())
|
.BR truncate (2))
|
||||||
fails with the error
|
fails with the error
|
||||||
.BR EFBIG .
|
.BR EFBIG .
|
||||||
.TP
|
.TP
|
||||||
.BR RLIMIT_LOCKS " (Early Linux 2.4 only)"
|
.BR RLIMIT_LOCKS " (Early Linux 2.4 only)"
|
||||||
.\" to be precise: Linux 2.4.0-test9; no longer in 2.4.25 / 2.5.65
|
.\" to be precise: Linux 2.4.0-test9; no longer in 2.4.25 / 2.5.65
|
||||||
A limit on the combined number of
|
A limit on the combined number of
|
||||||
.BR flock ()
|
.BR flock (2)
|
||||||
locks and
|
locks and
|
||||||
.BR fcntl ()
|
.BR fcntl (2)
|
||||||
leases that this process may establish.
|
leases that this process may establish.
|
||||||
.TP
|
.TP
|
||||||
.B RLIMIT_MEMLOCK
|
.B RLIMIT_MEMLOCK
|
||||||
|
@ -246,7 +246,7 @@ where
|
||||||
is the
|
is the
|
||||||
.I mq_attr
|
.I mq_attr
|
||||||
structure specified as the fourth argument to
|
structure specified as the fourth argument to
|
||||||
.BR mq_open ().
|
.BR mq_open (3).
|
||||||
|
|
||||||
The first addend in the formula, which includes
|
The first addend in the formula, which includes
|
||||||
.I "sizeof(struct msg_msg *)"
|
.I "sizeof(struct msg_msg *)"
|
||||||
|
@ -269,9 +269,9 @@ For example, RLIM_INFINITY typically is the same as \-1.)
|
||||||
Specifies a value one greater than the maximum file descriptor number
|
Specifies a value one greater than the maximum file descriptor number
|
||||||
that can be opened by this process.
|
that can be opened by this process.
|
||||||
Attempts
|
Attempts
|
||||||
.RB ( open (),
|
.RB ( open (2),
|
||||||
.BR pipe (),
|
.BR pipe (2),
|
||||||
.BR dup (),
|
.BR dup (2),
|
||||||
etc.)
|
etc.)
|
||||||
to exceed this limit yield the error
|
to exceed this limit yield the error
|
||||||
.BR EMFILE .
|
.BR EMFILE .
|
||||||
|
@ -280,7 +280,7 @@ to exceed this limit yield the error
|
||||||
The maximum number of processes (or, more precisely on Linux, threads)
|
The maximum number of processes (or, more precisely on Linux, threads)
|
||||||
that can be created for the real user ID of the calling process.
|
that can be created for the real user ID of the calling process.
|
||||||
Upon encountering this limit,
|
Upon encountering this limit,
|
||||||
.BR fork ()
|
.BR fork (2)
|
||||||
fails with the error
|
fails with the error
|
||||||
.BR EAGAIN .
|
.BR EAGAIN .
|
||||||
.TP
|
.TP
|
||||||
|
@ -289,7 +289,7 @@ Specifies the limit (in pages) of the process's resident set
|
||||||
(the number of virtual pages resident in RAM).
|
(the number of virtual pages resident in RAM).
|
||||||
This limit only has effect in Linux 2.4.x, x < 30, and there only
|
This limit only has effect in Linux 2.4.x, x < 30, and there only
|
||||||
affects calls to
|
affects calls to
|
||||||
.BR madvise ()
|
.BR madvise (2)
|
||||||
specifying
|
specifying
|
||||||
.BR MADV_WILLNEED .
|
.BR MADV_WILLNEED .
|
||||||
.\" As at kernel 2.6.12, this limit still does nothing in 2.6 though
|
.\" As at kernel 2.6.12, this limit still does nothing in 2.6 though
|
||||||
|
|
|
@ -144,7 +144,7 @@ For the error codes, see
|
||||||
.BR errno (3).
|
.BR errno (3).
|
||||||
.sp
|
.sp
|
||||||
Some system calls, such as
|
Some system calls, such as
|
||||||
.BR mmap (),
|
.BR mmap (2),
|
||||||
require more than five arguments.
|
require more than five arguments.
|
||||||
These are handled by pushing the
|
These are handled by pushing the
|
||||||
arguments on the stack and passing a pointer to the block of arguments.
|
arguments on the stack and passing a pointer to the block of arguments.
|
||||||
|
|
|
@ -52,12 +52,12 @@ If \fBturn_on\fP is non-zero, the calling process must be privileged
|
||||||
|
|
||||||
Only the first 0x3ff I/O ports can be specified in this manner.
|
Only the first 0x3ff I/O ports can be specified in this manner.
|
||||||
For more ports, the
|
For more ports, the
|
||||||
.BR iopl ()
|
.BR iopl (2)
|
||||||
function must be used.
|
system call must be used.
|
||||||
Permissions are not inherited on
|
Permissions are not inherited on
|
||||||
.BR fork (),
|
.BR fork (2),
|
||||||
but on
|
but on
|
||||||
.BR exec ()
|
.BR execve (2)
|
||||||
they are.
|
they are.
|
||||||
This is useful for giving port access permissions to non-privileged tasks.
|
This is useful for giving port access permissions to non-privileged tasks.
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,7 @@ changes the I/O privilege level of the current process, as specified in
|
||||||
This call is necessary to allow 8514-compatible X servers to run under
|
This call is necessary to allow 8514-compatible X servers to run under
|
||||||
Linux.
|
Linux.
|
||||||
Since these X servers require access to all 65536 I/O ports, the
|
Since these X servers require access to all 65536 I/O ports, the
|
||||||
.BR ioperm ()
|
.BR ioperm (2)
|
||||||
call is not sufficient.
|
call is not sufficient.
|
||||||
|
|
||||||
In addition to granting unrestricted I/O port access, running at a higher
|
In addition to granting unrestricted I/O port access, running at a higher
|
||||||
|
@ -53,9 +53,9 @@ I/O privilege level also allows the process to disable interrupts.
|
||||||
This will probably crash the system, and is not recommended.
|
This will probably crash the system, and is not recommended.
|
||||||
|
|
||||||
Permissions are inherited by
|
Permissions are inherited by
|
||||||
.BR fork ()
|
.BR fork (2)
|
||||||
and
|
and
|
||||||
.BR exec ().
|
.BR execve (2).
|
||||||
|
|
||||||
The I/O privilege level for a normal process is 0.
|
The I/O privilege level for a normal process is 0.
|
||||||
|
|
||||||
|
|
|
@ -99,7 +99,7 @@ to any of the target processes.
|
||||||
The pid or process group does not exist.
|
The pid or process group does not exist.
|
||||||
Note that an existing process might be a zombie,
|
Note that an existing process might be a zombie,
|
||||||
a process which already committed termination, but
|
a process which already committed termination, but
|
||||||
has not yet been \fBwait\fP()ed for.
|
has not yet been \fBwait\fP(2)ed for.
|
||||||
.SH NOTES
|
.SH NOTES
|
||||||
The only signals that can be sent process ID 1, the
|
The only signals that can be sent process ID 1, the
|
||||||
.I init
|
.I init
|
||||||
|
@ -118,7 +118,7 @@ Linux allows a process to signal itself, but on Linux the call
|
||||||
POSIX.1-2001 requires that if a process sends a signal to itself,
|
POSIX.1-2001 requires that if a process sends a signal to itself,
|
||||||
and the sending thread does not have the signal blocked,
|
and the sending thread does not have the signal blocked,
|
||||||
and no other thread
|
and no other thread
|
||||||
has it unblocked or is waiting for it in \fIsigwait\fP(), at least one
|
has it unblocked or is waiting for it in \fIsigwait\fP(3), at least one
|
||||||
unblocked signal must be delivered to the sending thread before the
|
unblocked signal must be delivered to the sending thread before the
|
||||||
\fIkill\fP().
|
\fIkill\fP().
|
||||||
.SH BUGS
|
.SH BUGS
|
||||||
|
|
|
@ -96,9 +96,8 @@ have a process group.
|
||||||
.SH NOTES
|
.SH NOTES
|
||||||
There are various differences between the permission checking
|
There are various differences between the permission checking
|
||||||
in BSD-type systems and System V-type systems.
|
in BSD-type systems and System V-type systems.
|
||||||
See the POSIX rationale
|
See the POSIX rationale for
|
||||||
for
|
.BR kill (2).
|
||||||
.BR kill ().
|
|
||||||
A difference not mentioned by POSIX concerns the return
|
A difference not mentioned by POSIX concerns the return
|
||||||
value EPERM: BSD documents that no signal is sent and EPERM returned
|
value EPERM: BSD documents that no signal is sent and EPERM returned
|
||||||
when the permission check failed for at least one target process,
|
when the permission check failed for at least one target process,
|
||||||
|
|
|
@ -130,7 +130,7 @@ Hard links, as created by
|
||||||
.BR link (),
|
.BR link (),
|
||||||
cannot span filesystems.
|
cannot span filesystems.
|
||||||
Use
|
Use
|
||||||
.BR symlink ()
|
.BR symlink (2)
|
||||||
if this is required.
|
if this is required.
|
||||||
|
|
||||||
POSIX.1-2001 says that
|
POSIX.1-2001 says that
|
||||||
|
|
|
@ -80,7 +80,7 @@ Do not expect access in the near future.
|
||||||
so the kernel can free resources associated with it.)
|
so the kernel can free resources associated with it.)
|
||||||
Subsequent accesses of pages in this range will succeed, but will result
|
Subsequent accesses of pages in this range will succeed, but will result
|
||||||
either in re-loading of the memory contents from the underlying mapped file
|
either in re-loading of the memory contents from the underlying mapped file
|
||||||
(see \fBmmap\fP()) or zero-fill-on-demand pages for mappings
|
(see \fBmmap\fP(2)) or zero-fill-on-demand pages for mappings
|
||||||
without an underlying file.
|
without an underlying file.
|
||||||
.TP
|
.TP
|
||||||
.BR MADV_REMOVE " (Since Linux 2.6.16)"
|
.BR MADV_REMOVE " (Since Linux 2.6.16)"
|
||||||
|
@ -190,11 +190,11 @@ function first appeared in 4.4BSD.
|
||||||
.SH "CONFORMING TO"
|
.SH "CONFORMING TO"
|
||||||
POSIX.1b.
|
POSIX.1b.
|
||||||
POSIX.1-2001 describes
|
POSIX.1-2001 describes
|
||||||
.BR posix_madvise ()
|
.BR posix_madvise (3)
|
||||||
with constants POSIX_MADV_NORMAL, etc.,
|
with constants POSIX_MADV_NORMAL, etc.,
|
||||||
with a behaviour close to that described here.
|
with a behaviour close to that described here.
|
||||||
There is a similar
|
There is a similar
|
||||||
.BR posix_fadvise ()
|
.BR posix_fadvise (3)
|
||||||
for file access.
|
for file access.
|
||||||
|
|
||||||
.BR MADV_REMOVE ,
|
.BR MADV_REMOVE ,
|
||||||
|
|
|
@ -206,7 +206,7 @@ and
|
||||||
.BR set_mempolicy (2).
|
.BR set_mempolicy (2).
|
||||||
To select "allocation on the node of the CPU that
|
To select "allocation on the node of the CPU that
|
||||||
triggered the allocation" (like
|
triggered the allocation" (like
|
||||||
.BR set_mempolicy ()
|
.BR set_mempolicy (2)
|
||||||
.BR MPOL_DEFAULT )
|
.BR MPOL_DEFAULT )
|
||||||
when calling
|
when calling
|
||||||
.BR mbind (),
|
.BR mbind (),
|
||||||
|
@ -219,9 +219,9 @@ with an empty
|
||||||
.SH "VERSIONS AND LIBRARY SUPPORT"
|
.SH "VERSIONS AND LIBRARY SUPPORT"
|
||||||
The
|
The
|
||||||
.BR mbind (),
|
.BR mbind (),
|
||||||
.BR get_mempolicy (),
|
.BR get_mempolicy (2),
|
||||||
and
|
and
|
||||||
.BR set_mempolicy ()
|
.BR set_mempolicy (2)
|
||||||
system calls were added to the Linux kernel with version 2.6.7.
|
system calls were added to the Linux kernel with version 2.6.7.
|
||||||
They are only available on kernels compiled with
|
They are only available on kernels compiled with
|
||||||
.BR CONFIG_NUMA .
|
.BR CONFIG_NUMA .
|
||||||
|
|
|
@ -216,7 +216,7 @@ should extend downwards in memory.
|
||||||
.TP
|
.TP
|
||||||
.BR MAP_LOCKED " (since Linux 2.5.37)"
|
.BR MAP_LOCKED " (since Linux 2.5.37)"
|
||||||
Lock the pages of the mapped region into memory in the manner of
|
Lock the pages of the mapped region into memory in the manner of
|
||||||
.BR mlock () .
|
.BR mlock (2) .
|
||||||
This flag is ignored in older kernels.
|
This flag is ignored in older kernels.
|
||||||
.\" If set, the mapped pages will not be swapped out.
|
.\" If set, the mapped pages will not be swapped out.
|
||||||
.TP
|
.TP
|
||||||
|
@ -306,7 +306,7 @@ and
|
||||||
.B MAP_SHARED
|
.B MAP_SHARED
|
||||||
will be updated after
|
will be updated after
|
||||||
a write to the mapped region, and before a subsequent
|
a write to the mapped region, and before a subsequent
|
||||||
.BR msync ()
|
.BR msync (2)
|
||||||
with the
|
with the
|
||||||
.B MS_SYNC
|
.B MS_SYNC
|
||||||
or
|
or
|
||||||
|
@ -432,7 +432,7 @@ case where another process has truncated the file).
|
||||||
.SH AVAILABILITY
|
.SH AVAILABILITY
|
||||||
On POSIX systems on which
|
On POSIX systems on which
|
||||||
.BR mmap (),
|
.BR mmap (),
|
||||||
.BR msync ()
|
.BR msync (2)
|
||||||
and
|
and
|
||||||
.BR munmap ()
|
.BR munmap ()
|
||||||
are available,
|
are available,
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
.\"
|
.\"
|
||||||
.TH MOUNT 2 2004-05-18 "Linux 2.6.12" "Linux Programmer's Manual"
|
.TH MOUNT 2 2004-05-18 "Linux 2.6.12" "Linux Programmer's Manual"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
mount, umount \- mount and unmount filesystems
|
mount, umount, umount2 \- mount and unmount filesystems
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
.nf
|
.nf
|
||||||
.B "#include <sys/mount.h>"
|
.B "#include <sys/mount.h>"
|
||||||
|
|
|
@ -67,7 +67,7 @@ segments will also cause a segmentation violation.
|
||||||
\fBmremap\fR() uses the Linux page table scheme.
|
\fBmremap\fR() uses the Linux page table scheme.
|
||||||
\fBmremap\fR() changes the
|
\fBmremap\fR() changes the
|
||||||
mapping between virtual addresses and memory pages.
|
mapping between virtual addresses and memory pages.
|
||||||
This can be used to implement a very efficient \fBrealloc\fR().
|
This can be used to implement a very efficient \fBrealloc\fR(3).
|
||||||
|
|
||||||
The \fIflags\fR bit-mask argument may be 0, or include the following flag:
|
The \fIflags\fR bit-mask argument may be 0, or include the following flag:
|
||||||
.TP
|
.TP
|
||||||
|
@ -110,7 +110,7 @@ If the memory segment specified by
|
||||||
and
|
and
|
||||||
.I old_size
|
.I old_size
|
||||||
is locked (using
|
is locked (using
|
||||||
.BR mlock ()
|
.BR mlock (2)
|
||||||
or similar), then this lock is maintained when the segment is
|
or similar), then this lock is maintained when the segment is
|
||||||
resized and/or relocated.
|
resized and/or relocated.
|
||||||
As a consequence, the amount of memory locked by the process may change.
|
As a consequence, the amount of memory locked by the process may change.
|
||||||
|
|
|
@ -63,8 +63,8 @@ data structure is defined in <sys/msg.h> as follows:
|
||||||
|
|
||||||
struct msqid_ds {
|
struct msqid_ds {
|
||||||
struct ipc_perm msg_perm; /* Ownership and permissions */
|
struct ipc_perm msg_perm; /* Ownership and permissions */
|
||||||
time_t msg_stime; /* Time of last msgsnd() */
|
time_t msg_stime; /* Time of last msgsnd(2) */
|
||||||
time_t msg_rtime; /* Time of last msgrcv() */
|
time_t msg_rtime; /* Time of last msgrcv(2) */
|
||||||
time_t msg_ctime; /* Time of last change */
|
time_t msg_ctime; /* Time of last change */
|
||||||
unsigned long __msg_cbytes; /* Current number of bytes in
|
unsigned long __msg_cbytes; /* Current number of bytes in
|
||||||
queue (non-standard) */
|
queue (non-standard) */
|
||||||
|
@ -72,8 +72,8 @@ struct msqid_ds {
|
||||||
in queue */
|
in queue */
|
||||||
msglen_t msg_qbytes; /* Maximum number of bytes
|
msglen_t msg_qbytes; /* Maximum number of bytes
|
||||||
allowed in queue */
|
allowed in queue */
|
||||||
pid_t msg_lspid; /* PID of last msgsnd() */
|
pid_t msg_lspid; /* PID of last msgsnd(2) */
|
||||||
pid_t msg_lrpid; /* PID of last msgrcv() */
|
pid_t msg_lrpid; /* PID of last msgrcv(2) */
|
||||||
};
|
};
|
||||||
.in -4n
|
.in -4n
|
||||||
.fi
|
.fi
|
||||||
|
@ -87,7 +87,7 @@ structure is defined in <sys/ipc.h> as follows
|
||||||
.nf
|
.nf
|
||||||
.in +4n
|
.in +4n
|
||||||
struct ipc_perm {
|
struct ipc_perm {
|
||||||
key_t key; /* Key supplied to msgget() */
|
key_t key; /* Key supplied to msgget(2) */
|
||||||
uid_t \fBuid\fP; /* Effective UID of owner */
|
uid_t \fBuid\fP; /* Effective UID of owner */
|
||||||
gid_t \fBgid\fP; /* Effective GID of owner */
|
gid_t \fBgid\fP; /* Effective GID of owner */
|
||||||
uid_t cuid; /* Effective UID of creator */
|
uid_t cuid; /* Effective UID of creator */
|
||||||
|
@ -171,7 +171,7 @@ struct msginfo {
|
||||||
written in a single message */
|
written in a single message */
|
||||||
int msgmnb; /* Max. # of bytes that can be written to
|
int msgmnb; /* Max. # of bytes that can be written to
|
||||||
queue; used to initialize msg_qbytes
|
queue; used to initialize msg_qbytes
|
||||||
during queue creation (msgget()) */
|
during queue creation (msgget(2)) */
|
||||||
int msgmni; /* Max. # of message queues */
|
int msgmni; /* Max. # of message queues */
|
||||||
int msgssz; /* Message segment size; unused */
|
int msgssz; /* Message segment size; unused */
|
||||||
int msgtql; /* Max. # of messages on all queues
|
int msgtql; /* Max. # of messages on all queues
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
.\"
|
.\"
|
||||||
.TH MSGOP 2 2006-02-02 "Linux 2.6.15" "Linux Programmer's Manual"
|
.TH MSGOP 2 2006-02-02 "Linux 2.6.15" "Linux Programmer's Manual"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
msgop \- message operations
|
msgop, msgrcv, msgsnd \- message operations
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
.nf
|
.nf
|
||||||
.B #include <sys/types.h>
|
.B #include <sys/types.h>
|
||||||
|
@ -407,7 +407,7 @@ Default maximum size in bytes of a message queue: 16384 bytes
|
||||||
The superuser can increase the size of a message queue beyond
|
The superuser can increase the size of a message queue beyond
|
||||||
.B MSGMNB
|
.B MSGMNB
|
||||||
by a
|
by a
|
||||||
.BR msgctl ()
|
.BR msgctl (2)
|
||||||
system call.
|
system call.
|
||||||
.PP
|
.PP
|
||||||
The implementation has no intrinsic limits for the system wide maximum
|
The implementation has no intrinsic limits for the system wide maximum
|
||||||
|
|
12
man2/open.2
12
man2/open.2
|
@ -77,7 +77,7 @@ creates a new
|
||||||
an entry in the system-wide table of open files.
|
an entry in the system-wide table of open files.
|
||||||
This entry records the file offset and the file status flags
|
This entry records the file offset and the file status flags
|
||||||
(modifiable via the
|
(modifiable via the
|
||||||
.BR fcntl ()
|
.BR fcntl (2)
|
||||||
.B F_SETFL
|
.B F_SETFL
|
||||||
operation).
|
operation).
|
||||||
A file descriptor is a reference to one of these entries;
|
A file descriptor is a reference to one of these entries;
|
||||||
|
@ -118,10 +118,10 @@ The full list of file creation flags and file status flags is as follows:
|
||||||
.B O_APPEND
|
.B O_APPEND
|
||||||
The file is opened in append mode.
|
The file is opened in append mode.
|
||||||
Before each
|
Before each
|
||||||
.BR write (),
|
.BR write (2),
|
||||||
the file offset is positioned at the end of the file,
|
the file offset is positioned at the end of the file,
|
||||||
as if with
|
as if with
|
||||||
.BR lseek ().
|
.BR lseek (2).
|
||||||
.B O_APPEND
|
.B O_APPEND
|
||||||
may lead to corrupted files on NFS file systems if more than one process
|
may lead to corrupted files on NFS file systems if more than one process
|
||||||
appends data to a file at once.
|
appends data to a file at once.
|
||||||
|
@ -203,7 +203,7 @@ atomic file locking using a lockfile is to create a unique file on
|
||||||
the same file system (e.g., incorporating hostname and pid), use
|
the same file system (e.g., incorporating hostname and pid), use
|
||||||
.BR link (2)
|
.BR link (2)
|
||||||
to make a link to the lockfile.
|
to make a link to the lockfile.
|
||||||
If \fBlink\fP() returns 0, the lock is
|
If \fBlink\fP(2) returns 0, the lock is
|
||||||
successful.
|
successful.
|
||||||
Otherwise, use
|
Otherwise, use
|
||||||
.BR stat (2)
|
.BR stat (2)
|
||||||
|
@ -273,7 +273,7 @@ in conjunction with mandatory file locks and with file leases, see
|
||||||
.B O_SYNC
|
.B O_SYNC
|
||||||
The file is opened for synchronous I/O.
|
The file is opened for synchronous I/O.
|
||||||
Any
|
Any
|
||||||
.BR write ()s
|
.BR write (2)s
|
||||||
on the resulting file descriptor will block the calling process until
|
on the resulting file descriptor will block the calling process until
|
||||||
the data has been physically written to the underlying hardware.
|
the data has been physically written to the underlying hardware.
|
||||||
.IR "But see RESTRICTIONS below" .
|
.IR "But see RESTRICTIONS below" .
|
||||||
|
@ -286,7 +286,7 @@ flag is ignored.
|
||||||
Otherwise the effect of O_TRUNC is unspecified.
|
Otherwise the effect of O_TRUNC is unspecified.
|
||||||
.PP
|
.PP
|
||||||
Some of these optional flags can be altered using
|
Some of these optional flags can be altered using
|
||||||
.BR fcntl ()
|
.BR fcntl (2)
|
||||||
after the file has been opened.
|
after the file has been opened.
|
||||||
|
|
||||||
The argument
|
The argument
|
||||||
|
|
|
@ -106,9 +106,9 @@ occur when using
|
||||||
to open files in directories other than the current working directory.
|
to open files in directories other than the current working directory.
|
||||||
These race conditions result from the fact that some component
|
These race conditions result from the fact that some component
|
||||||
of the directory prefix given to
|
of the directory prefix given to
|
||||||
.BR open ()
|
.BR open (2)
|
||||||
could be changed in parallel with the call to
|
could be changed in parallel with the call to
|
||||||
.BR open ().
|
.BR open (2).
|
||||||
Such races can be avoided by
|
Such races can be avoided by
|
||||||
opening a file descriptor for the target directory,
|
opening a file descriptor for the target directory,
|
||||||
and then specifying that file descriptor as the
|
and then specifying that file descriptor as the
|
||||||
|
|
|
@ -176,11 +176,11 @@ The relationship between
|
||||||
and
|
and
|
||||||
.BR ppoll ()
|
.BR ppoll ()
|
||||||
is analogous to the relationship between
|
is analogous to the relationship between
|
||||||
.BR select ()
|
.BR select (2)
|
||||||
and
|
and
|
||||||
.BR pselect ():
|
.BR pselect (2):
|
||||||
like
|
like
|
||||||
.BR pselect (),
|
.BR pselect (2),
|
||||||
.BR ppoll ()
|
.BR ppoll ()
|
||||||
allows an application to safely wait until either a file descriptor
|
allows an application to safely wait until either a file descriptor
|
||||||
becomes ready or until a signal is caught.
|
becomes ready or until a signal is caught.
|
||||||
|
@ -294,7 +294,7 @@ system call was introduced in Linux 2.1.23.
|
||||||
The
|
The
|
||||||
.BR poll ()
|
.BR poll ()
|
||||||
library call was introduced in libc 5.4.28
|
library call was introduced in libc 5.4.28
|
||||||
(and provides emulation using select() if your kernel does not
|
(and provides emulation using select(2) if your kernel does not
|
||||||
have a
|
have a
|
||||||
.BR poll ()
|
.BR poll ()
|
||||||
system call).
|
system call).
|
||||||
|
|
|
@ -113,7 +113,7 @@ discarded instead.
|
||||||
|
|
||||||
Pages that have not yet been written out will be unaffected, so if the
|
Pages that have not yet been written out will be unaffected, so if the
|
||||||
application wishes to guarantee that pages will be released, it should
|
application wishes to guarantee that pages will be released, it should
|
||||||
call \fBfsync\fP() or \fBfdatasync\fP() first.
|
call \fBfsync\fP(2) or \fBfdatasync\fP(2) first.
|
||||||
.SH "CONFORMING TO"
|
.SH "CONFORMING TO"
|
||||||
POSIX.1-2001.
|
POSIX.1-2001.
|
||||||
Note that the type of the
|
Note that the type of the
|
||||||
|
|
|
@ -57,7 +57,7 @@ in the range 1..maxsig, or 0 to clear).
|
||||||
This is the signal that the calling process will get when its
|
This is the signal that the calling process will get when its
|
||||||
parent dies.
|
parent dies.
|
||||||
This value is cleared upon a
|
This value is cleared upon a
|
||||||
.BR fork ().
|
.BR fork (2).
|
||||||
.TP
|
.TP
|
||||||
.B PR_GET_PDEATHSIG
|
.B PR_GET_PDEATHSIG
|
||||||
(Since Linux 2.3.15)
|
(Since Linux 2.3.15)
|
||||||
|
|
|
@ -88,9 +88,9 @@ Indicates that this process is to be traced by its parent.
|
||||||
Any signal
|
Any signal
|
||||||
(except SIGKILL) delivered to this process will cause it to stop and its
|
(except SIGKILL) delivered to this process will cause it to stop and its
|
||||||
parent to be notified via
|
parent to be notified via
|
||||||
.BR wait ().
|
.BR wait (2).
|
||||||
Also, all subsequent calls to
|
Also, all subsequent calls to
|
||||||
.BR exec ()
|
.BR execve (2)
|
||||||
by this process will cause a SIGTRAP to be sent to it,
|
by this process will cause a SIGTRAP to be sent to it,
|
||||||
giving the parent a chance to gain control before the new program
|
giving the parent a chance to gain control before the new program
|
||||||
begins execution.
|
begins execution.
|
||||||
|
@ -197,7 +197,7 @@ between normal traps and those caused by a syscall.
|
||||||
.TP
|
.TP
|
||||||
PTRACE_O_TRACEFORK (since Linux 2.5.46)
|
PTRACE_O_TRACEFORK (since Linux 2.5.46)
|
||||||
Stop the child at the next
|
Stop the child at the next
|
||||||
.BR fork ()
|
.BR fork (2)
|
||||||
call with SIGTRAP | PTRACE_EVENT_FORK << 8 and automatically
|
call with SIGTRAP | PTRACE_EVENT_FORK << 8 and automatically
|
||||||
start tracing the newly forked process,
|
start tracing the newly forked process,
|
||||||
which will start with a SIGSTOP.
|
which will start with a SIGSTOP.
|
||||||
|
@ -205,36 +205,36 @@ The PID for the new process can be retrieved with PTRACE_GETEVENTMSG.
|
||||||
.TP
|
.TP
|
||||||
PTRACE_O_TRACEVFORK (since Linux 2.5.46)
|
PTRACE_O_TRACEVFORK (since Linux 2.5.46)
|
||||||
Stop the child at the next
|
Stop the child at the next
|
||||||
.BR vfork ()
|
.BR vfork (2)
|
||||||
call with SIGTRAP | PTRACE_EVENT_VFORK << 8 and automatically start
|
call with SIGTRAP | PTRACE_EVENT_VFORK << 8 and automatically start
|
||||||
tracing the newly vforked process, which will start with a SIGSTOP.
|
tracing the newly vforked process, which will start with a SIGSTOP.
|
||||||
The PID for the new process can be retrieved with PTRACE_GETEVENTMSG.
|
The PID for the new process can be retrieved with PTRACE_GETEVENTMSG.
|
||||||
.TP
|
.TP
|
||||||
PTRACE_O_TRACECLONE (since Linux 2.5.46)
|
PTRACE_O_TRACECLONE (since Linux 2.5.46)
|
||||||
Stop the child at the next
|
Stop the child at the next
|
||||||
.BR clone ()
|
.BR clone (2)
|
||||||
call with SIGTRAP | PTRACE_EVENT_CLONE << 8 and automatically start
|
call with SIGTRAP | PTRACE_EVENT_CLONE << 8 and automatically start
|
||||||
tracing the newly cloned process, which will start with a SIGSTOP.
|
tracing the newly cloned process, which will start with a SIGSTOP.
|
||||||
The PID for the new process can be retrieved with PTRACE_GETEVENTMSG.
|
The PID for the new process can be retrieved with PTRACE_GETEVENTMSG.
|
||||||
This option may not catch
|
This option may not catch
|
||||||
.BR clone ()
|
.BR clone (2)
|
||||||
calls in all cases.
|
calls in all cases.
|
||||||
If the child calls
|
If the child calls
|
||||||
.BR clone ()
|
.BR clone (2)
|
||||||
with the CLONE_VFORK flag, PTRACE_EVENT_VFORK will be delivered instead
|
with the CLONE_VFORK flag, PTRACE_EVENT_VFORK will be delivered instead
|
||||||
if PTRACE_O_TRACEVFORK is set; otherwise if the child calls
|
if PTRACE_O_TRACEVFORK is set; otherwise if the child calls
|
||||||
.BR clone ()
|
.BR clone (2)
|
||||||
with the exit signal set to SIGCHLD, PTRACE_EVENT_FORK will be delivered
|
with the exit signal set to SIGCHLD, PTRACE_EVENT_FORK will be delivered
|
||||||
if PTRACE_O_TRACEFORK is set.
|
if PTRACE_O_TRACEFORK is set.
|
||||||
.TP
|
.TP
|
||||||
PTRACE_O_TRACEEXEC (since Linux 2.5.46)
|
PTRACE_O_TRACEEXEC (since Linux 2.5.46)
|
||||||
Stop the child at the next
|
Stop the child at the next
|
||||||
.BR exec ()
|
.BR execve (2)
|
||||||
call with SIGTRAP | PTRACE_EVENT_EXEC << 8.
|
call with SIGTRAP | PTRACE_EVENT_EXEC << 8.
|
||||||
.TP
|
.TP
|
||||||
PTRACE_O_TRACEVFORKDONE (since Linux 2.5.60)
|
PTRACE_O_TRACEVFORKDONE (since Linux 2.5.60)
|
||||||
Stop the child at the completion of the next
|
Stop the child at the completion of the next
|
||||||
.BR vfork ()
|
.BR vfork (2)
|
||||||
call with SIGTRAP | PTRACE_EVENT_VFORK_DONE << 8.
|
call with SIGTRAP | PTRACE_EVENT_VFORK_DONE << 8.
|
||||||
.TP
|
.TP
|
||||||
PTRACE_O_TRACEEXIT (since Linux 2.5.60)
|
PTRACE_O_TRACEEXIT (since Linux 2.5.60)
|
||||||
|
@ -310,7 +310,7 @@ output as the child's parent), but a
|
||||||
by the child will still return the PID of the original parent.
|
by the child will still return the PID of the original parent.
|
||||||
The child is sent a SIGSTOP, but will not necessarily have stopped
|
The child is sent a SIGSTOP, but will not necessarily have stopped
|
||||||
by the completion of this call; use
|
by the completion of this call; use
|
||||||
.BR wait ()
|
.BR wait (2)
|
||||||
to wait for the child to stop.
|
to wait for the child to stop.
|
||||||
(\fIaddr\fP and \fIdata\fP are ignored.)
|
(\fIaddr\fP and \fIdata\fP are ignored.)
|
||||||
.TP
|
.TP
|
||||||
|
@ -347,7 +347,7 @@ Tracing causes a few subtle differences in the semantics of
|
||||||
traced processes.
|
traced processes.
|
||||||
For example, if a process is attached to with PTRACE_ATTACH,
|
For example, if a process is attached to with PTRACE_ATTACH,
|
||||||
its original parent can no longer receive notification via
|
its original parent can no longer receive notification via
|
||||||
.BR wait ()
|
.BR wait (2)
|
||||||
when it stops, and there is no way for the new parent to
|
when it stops, and there is no way for the new parent to
|
||||||
effectively simulate this notification.
|
effectively simulate this notification.
|
||||||
.LP
|
.LP
|
||||||
|
@ -357,7 +357,7 @@ This means the parent cannot do
|
||||||
.BR ptrace (PTRACE_CONT)
|
.BR ptrace (PTRACE_CONT)
|
||||||
with a signal or
|
with a signal or
|
||||||
.BR ptrace (PTRACE_KILL).
|
.BR ptrace (PTRACE_KILL).
|
||||||
.BR kill ()
|
.BR kill (2)
|
||||||
with a SIGKILL signal can be used instead to kill the child process
|
with a SIGKILL signal can be used instead to kill the child process
|
||||||
after receiving one of these messages.
|
after receiving one of these messages.
|
||||||
.LP
|
.LP
|
||||||
|
|
|
@ -178,7 +178,7 @@ the wrapper function allocates a temporary buffer large enough
|
||||||
for all of the items specified by
|
for all of the items specified by
|
||||||
.IR iov ,
|
.IR iov ,
|
||||||
passes that buffer in a call to
|
passes that buffer in a call to
|
||||||
.BR read (),
|
.BR read (2),
|
||||||
copies data from the buffer to the locations specified by the
|
copies data from the buffer to the locations specified by the
|
||||||
.I iov_base
|
.I iov_base
|
||||||
fields of the elements of
|
fields of the elements of
|
||||||
|
@ -187,7 +187,7 @@ and then frees the buffer.
|
||||||
The wrapper function for
|
The wrapper function for
|
||||||
.BR writev ()
|
.BR writev ()
|
||||||
performs the analogous task using a temporary buffer and a call to
|
performs the analogous task using a temporary buffer and a call to
|
||||||
.BR write ().
|
.BR write (2).
|
||||||
.SH BUGS
|
.SH BUGS
|
||||||
It is not advisable to mix calls to functions like
|
It is not advisable to mix calls to functions like
|
||||||
.BR readv ()
|
.BR readv ()
|
||||||
|
|
|
@ -48,7 +48,7 @@ To create a non-linear mapping we perform the following steps:
|
||||||
.TP
|
.TP
|
||||||
\fB1.\fP
|
\fB1.\fP
|
||||||
Use
|
Use
|
||||||
.BR mmap ()
|
.BR mmap (2)
|
||||||
to create a mapping (which is initially linear).
|
to create a mapping (which is initially linear).
|
||||||
This mapping must be created with the
|
This mapping must be created with the
|
||||||
.B MAP_SHARED
|
.B MAP_SHARED
|
||||||
|
@ -81,7 +81,7 @@ Thus,
|
||||||
.I start
|
.I start
|
||||||
must be an address that falls within
|
must be an address that falls within
|
||||||
a region previously mapped by a call to
|
a region previously mapped by a call to
|
||||||
.BR mmap ().
|
.BR mmap (2).
|
||||||
Second,
|
Second,
|
||||||
.I start
|
.I start
|
||||||
specifies the address at which the file pages
|
specifies the address at which the file pages
|
||||||
|
@ -112,7 +112,7 @@ argument must be specified as 0.
|
||||||
The
|
The
|
||||||
.I flags
|
.I flags
|
||||||
argument has the same meaning as for
|
argument has the same meaning as for
|
||||||
.BR mmap (),
|
.BR mmap (2),
|
||||||
but all flags other than
|
but all flags other than
|
||||||
.B MAP_NONBLOCK
|
.B MAP_NONBLOCK
|
||||||
are ignored.
|
are ignored.
|
||||||
|
|
|
@ -110,8 +110,8 @@ Processes scheduled with \fISCHED_OTHER\fP or \fISCHED_BATCH\fP
|
||||||
must be assigned the static priority 0.
|
must be assigned the static priority 0.
|
||||||
Processes scheduled under \fISCHED_FIFO\fP or
|
Processes scheduled under \fISCHED_FIFO\fP or
|
||||||
\fISCHED_RR\fP can have a static priority in the range 1 to 99.
|
\fISCHED_RR\fP can have a static priority in the range 1 to 99.
|
||||||
The system calls \fBsched_get_priority_min\fP() and
|
The system calls \fBsched_get_priority_min\fP(2) and
|
||||||
\fBsched_get_priority_max\fP() can be used to find out the valid
|
\fBsched_get_priority_max\fP(2) can be used to find out the valid
|
||||||
priority range for a scheduling policy in a portable way on all
|
priority range for a scheduling policy in a portable way on all
|
||||||
POSIX.1-2001 conforming systems.
|
POSIX.1-2001 conforming systems.
|
||||||
|
|
||||||
|
@ -137,7 +137,7 @@ blocked again.
|
||||||
When a \fISCHED_FIFO\fP process becomes runnable, it
|
When a \fISCHED_FIFO\fP process becomes runnable, it
|
||||||
will be inserted at the end of the list for its priority.
|
will be inserted at the end of the list for its priority.
|
||||||
A call to
|
A call to
|
||||||
\fBsched_setscheduler\fP() or \fBsched_setparam\fP() will put the
|
\fBsched_setscheduler\fP() or \fBsched_setparam\fP(2) will put the
|
||||||
\fISCHED_FIFO\fP (or \fISCHED_RR\fP) process identified by
|
\fISCHED_FIFO\fP (or \fISCHED_RR\fP) process identified by
|
||||||
\fIpid\fP at the start of the list if it was runnable.
|
\fIpid\fP at the start of the list if it was runnable.
|
||||||
As a consequence, it may preempt the currently running process if
|
As a consequence, it may preempt the currently running process if
|
||||||
|
@ -146,14 +146,14 @@ it has the same priority.
|
||||||
of the list.)
|
of the list.)
|
||||||
.\" In 2.2.x and 2.4.x, the process is placed at the front of the queue
|
.\" In 2.2.x and 2.4.x, the process is placed at the front of the queue
|
||||||
.\" In 2.0.x, the Right Thing happened: the process went to the back -- MTK
|
.\" In 2.0.x, the Right Thing happened: the process went to the back -- MTK
|
||||||
A process calling \fBsched_yield\fP() will be
|
A process calling \fBsched_yield\fP(2) will be
|
||||||
put at the end of the list.
|
put at the end of the list.
|
||||||
No other events will move a process
|
No other events will move a process
|
||||||
scheduled under the \fISCHED_FIFO\fP policy in the wait list of
|
scheduled under the \fISCHED_FIFO\fP policy in the wait list of
|
||||||
runnable processes with equal static priority.
|
runnable processes with equal static priority.
|
||||||
A \fISCHED_FIFO\fP
|
A \fISCHED_FIFO\fP
|
||||||
process runs until either it is blocked by an I/O request, it is
|
process runs until either it is blocked by an I/O request, it is
|
||||||
preempted by a higher priority process, or it calls \fBsched_yield\fP().
|
preempted by a higher priority process, or it calls \fBsched_yield\fP(2).
|
||||||
.SS SCHED_RR: Round Robin scheduling
|
.SS SCHED_RR: Round Robin scheduling
|
||||||
\fISCHED_RR\fP is a simple enhancement of \fISCHED_FIFO\fP.
|
\fISCHED_RR\fP is a simple enhancement of \fISCHED_FIFO\fP.
|
||||||
Everything
|
Everything
|
||||||
|
@ -265,15 +265,15 @@ interrupt handler.
|
||||||
.\" .BR request_irq (9).
|
.\" .BR request_irq (9).
|
||||||
.SS Miscellaneous
|
.SS Miscellaneous
|
||||||
Child processes inherit the scheduling algorithm and parameters across a
|
Child processes inherit the scheduling algorithm and parameters across a
|
||||||
.BR fork ().
|
.BR fork (2).
|
||||||
The scheduling algorithm and parameters are preserved across
|
The scheduling algorithm and parameters are preserved across
|
||||||
.BR execve (2).
|
.BR execve (2).
|
||||||
|
|
||||||
Memory locking is usually needed for real-time processes to avoid
|
Memory locking is usually needed for real-time processes to avoid
|
||||||
paging delays, this can be done with
|
paging delays, this can be done with
|
||||||
.BR mlock ()
|
.BR mlock (2)
|
||||||
or
|
or
|
||||||
.BR mlockall ().
|
.BR mlockall (2).
|
||||||
|
|
||||||
As a non-blocking end-less loop in a process scheduled under
|
As a non-blocking end-less loop in a process scheduled under
|
||||||
\fISCHED_FIFO\fP or \fISCHED_RR\fP will block all processes with lower
|
\fISCHED_FIFO\fP or \fISCHED_RR\fP will block all processes with lower
|
||||||
|
|
|
@ -86,8 +86,9 @@ and is the standard Unix call to do so.
|
||||||
|
|
||||||
The arrays of file descriptors are called \fIfile descriptor sets\fP.
|
The arrays of file descriptors are called \fIfile descriptor sets\fP.
|
||||||
Each set is declared as type \fBfd_set\fP, and its contents can be
|
Each set is declared as type \fBfd_set\fP, and its contents can be
|
||||||
altered with the macros \fBFD_CLR\fP(), \fBFD_ISSET\fP(), \fBFD_SET\fP(), and
|
altered with the macros \fBFD_CLR\fP(), \fBFD_ISSET\fP(),
|
||||||
\fBFD_ZERO\fP(). \fBFD_ZERO\fP() is usually the first function to be used on
|
\fBFD_SET\fP(), and \fBFD_ZERO\fP().
|
||||||
|
\fBFD_ZERO\fP() is usually the first function to be used on
|
||||||
a newly declared set.
|
a newly declared set.
|
||||||
Thereafter, the individual file descriptors that
|
Thereafter, the individual file descriptors that
|
||||||
you are interested in can be added one by one with \fBFD_SET\fP().
|
you are interested in can be added one by one with \fBFD_SET\fP().
|
||||||
|
@ -95,7 +96,8 @@ you are interested in can be added one by one with \fBFD_SET\fP().
|
||||||
described below; after calling \fBselect\fP() you can test if your file
|
described below; after calling \fBselect\fP() you can test if your file
|
||||||
descriptor is still present in the set with the \fBFD_ISSET\fP() macro.
|
descriptor is still present in the set with the \fBFD_ISSET\fP() macro.
|
||||||
\fBFD_ISSET\fP() returns non-zero if the descriptor is present and zero if
|
\fBFD_ISSET\fP() returns non-zero if the descriptor is present and zero if
|
||||||
it is not. \fBFD_CLR\fP() removes a file descriptor from the set.
|
it is not.
|
||||||
|
\fBFD_CLR\fP() removes a file descriptor from the set.
|
||||||
.SH ARGUMENTS
|
.SH ARGUMENTS
|
||||||
.TP
|
.TP
|
||||||
\fIreadfds\fP
|
\fIreadfds\fP
|
||||||
|
@ -103,16 +105,16 @@ This set is watched to see if data is available for reading from any of
|
||||||
its file descriptors.
|
its file descriptors.
|
||||||
After \fBselect\fP() has returned, \fIreadfds\fP will be
|
After \fBselect\fP() has returned, \fIreadfds\fP will be
|
||||||
cleared of all file descriptors except for those file descriptors that
|
cleared of all file descriptors except for those file descriptors that
|
||||||
are immediately available for reading with a \fBrecv\fP() (for sockets) or
|
are immediately available for reading with a \fBrecv\fP(2) (for sockets) or
|
||||||
\fBread\fP() (for pipes, files, and sockets) call.
|
\fBread\fP(2) (for pipes, files, and sockets) call.
|
||||||
.TP
|
.TP
|
||||||
\fIwritefds\fP
|
\fIwritefds\fP
|
||||||
This set is watched to see if there is space to write data to any of
|
This set is watched to see if there is space to write data to any of
|
||||||
its file descriptors.
|
its file descriptors.
|
||||||
After \fBselect\fP() has returned, \fIwritefds\fP will be
|
After \fBselect\fP() has returned, \fIwritefds\fP will be
|
||||||
cleared of all file descriptors except for those file descriptors that
|
cleared of all file descriptors except for those file descriptors that
|
||||||
are immediately available for writing with a \fBsend\fP() (for sockets) or
|
are immediately available for writing with a \fBsend\fP(2) (for sockets) or
|
||||||
\fBwrite\fP() (for pipes, files, and sockets) call.
|
\fBwrite\fP(2) (for pipes, files, and sockets) call.
|
||||||
.TP
|
.TP
|
||||||
\fIexceptfds\fP
|
\fIexceptfds\fP
|
||||||
This set is watched for exceptions or errors on any of the file
|
This set is watched for exceptions or errors on any of the file
|
||||||
|
@ -129,8 +131,8 @@ After \fBselect\fP() has returned,
|
||||||
\fIexceptfds\fP will be cleared of all file descriptors except for those
|
\fIexceptfds\fP will be cleared of all file descriptors except for those
|
||||||
descriptors that are available for reading OOB data.
|
descriptors that are available for reading OOB data.
|
||||||
You can only ever
|
You can only ever
|
||||||
read one byte of OOB data though (which is done with \fBrecv\fP()), and
|
read one byte of OOB data though (which is done with \fBrecv\fP(2)), and
|
||||||
writing OOB data (done with \fBsend\fP()) can be done at any time and will
|
writing OOB data (done with \fBsend\fP(2)) can be done at any time and will
|
||||||
not block.
|
not block.
|
||||||
Hence there is no need for a fourth set to check if a socket
|
Hence there is no need for a fourth set to check if a socket
|
||||||
is available for writing OOB data.
|
is available for writing OOB data.
|
||||||
|
@ -209,7 +211,7 @@ mask out signals that are not to be received except within the
|
||||||
For instance, let us say that the event in question
|
For instance, let us say that the event in question
|
||||||
was the exit of a child process.
|
was the exit of a child process.
|
||||||
Before the start of the main loop, we
|
Before the start of the main loop, we
|
||||||
would block \fBSIGCHLD\fP using \fBsigprocmask\fP().
|
would block \fBSIGCHLD\fP using \fBsigprocmask\fP(2).
|
||||||
Our \fBpselect\fP()
|
Our \fBpselect\fP()
|
||||||
call would enable \fBSIGCHLD\fP by using the virgin signal mask.
|
call would enable \fBSIGCHLD\fP by using the virgin signal mask.
|
||||||
Our
|
Our
|
||||||
|
@ -258,7 +260,7 @@ Unix programmers often find
|
||||||
themselves in a position where they have to handle I/O from more than one
|
themselves in a position where they have to handle I/O from more than one
|
||||||
file descriptor where the data flow may be intermittent.
|
file descriptor where the data flow may be intermittent.
|
||||||
If you were to
|
If you were to
|
||||||
merely create a sequence of \fBread\fP() and \fBwrite\fP() calls, you would
|
merely create a sequence of \fBread\fP(2) and \fBwrite\fP(2) calls, you would
|
||||||
find that one of your calls may block waiting for data from/to a file
|
find that one of your calls may block waiting for data from/to a file
|
||||||
descriptor, while another file descriptor is unused though available
|
descriptor, while another file descriptor is unused though available
|
||||||
for data. \fBselect\fP() efficiently copes with this situation.
|
for data. \fBselect\fP() efficiently copes with this situation.
|
||||||
|
@ -543,12 +545,12 @@ including OOB signal data transmitted by \fBtelnet\fP servers.
|
||||||
It
|
It
|
||||||
handles the tricky problem of having data flow in both directions
|
handles the tricky problem of having data flow in both directions
|
||||||
simultaneously.
|
simultaneously.
|
||||||
You might think it more efficient to use a \fBfork\fP()
|
You might think it more efficient to use a \fBfork\fP(2)
|
||||||
call and devote a thread to each stream.
|
call and devote a thread to each stream.
|
||||||
This becomes more tricky than
|
This becomes more tricky than
|
||||||
you might suspect.
|
you might suspect.
|
||||||
Another idea is to set non-blocking I/O using an
|
Another idea is to set non-blocking I/O using an
|
||||||
\fBioctl\fP() call.
|
\fBioctl\fP(2) call.
|
||||||
This also has its problems because you end up having
|
This also has its problems because you end up having
|
||||||
to have inefficient timeouts.
|
to have inefficient timeouts.
|
||||||
|
|
||||||
|
@ -595,8 +597,8 @@ should be checked to see if they are ready.
|
||||||
.\" available for reading \fImust\fP be read, etc.
|
.\" available for reading \fImust\fP be read, etc.
|
||||||
.TP
|
.TP
|
||||||
\fB5.\fP
|
\fB5.\fP
|
||||||
The functions \fBread\fP(), \fBrecv\fP(), \fBwrite\fP(), and
|
The functions \fBread\fP(2), \fBrecv\fP(2), \fBwrite\fP(2), and
|
||||||
\fBsend\fP() do \fInot\fP necessarily read/write the full amount of data
|
\fBsend\fP(2) do \fInot\fP necessarily read/write the full amount of data
|
||||||
that you have requested.
|
that you have requested.
|
||||||
If they do read/write the full amount, its
|
If they do read/write the full amount, its
|
||||||
because you have a low traffic load and a fast stream.
|
because you have a low traffic load and a fast stream.
|
||||||
|
@ -614,8 +616,8 @@ The buffers in the example above are 1024 bytes although they could
|
||||||
easily be made larger.
|
easily be made larger.
|
||||||
.TP
|
.TP
|
||||||
\fB7.\fP
|
\fB7.\fP
|
||||||
The functions \fBread\fP(), \fBrecv\fP(), \fBwrite\fP(), and
|
The functions \fBread\fP(2), \fBrecv\fP(2), \fBwrite\fP(2), and
|
||||||
\fBsend\fP() as well as the \fBselect\fP() call can return \-1 with
|
\fBsend\fP(2) as well as the \fBselect\fP() call can return \-1 with
|
||||||
.I errno
|
.I errno
|
||||||
set to \fBEINTR\fP,
|
set to \fBEINTR\fP,
|
||||||
or with
|
or with
|
||||||
|
@ -631,12 +633,12 @@ Nonetheless
|
||||||
you should still cope with these errors for completeness.
|
you should still cope with these errors for completeness.
|
||||||
.TP
|
.TP
|
||||||
\fB8.\fP
|
\fB8.\fP
|
||||||
Never call \fBread\fP(), \fBrecv\fP(), \fBwrite\fP(), or \fBsend\fP()
|
Never call \fBread\fP(2), \fBrecv\fP(2), \fBwrite\fP(2), or \fBsend\fP(2)
|
||||||
with a buffer length of zero.
|
with a buffer length of zero.
|
||||||
.TP
|
.TP
|
||||||
\fB9.\fP
|
\fB9.\fP
|
||||||
If the functions \fBread\fP(),
|
If the functions \fBread\fP(2),
|
||||||
\fBrecv\fP(), \fBwrite\fP(), and \fBsend\fP() fail
|
\fBrecv\fP(2), \fBwrite\fP(2), and \fBsend\fP(2) fail
|
||||||
with errors other than those listed in \fB7.\fP,
|
with errors other than those listed in \fB7.\fP,
|
||||||
or one of the input functions returns 0, indicating end of file,
|
or one of the input functions returns 0, indicating end of file,
|
||||||
then you should \fInot\fP pass that descriptor to
|
then you should \fInot\fP pass that descriptor to
|
||||||
|
@ -648,8 +650,8 @@ to prevent it being included in a set.
|
||||||
.TP
|
.TP
|
||||||
\fB10.\fP
|
\fB10.\fP
|
||||||
The timeout value must be initialized with each new call to \fBselect\fP(),
|
The timeout value must be initialized with each new call to \fBselect\fP(),
|
||||||
since some operating systems modify the structure. \fBpselect\fP()
|
since some operating systems modify the structure.
|
||||||
however does not modify its timeout structure.
|
\fBpselect\fP() however does not modify its timeout structure.
|
||||||
.TP
|
.TP
|
||||||
\fB11.\fP
|
\fB11.\fP
|
||||||
I have heard that the Windows socket layer does not cope with OOB data
|
I have heard that the Windows socket layer does not cope with OOB data
|
||||||
|
@ -660,7 +662,7 @@ Having no file descriptors set is a useful
|
||||||
way to sleep the process with sub-second precision by using the timeout.
|
way to sleep the process with sub-second precision by using the timeout.
|
||||||
(See further on.)
|
(See further on.)
|
||||||
.SH USLEEP EMULATION
|
.SH USLEEP EMULATION
|
||||||
On systems that do not have a \fBusleep\fP() function, you can call
|
On systems that do not have a \fBusleep\fP(3) function, you can call
|
||||||
\fBselect\fP() with a finite timeout and no file descriptors as
|
\fBselect\fP() with a finite timeout and no file descriptors as
|
||||||
follows:
|
follows:
|
||||||
.PP
|
.PP
|
||||||
|
|
|
@ -100,7 +100,7 @@ structure is defined in <sys/ipc.h> as follows
|
||||||
.nf
|
.nf
|
||||||
.in +4n
|
.in +4n
|
||||||
struct ipc_perm {
|
struct ipc_perm {
|
||||||
key_t key; /* Key supplied to semget() */
|
key_t key; /* Key supplied to semget(2) */
|
||||||
uid_t \fBuid\fP; /* Effective UID of owner */
|
uid_t \fBuid\fP; /* Effective UID of owner */
|
||||||
gid_t \fBgid\fP; /* Effective GID of owner */
|
gid_t \fBgid\fP; /* Effective GID of owner */
|
||||||
uid_t cuid; /* Effective UID of creator */
|
uid_t cuid; /* Effective UID of creator */
|
||||||
|
@ -153,7 +153,7 @@ is ignored.
|
||||||
.B IPC_RMID
|
.B IPC_RMID
|
||||||
Immediately remove the semaphore set,
|
Immediately remove the semaphore set,
|
||||||
awakening all processes blocked in
|
awakening all processes blocked in
|
||||||
.BR semop ()
|
.BR semop (2)
|
||||||
calls on the set (with an error return and
|
calls on the set (with an error return and
|
||||||
.I errno
|
.I errno
|
||||||
set to
|
set to
|
||||||
|
@ -186,7 +186,7 @@ struct seminfo {
|
||||||
int semmnu; /* System-wide max. # of undo
|
int semmnu; /* System-wide max. # of undo
|
||||||
structures; unused */
|
structures; unused */
|
||||||
int semmsl; /* Max. # of semaphores in a set */
|
int semmsl; /* Max. # of semaphores in a set */
|
||||||
int semopm; /* Max. # of operations for semop() */
|
int semopm; /* Max. # of operations for semop(2) */
|
||||||
int semume; /* Max. # of undo entries per
|
int semume; /* Max. # of undo entries per
|
||||||
process; unused */
|
process; unused */
|
||||||
int semusz; /* size of struct sem_undo */
|
int semusz; /* size of struct sem_undo */
|
||||||
|
@ -266,7 +266,7 @@ for the
|
||||||
.IR semnum \-th
|
.IR semnum \-th
|
||||||
semaphore of the set
|
semaphore of the set
|
||||||
(i.e. the PID of the process that executed the last
|
(i.e. the PID of the process that executed the last
|
||||||
.BR semop ()
|
.BR semop (2)
|
||||||
call for the
|
call for the
|
||||||
.IR semnum \-th
|
.IR semnum \-th
|
||||||
semaphore of the set).
|
semaphore of the set).
|
||||||
|
@ -308,7 +308,7 @@ Undo entries (see
|
||||||
.BR semop (2))
|
.BR semop (2))
|
||||||
are cleared for altered semaphores in all processes.
|
are cleared for altered semaphores in all processes.
|
||||||
If the changes to semaphore values would permit blocked
|
If the changes to semaphore values would permit blocked
|
||||||
.BR semop ()
|
.BR semop (2)
|
||||||
calls in other processes to proceed, then those processes are woken up.
|
calls in other processes to proceed, then those processes are woken up.
|
||||||
The argument
|
The argument
|
||||||
.I semnum
|
.I semnum
|
||||||
|
@ -330,7 +330,7 @@ member of the
|
||||||
structure associated with the set.
|
structure associated with the set.
|
||||||
Undo entries are cleared for altered semaphores in all processes.
|
Undo entries are cleared for altered semaphores in all processes.
|
||||||
If the changes to semaphore values would permit blocked
|
If the changes to semaphore values would permit blocked
|
||||||
.BR semop ()
|
.BR semop (2)
|
||||||
calls in other processes to proceed, then those processes are woken up.
|
calls in other processes to proceed, then those processes are woken up.
|
||||||
The calling process must have alter permission on the semaphore set.
|
The calling process must have alter permission on the semaphore set.
|
||||||
.SH "RETURN VALUE"
|
.SH "RETURN VALUE"
|
||||||
|
|
|
@ -269,7 +269,7 @@ operation on the semaphore set.
|
||||||
initialise the set, checking for a non-zero
|
initialise the set, checking for a non-zero
|
||||||
.I sem_otime
|
.I sem_otime
|
||||||
in the associated data structure retrieved by a
|
in the associated data structure retrieved by a
|
||||||
.BR semctl ()
|
.BR semctl (2)
|
||||||
.B IPC_STAT
|
.B IPC_STAT
|
||||||
operation can be used to avoid races.)
|
operation can be used to avoid races.)
|
||||||
.SH "CONFORMING TO"
|
.SH "CONFORMING TO"
|
||||||
|
|
|
@ -69,7 +69,7 @@ state (so that the intended recipient is known).
|
||||||
The only difference between
|
The only difference between
|
||||||
.BR send ()
|
.BR send ()
|
||||||
and
|
and
|
||||||
.BR write ()
|
.BR write (2)
|
||||||
is the presence of
|
is the presence of
|
||||||
.IR flags .
|
.IR flags .
|
||||||
With zero
|
With zero
|
||||||
|
@ -77,7 +77,7 @@ With zero
|
||||||
parameter,
|
parameter,
|
||||||
.BR send ()
|
.BR send ()
|
||||||
is equivalent to
|
is equivalent to
|
||||||
.BR write ().
|
.BR write (2).
|
||||||
Also,
|
Also,
|
||||||
.RI send( s , buf , len , flags )
|
.RI send( s , buf , len , flags )
|
||||||
is equivalent to
|
is equivalent to
|
||||||
|
|
|
@ -83,7 +83,7 @@ is the number of bytes to copy between the file descriptors.
|
||||||
Presently (Linux 2.6.9):
|
Presently (Linux 2.6.9):
|
||||||
.IR in_fd ,
|
.IR in_fd ,
|
||||||
must correspond to a file which supports
|
must correspond to a file which supports
|
||||||
.BR mmap ()-like
|
.BR mmap (2)-like
|
||||||
operations
|
operations
|
||||||
(i.e., it cannot be a socket);
|
(i.e., it cannot be a socket);
|
||||||
and
|
and
|
||||||
|
@ -134,7 +134,7 @@ Bad address.
|
||||||
.TP
|
.TP
|
||||||
.B EINVAL
|
.B EINVAL
|
||||||
Descriptor is not valid or locked, or an
|
Descriptor is not valid or locked, or an
|
||||||
.BR mmap ()-like
|
.BR mmap (2)-like
|
||||||
operation is not available for
|
operation is not available for
|
||||||
.IR in_fd .
|
.IR in_fd .
|
||||||
.TP
|
.TP
|
||||||
|
|
|
@ -48,7 +48,7 @@ effective group ID is changed,
|
||||||
will also be changed to the new value of the effective group ID.
|
will also be changed to the new value of the effective group ID.
|
||||||
|
|
||||||
Explicit calls to
|
Explicit calls to
|
||||||
.BR setfsuid ()
|
.BR setfsuid (2)
|
||||||
and
|
and
|
||||||
.BR setfsgid ()
|
.BR setfsgid ()
|
||||||
are usually only used by programs such as the Linux NFS server that
|
are usually only used by programs such as the Linux NFS server that
|
||||||
|
|
|
@ -50,7 +50,7 @@ will also be changed to the new value of the effective user ID.
|
||||||
Explicit calls to
|
Explicit calls to
|
||||||
.BR setfsuid ()
|
.BR setfsuid ()
|
||||||
and
|
and
|
||||||
.BR setfsgid ()
|
.BR setfsgid (2)
|
||||||
are usually only used by programs such as the Linux NFS server that
|
are usually only used by programs such as the Linux NFS server that
|
||||||
need to change what user and group ID is used for file access without a
|
need to change what user and group ID is used for file access without a
|
||||||
corresponding change in the real and effective user and group IDs.
|
corresponding change in the real and effective user and group IDs.
|
||||||
|
|
|
@ -141,7 +141,7 @@ always returns the current process group.
|
||||||
.B EACCES
|
.B EACCES
|
||||||
An attempt was made to change the process group ID
|
An attempt was made to change the process group ID
|
||||||
of one of the children of the calling process and the child had
|
of one of the children of the calling process and the child had
|
||||||
already performed an \fBexecve\fP()
|
already performed an \fBexecve\fP(2)
|
||||||
(\fBsetpgid\fP(), \fBsetpgrp\fP()).
|
(\fBsetpgid\fP(), \fBsetpgrp\fP()).
|
||||||
.TP
|
.TP
|
||||||
.B EINVAL
|
.B EINVAL
|
||||||
|
|
|
@ -70,9 +70,9 @@ to its PID.
|
||||||
In order to be sure that
|
In order to be sure that
|
||||||
.BR setsid ()
|
.BR setsid ()
|
||||||
will succeed,
|
will succeed,
|
||||||
.BR fork ()
|
.BR fork (2)
|
||||||
and
|
and
|
||||||
.BR exit (),
|
.BR _exit (2),
|
||||||
and have the child do
|
and have the child do
|
||||||
.BR setsid ().
|
.BR setsid ().
|
||||||
.SH "CONFORMING TO"
|
.SH "CONFORMING TO"
|
||||||
|
|
|
@ -62,7 +62,7 @@ privileges, assume the identity of a non-root user, and then regain
|
||||||
root privileges afterwards cannot use
|
root privileges afterwards cannot use
|
||||||
.BR setuid ().
|
.BR setuid ().
|
||||||
You can accomplish this with the (non-POSIX, BSD) call
|
You can accomplish this with the (non-POSIX, BSD) call
|
||||||
.BR seteuid ().
|
.BR seteuid (2).
|
||||||
.SH "RETURN VALUE"
|
.SH "RETURN VALUE"
|
||||||
On success, zero is returned.
|
On success, zero is returned.
|
||||||
On error, \-1 is returned, and
|
On error, \-1 is returned, and
|
||||||
|
|
|
@ -71,7 +71,7 @@ struct shmid_ds {
|
||||||
time_t shm_dtime; /* Last detach time */
|
time_t shm_dtime; /* Last detach time */
|
||||||
time_t shm_ctime; /* Last change time */
|
time_t shm_ctime; /* Last change time */
|
||||||
pid_t shm_cpid; /* PID of creator */
|
pid_t shm_cpid; /* PID of creator */
|
||||||
pid_t shm_lpid; /* PID of last shmat()/shmdt() */
|
pid_t shm_lpid; /* PID of last shmat(2)/shmdt(2) */
|
||||||
shmatt_t shm_nattch; /* No. of current attaches */
|
shmatt_t shm_nattch; /* No. of current attaches */
|
||||||
...
|
...
|
||||||
};
|
};
|
||||||
|
@ -87,7 +87,7 @@ structure is defined in <sys/ipc.h> as follows
|
||||||
.in +4n
|
.in +4n
|
||||||
.nf
|
.nf
|
||||||
struct ipc_perm {
|
struct ipc_perm {
|
||||||
key_t key; /* Key supplied to shmget() */
|
key_t key; /* Key supplied to shmget(2) */
|
||||||
uid_t \fBuid\fP; /* Effective UID of owner */
|
uid_t \fBuid\fP; /* Effective UID of owner */
|
||||||
gid_t \fBgid\fP; /* Effective GID of owner */
|
gid_t \fBgid\fP; /* Effective GID of owner */
|
||||||
uid_t cuid; /* Effective UID of creator */
|
uid_t cuid; /* Effective UID of creator */
|
||||||
|
@ -367,7 +367,7 @@ In the future these may modified or moved to a /proc file system
|
||||||
interface.
|
interface.
|
||||||
|
|
||||||
Linux permits a process to attach
|
Linux permits a process to attach
|
||||||
.RB ( shmat ())
|
.RB ( shmat (2))
|
||||||
a shared memory segment that has already been marked for deletion
|
a shared memory segment that has already been marked for deletion
|
||||||
using
|
using
|
||||||
.IR shmctl(IPC_RMID) .
|
.IR shmctl(IPC_RMID) .
|
||||||
|
|
|
@ -174,19 +174,19 @@ If the shared memory segment already exists, the permissions are
|
||||||
verified, and a check is made to see if it is marked for destruction.
|
verified, and a check is made to see if it is marked for destruction.
|
||||||
.SH "SYSTEM CALLS"
|
.SH "SYSTEM CALLS"
|
||||||
.TP
|
.TP
|
||||||
.BR fork ()
|
.BR fork (2)
|
||||||
After a
|
After a
|
||||||
.BR fork ()
|
.BR fork (2)
|
||||||
the child inherits the attached shared memory segments.
|
the child inherits the attached shared memory segments.
|
||||||
.TP
|
.TP
|
||||||
.BR exec ()
|
.BR execve (2)
|
||||||
After an
|
After an
|
||||||
.BR exec ()
|
.BR execve (2)
|
||||||
all attached shared memory segments are detached (not destroyed).
|
all attached shared memory segments are detached (not destroyed).
|
||||||
.TP
|
.TP
|
||||||
.BR exit ()
|
.BR _exit (2)
|
||||||
Upon
|
Upon
|
||||||
.BR exit ()
|
.BR _exit (2)
|
||||||
all attached shared memory segments are detached (not destroyed).
|
all attached shared memory segments are detached (not destroyed).
|
||||||
.SH "RETURN VALUE"
|
.SH "RETURN VALUE"
|
||||||
A valid segment identifier,
|
A valid segment identifier,
|
||||||
|
|
16
man2/shmop.2
16
man2/shmop.2
|
@ -36,7 +36,7 @@
|
||||||
.\"
|
.\"
|
||||||
.TH SHMOP 2 2004-11-10 "Linux 2.6.9" "Linux Programmer's Manual"
|
.TH SHMOP 2 2004-11-10 "Linux 2.6.9" "Linux Programmer's Manual"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
shmop \- shared memory operations
|
shmop, shmat, shmdt \- shared memory operations
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
.nf
|
.nf
|
||||||
.B
|
.B
|
||||||
|
@ -158,19 +158,19 @@ If it becomes 0 and the segment is marked for deletion,
|
||||||
the segment is deleted.
|
the segment is deleted.
|
||||||
.SH "SYSTEM CALLS"
|
.SH "SYSTEM CALLS"
|
||||||
.TP 11
|
.TP 11
|
||||||
.BR fork ()
|
.BR fork (2)
|
||||||
After a
|
After a
|
||||||
.BR fork ()
|
.BR fork (2)
|
||||||
the child inherits the attached shared memory segments.
|
the child inherits the attached shared memory segments.
|
||||||
.TP
|
.TP
|
||||||
.BR exec ()
|
.BR execve (2)
|
||||||
After an
|
After an
|
||||||
.BR exec ()
|
.BR execve (2)
|
||||||
all attached shared memory segments are detached from the process.
|
all attached shared memory segments are detached from the process.
|
||||||
.TP
|
.TP
|
||||||
.BR exit ()
|
.BR _exit (2)
|
||||||
Upon
|
Upon
|
||||||
.BR exit ()
|
.BR _exit (2)
|
||||||
all attached shared memory segments are detached from the process.
|
all attached shared memory segments are detached from the process.
|
||||||
.SH "RETURN VALUE"
|
.SH "RETURN VALUE"
|
||||||
On success
|
On success
|
||||||
|
@ -206,7 +206,7 @@ value, unaligned (i.e., not page-aligned and \fBSHM_RND\fP was not
|
||||||
specified) or invalid
|
specified) or invalid
|
||||||
.I shmaddr
|
.I shmaddr
|
||||||
value, or failing attach at
|
value, or failing attach at
|
||||||
.BR brk (),
|
.BR brk (2),
|
||||||
.\" FIXME What does "failing attach at brk" mean? (Is this phrase
|
.\" FIXME What does "failing attach at brk" mean? (Is this phrase
|
||||||
.\" just junk?)
|
.\" just junk?)
|
||||||
or
|
or
|
||||||
|
|
|
@ -272,14 +272,14 @@ c s
|
||||||
l l.
|
l l.
|
||||||
\fIsi_code\fR
|
\fIsi_code\fR
|
||||||
Value:Signal origin
|
Value:Signal origin
|
||||||
SI_USER:kill(), sigsend(), or raise()
|
SI_USER:kill(2), sigsend(2), or raise(3)
|
||||||
SI_KERNEL:The kernel
|
SI_KERNEL:The kernel
|
||||||
SI_QUEUE:sigqueue()
|
SI_QUEUE:sigqueue(2)
|
||||||
SI_TIMER:POSIX timer expired
|
SI_TIMER:POSIX timer expired
|
||||||
SI_MESGQ:POSIX message queue state changed (since Linux 2.6.6)
|
SI_MESGQ:POSIX message queue state changed (since Linux 2.6.6)
|
||||||
SI_ASYNCIO:AIO completed
|
SI_ASYNCIO:AIO completed
|
||||||
SI_SIGIO:queued SIGIO
|
SI_SIGIO:queued SIGIO
|
||||||
SI_TKILL:tkill() or tgkill() (since Linux 2.4.19)
|
SI_TKILL:tkill(2) or tgkill(2) (since Linux 2.4.19)
|
||||||
.\" SI_DETHREAD is defined in 2.6.9 sources, but isn't implemented
|
.\" SI_DETHREAD is defined in 2.6.9 sources, but isn't implemented
|
||||||
.\" It appears to have been an idea that was tried during 2.5.6
|
.\" It appears to have been an idea that was tried during 2.5.6
|
||||||
.\" through to 2.5.24 and then was backed out.
|
.\" through to 2.5.24 and then was backed out.
|
||||||
|
@ -392,9 +392,9 @@ ignores a
|
||||||
or
|
or
|
||||||
.BR SIGSEGV
|
.BR SIGSEGV
|
||||||
signal that was not generated by
|
signal that was not generated by
|
||||||
.BR kill ()
|
.BR kill (2)
|
||||||
or
|
or
|
||||||
.BR raise ().
|
.BR raise (3).
|
||||||
Integer division by zero has undefined result.
|
Integer division by zero has undefined result.
|
||||||
On some architectures it will generate a
|
On some architectures it will generate a
|
||||||
.B SIGFPE
|
.B SIGFPE
|
||||||
|
|
|
@ -47,7 +47,7 @@ Use \fBsigaltstack\fP() to inform the system of the existence and
|
||||||
location of the alternate signal stack.
|
location of the alternate signal stack.
|
||||||
.TP
|
.TP
|
||||||
3.
|
3.
|
||||||
When establishing a signal handler using \fBsigaction\fP(),
|
When establishing a signal handler using \fBsigaction\fP(2),
|
||||||
inform the system that the signal handler should be executed
|
inform the system that the signal handler should be executed
|
||||||
on the alternate signal stack by
|
on the alternate signal stack by
|
||||||
specifying the \fBSA_ONSTACK\fP flag.
|
specifying the \fBSA_ONSTACK\fP flag.
|
||||||
|
@ -160,7 +160,8 @@ In these circumstances the only way to catch this signal is
|
||||||
on an alternate signal stack.
|
on an alternate signal stack.
|
||||||
.P
|
.P
|
||||||
On most hardware architectures supported by Linux, stacks grow
|
On most hardware architectures supported by Linux, stacks grow
|
||||||
downwards. \fBsigaltstack\fP() automatically takes account
|
downwards.
|
||||||
|
\fBsigaltstack\fP() automatically takes account
|
||||||
of the direction of stack growth.
|
of the direction of stack growth.
|
||||||
.P
|
.P
|
||||||
Functions called from a signal handler executing on an alternate
|
Functions called from a signal handler executing on an alternate
|
||||||
|
@ -172,7 +173,7 @@ automatically extend the alternate signal stack.
|
||||||
Exceeding the allocated size of the alternate signal stack will
|
Exceeding the allocated size of the alternate signal stack will
|
||||||
lead to unpredictable results.
|
lead to unpredictable results.
|
||||||
.P
|
.P
|
||||||
A successful call to \fBexecve\fP() removes any existing alternate
|
A successful call to \fBexecve\fP(2) removes any existing alternate
|
||||||
signal stack.
|
signal stack.
|
||||||
.P
|
.P
|
||||||
\fBsigaltstack\fP() supersedes the older \fBsigstack\fP() call.
|
\fBsigaltstack\fP() supersedes the older \fBsigstack\fP() call.
|
||||||
|
|
|
@ -69,16 +69,16 @@ The call was interrupted by a signal.
|
||||||
Normally,
|
Normally,
|
||||||
.BR sigsuspend ()
|
.BR sigsuspend ()
|
||||||
is used in conjunction with
|
is used in conjunction with
|
||||||
.BR sigprocmask ()
|
.BR sigprocmask (2)
|
||||||
in order to prevent delivery of a signal during the execution of a
|
in order to prevent delivery of a signal during the execution of a
|
||||||
critical code section.
|
critical code section.
|
||||||
The caller first blocks the signals with
|
The caller first blocks the signals with
|
||||||
.BR sigprocmask ().
|
.BR sigprocmask (2).
|
||||||
When the critical code has completed, the caller then waits for the
|
When the critical code has completed, the caller then waits for the
|
||||||
signals by calling
|
signals by calling
|
||||||
.BR sigsuspend ()
|
.BR sigsuspend ()
|
||||||
with the signal mask that was returned by
|
with the signal mask that was returned by
|
||||||
.BR sigprocmask ()
|
.BR sigprocmask (2)
|
||||||
(in the
|
(in the
|
||||||
.IR oldset
|
.IR oldset
|
||||||
argument).
|
argument).
|
||||||
|
|
|
@ -114,7 +114,7 @@ was invalid.
|
||||||
In normal usage, the calling program blocks the signals in
|
In normal usage, the calling program blocks the signals in
|
||||||
.I set
|
.I set
|
||||||
via a prior call to
|
via a prior call to
|
||||||
.BR sigprocmask ()
|
.BR sigprocmask (2)
|
||||||
(so that the default disposition for these signals does not occur if they
|
(so that the default disposition for these signals does not occur if they
|
||||||
are delivered between successive calls to
|
are delivered between successive calls to
|
||||||
.BR sigwaitinfo ()
|
.BR sigwaitinfo ()
|
||||||
|
|
|
@ -171,10 +171,10 @@ In overview, these system calls perform the following tasks:
|
||||||
moves data from the buffer to an arbitrary file descriptor, or vice versa,
|
moves data from the buffer to an arbitrary file descriptor, or vice versa,
|
||||||
or from one buffer to another.
|
or from one buffer to another.
|
||||||
.TP
|
.TP
|
||||||
.BR tee ()
|
.BR tee (2)
|
||||||
"copies" the data from one buffer to another.
|
"copies" the data from one buffer to another.
|
||||||
.TP
|
.TP
|
||||||
.BR vmsplice ()
|
.BR vmsplice (2)
|
||||||
"copies" data from user space into the buffer.
|
"copies" data from user space into the buffer.
|
||||||
.PP
|
.PP
|
||||||
Though we talk of copying, actual copies are generally avoided.
|
Though we talk of copying, actual copies are generally avoided.
|
||||||
|
|
|
@ -200,9 +200,9 @@ LSB has deprecated the library calls
|
||||||
and
|
and
|
||||||
.BR fstatfs ()
|
.BR fstatfs ()
|
||||||
and tells us to use
|
and tells us to use
|
||||||
.BR statvfs ()
|
.BR statvfs (2)
|
||||||
and
|
and
|
||||||
.BR fstatvfs ()
|
.BR fstatvfs (2)
|
||||||
instead.
|
instead.
|
||||||
.SS The f_fsid field
|
.SS The f_fsid field
|
||||||
Solaris, Irix and POSIX have a system call
|
Solaris, Irix and POSIX have a system call
|
||||||
|
|
|
@ -154,9 +154,9 @@ Some values were too large to be represented in the returned struct.
|
||||||
POSIX.1-2001
|
POSIX.1-2001
|
||||||
.SH NOTES
|
.SH NOTES
|
||||||
The Linux kernel has system calls
|
The Linux kernel has system calls
|
||||||
.BR statfs ()
|
.BR statfs (2)
|
||||||
and
|
and
|
||||||
.BR fstatfs ()
|
.BR fstatfs (2)
|
||||||
to support this library call.
|
to support this library call.
|
||||||
|
|
||||||
The current glibc implementations of
|
The current glibc implementations of
|
||||||
|
|
|
@ -136,7 +136,7 @@ is done.
|
||||||
Deleting the name referred to by a symlink will actually delete the
|
Deleting the name referred to by a symlink will actually delete the
|
||||||
file (unless it also has other hard links). If this behaviour is not
|
file (unless it also has other hard links). If this behaviour is not
|
||||||
desired, use
|
desired, use
|
||||||
.BR link ().
|
.BR link (2).
|
||||||
.SH "CONFORMING TO"
|
.SH "CONFORMING TO"
|
||||||
SVr4, 4.3BSD, POSIX.1-2001.
|
SVr4, 4.3BSD, POSIX.1-2001.
|
||||||
.\" SVr4 documents additional error codes EDQUOT and ENOSYS.
|
.\" SVr4 documents additional error codes EDQUOT and ENOSYS.
|
||||||
|
|
|
@ -132,7 +132,7 @@ and
|
||||||
.I tms_cutime
|
.I tms_cutime
|
||||||
fields, although POSIX.1-2001 says that this should only happen
|
fields, although POSIX.1-2001 says that this should only happen
|
||||||
if the calling process
|
if the calling process
|
||||||
.BR wait ()s
|
.BR wait (2)s
|
||||||
on its children.
|
on its children.
|
||||||
This non-conformance is rectified in Linux 2.6.9 and later.
|
This non-conformance is rectified in Linux 2.6.9 and later.
|
||||||
.\" See the description of times() in XSH, which says:
|
.\" See the description of times() in XSH, which says:
|
||||||
|
|
|
@ -50,7 +50,7 @@ The \fBtkill\fP() system call is analogous to
|
||||||
except when the specified process is part of a thread group
|
except when the specified process is part of a thread group
|
||||||
(created by specifying the CLONE_THREAD flag in the call to clone).
|
(created by specifying the CLONE_THREAD flag in the call to clone).
|
||||||
Since all the processes in a thread group have the same PID,
|
Since all the processes in a thread group have the same PID,
|
||||||
they cannot be individually signalled with \fBkill\fP().
|
they cannot be individually signalled with \fBkill\fP(2).
|
||||||
With \fBtkill\fP(), however, one can address each process
|
With \fBtkill\fP(), however, one can address each process
|
||||||
by its unique TID.
|
by its unique TID.
|
||||||
.PP
|
.PP
|
||||||
|
|
|
@ -115,7 +115,7 @@ used length 9, the second one used 65, the third one also uses 65 but
|
||||||
adds the \fIdomainname\fP field.
|
adds the \fIdomainname\fP field.
|
||||||
.LP
|
.LP
|
||||||
Part of the utsname information is also accessible via
|
Part of the utsname information is also accessible via
|
||||||
.BR sysctl ()
|
.BR sysctl (2)
|
||||||
and via
|
and via
|
||||||
.IR /proc/sys/kernel/ { ostype ,
|
.IR /proc/sys/kernel/ { ostype ,
|
||||||
.IR hostname ,
|
.IR hostname ,
|
||||||
|
|
34
man2/vfork.2
34
man2/vfork.2
|
@ -37,7 +37,7 @@ vfork \- create a child process and block parent
|
||||||
The
|
The
|
||||||
.BR vfork ()
|
.BR vfork ()
|
||||||
function has the same effect as
|
function has the same effect as
|
||||||
.BR fork (),
|
.BR fork (2),
|
||||||
except that the behaviour is undefined if the process created by
|
except that the behaviour is undefined if the process created by
|
||||||
.BR vfork ()
|
.BR vfork ()
|
||||||
either modifies any data other than a variable of type
|
either modifies any data other than a variable of type
|
||||||
|
@ -47,7 +47,7 @@ used to store the return value from
|
||||||
or returns from the function in which
|
or returns from the function in which
|
||||||
.BR vfork ()
|
.BR vfork ()
|
||||||
was called, or calls any other function before successfully calling
|
was called, or calls any other function before successfully calling
|
||||||
.BR _exit ()
|
.BR _exit (2)
|
||||||
or one of the
|
or one of the
|
||||||
.BR exec ()
|
.BR exec ()
|
||||||
family of functions.
|
family of functions.
|
||||||
|
@ -66,35 +66,35 @@ It is used to create new processes without copying the page tables of
|
||||||
the parent process.
|
the parent process.
|
||||||
It may be useful in performance sensitive applications
|
It may be useful in performance sensitive applications
|
||||||
where a child will be created which then immediately issues an
|
where a child will be created which then immediately issues an
|
||||||
.BR execve () .
|
.BR execve (2) .
|
||||||
.PP
|
.PP
|
||||||
.BR vfork ()
|
.BR vfork ()
|
||||||
differs from
|
differs from
|
||||||
.BR fork ()
|
.BR fork (2)
|
||||||
in that the parent is suspended until the child makes a call to
|
in that the parent is suspended until the child makes a call to
|
||||||
.BR execve (2)
|
.BR execve (2)
|
||||||
or
|
or
|
||||||
.BR _exit (2).
|
.BR _exit (2).
|
||||||
The child shares all memory with its parent, including the stack, until
|
The child shares all memory with its parent, including the stack, until
|
||||||
.BR execve ()
|
.BR execve (2)
|
||||||
is issued by the child.
|
is issued by the child.
|
||||||
The child must not return from the current function or call
|
The child must not return from the current function or call
|
||||||
.BR exit (),
|
.BR exit (3),
|
||||||
but may call
|
but may call
|
||||||
.BR _exit ().
|
.BR _exit (2).
|
||||||
.PP
|
.PP
|
||||||
Signal handlers are inherited, but not shared.
|
Signal handlers are inherited, but not shared.
|
||||||
Signals to the parent
|
Signals to the parent
|
||||||
arrive after the child releases the parent's memory.
|
arrive after the child releases the parent's memory.
|
||||||
.SH "HISTORIC DESCRIPTION"
|
.SH "HISTORIC DESCRIPTION"
|
||||||
Under Linux,
|
Under Linux,
|
||||||
.BR fork ()
|
.BR fork (2)
|
||||||
is implemented using copy-on-write pages, so the only penalty incurred by
|
is implemented using copy-on-write pages, so the only penalty incurred by
|
||||||
.BR fork ()
|
.BR fork (2)
|
||||||
is the time and memory required to duplicate the parent's page tables,
|
is the time and memory required to duplicate the parent's page tables,
|
||||||
and to create a unique task structure for the child.
|
and to create a unique task structure for the child.
|
||||||
However, in the bad old days a
|
However, in the bad old days a
|
||||||
.BR fork ()
|
.BR fork (2)
|
||||||
would require making a complete copy of the caller's data space,
|
would require making a complete copy of the caller's data space,
|
||||||
often needlessly, since usually immediately afterwards an
|
often needlessly, since usually immediately afterwards an
|
||||||
.BR exec ()
|
.BR exec ()
|
||||||
|
@ -104,7 +104,7 @@ Thus, for greater efficiency, BSD introduced the
|
||||||
system call, that did not fully copy the address space of
|
system call, that did not fully copy the address space of
|
||||||
the parent process, but borrowed the parent's memory and thread
|
the parent process, but borrowed the parent's memory and thread
|
||||||
of control until a call to
|
of control until a call to
|
||||||
.BR execve ()
|
.BR execve (2)
|
||||||
or an exit occurred.
|
or an exit occurred.
|
||||||
The parent process was suspended while the
|
The parent process was suspended while the
|
||||||
child was using its resources.
|
child was using its resources.
|
||||||
|
@ -121,7 +121,7 @@ are implemented.
|
||||||
Users should not depend on the memory sharing semantics of
|
Users should not depend on the memory sharing semantics of
|
||||||
.BR vfork ()
|
.BR vfork ()
|
||||||
as it will, in that case, be made synonymous to
|
as it will, in that case, be made synonymous to
|
||||||
.BR fork ().\c
|
.BR fork (2).\c
|
||||||
"
|
"
|
||||||
|
|
||||||
Details of the signal handling are obscure and differ between systems.
|
Details of the signal handling are obscure and differ between systems.
|
||||||
|
@ -146,11 +146,11 @@ system call appeared in 3.0BSD.
|
||||||
.\" In the release notes for 4.2BSD Sam Leffler wrote: `vfork: Is still
|
.\" In the release notes for 4.2BSD Sam Leffler wrote: `vfork: Is still
|
||||||
.\" present, but definitely on its way out'.
|
.\" present, but definitely on its way out'.
|
||||||
In 4.4BSD it was made synonymous to
|
In 4.4BSD it was made synonymous to
|
||||||
.BR fork ()
|
.BR fork (2)
|
||||||
but NetBSD introduced it again,
|
but NetBSD introduced it again,
|
||||||
cf. http://www.netbsd.org/Documentation/kernel/vfork.html .
|
cf. http://www.netbsd.org/Documentation/kernel/vfork.html .
|
||||||
In Linux, it has been equivalent to
|
In Linux, it has been equivalent to
|
||||||
.BR fork ()
|
.BR fork (2)
|
||||||
until 2.2.0-pre6 or so.
|
until 2.2.0-pre6 or so.
|
||||||
Since 2.2.0-pre9 (on i386, somewhat later on
|
Since 2.2.0-pre9 (on i386, somewhat later on
|
||||||
other architectures) it is an independent system call.
|
other architectures) it is an independent system call.
|
||||||
|
@ -162,13 +162,13 @@ Support was added in glibc 2.0.112.
|
||||||
The requirements put on
|
The requirements put on
|
||||||
.BR vfork ()
|
.BR vfork ()
|
||||||
by the standards are weaker than those put on
|
by the standards are weaker than those put on
|
||||||
.BR fork (),
|
.BR fork (2),
|
||||||
so an implementation where the two are synonymous is compliant.
|
so an implementation where the two are synonymous is compliant.
|
||||||
In particular, the programmer cannot
|
In particular, the programmer cannot
|
||||||
rely on the parent remaining blocked until a call of
|
rely on the parent remaining blocked until a call of
|
||||||
.BR execve ()
|
.BR execve (2)
|
||||||
or
|
or
|
||||||
.BR _exit ()
|
.BR _exit (2)
|
||||||
and cannot rely on any specific behaviour w.r.t. shared memory.
|
and cannot rely on any specific behaviour w.r.t. shared memory.
|
||||||
.\" In AIXv3.1 vfork is equivalent to fork.
|
.\" In AIXv3.1 vfork is equivalent to fork.
|
||||||
.SH "LINUX NOTES"
|
.SH "LINUX NOTES"
|
||||||
|
|
|
@ -100,11 +100,11 @@ The application may not modify this memory ever,
|
||||||
.\" FIXME Explain the following line in a little more detail:
|
.\" FIXME Explain the following line in a little more detail:
|
||||||
or page cache and on-disk data may differ.
|
or page cache and on-disk data may differ.
|
||||||
Gifting pages to the kernel means that a subsequent
|
Gifting pages to the kernel means that a subsequent
|
||||||
.BR splice ()
|
.BR splice (2)
|
||||||
.B SPLICE_F_MOVE
|
.B SPLICE_F_MOVE
|
||||||
can successfully move the pages;
|
can successfully move the pages;
|
||||||
if this flag is not specified, then a subsequent
|
if this flag is not specified, then a subsequent
|
||||||
.BR splice ()
|
.BR splice (2)
|
||||||
.B SPLICE_F_MOVE
|
.B SPLICE_F_MOVE
|
||||||
must copy the pages.
|
must copy the pages.
|
||||||
Data must also be properly page aligned, both in memory and length.
|
Data must also be properly page aligned, both in memory and length.
|
||||||
|
|
|
@ -48,7 +48,7 @@
|
||||||
.\"
|
.\"
|
||||||
.TH WAIT 2 2004-11-11 "Linux" "Linux Programmer's Manual"
|
.TH WAIT 2 2004-11-11 "Linux" "Linux Programmer's Manual"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
wait, waitpid \- wait for process to change state
|
wait, waitpid, waitid \- wait for process to change state
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
.B #include <sys/types.h>
|
.B #include <sys/types.h>
|
||||||
.br
|
.br
|
||||||
|
@ -186,9 +186,9 @@ returns the exit status of the child.
|
||||||
This consists of the least significant 8 bits of the
|
This consists of the least significant 8 bits of the
|
||||||
.I status
|
.I status
|
||||||
argument that the child specified in a call to
|
argument that the child specified in a call to
|
||||||
.BR exit ()
|
.BR exit (3)
|
||||||
or
|
or
|
||||||
.BR _exit ()
|
.BR _exit (2)
|
||||||
or as the argument for a return statement in main().
|
or as the argument for a return statement in main().
|
||||||
This macro should only be employed if
|
This macro should only be employed if
|
||||||
.B WIFEXITED
|
.B WIFEXITED
|
||||||
|
|
|
@ -45,7 +45,7 @@ bytes to the file referenced by the file descriptor
|
||||||
.I fd
|
.I fd
|
||||||
from the buffer starting at
|
from the buffer starting at
|
||||||
.IR buf .
|
.IR buf .
|
||||||
POSIX requires that a \fBread\fP() which can be proved to occur after a
|
POSIX requires that a \fBread\fP(2) which can be proved to occur after a
|
||||||
\fBwrite\fP() has returned returns the new data.
|
\fBwrite\fP() has returned returns the new data.
|
||||||
Note that not all file
|
Note that not all file
|
||||||
systems are POSIX conforming.
|
systems are POSIX conforming.
|
||||||
|
|
Loading…
Reference in New Issue