Formatted signal names

This commit is contained in:
Michael Kerrisk 2007-06-21 05:38:48 +00:00
parent 826bc5db80
commit 8bd58774dc
37 changed files with 449 additions and 187 deletions

View File

@ -9,6 +9,7 @@ Contributors
The following people contributed notes, ideas, or patches that have
been incorporated in changes in this release:
Stepan Kasal <kasal@ucw.cz>
Apologies if I missed anyone!
@ -16,6 +17,12 @@ Apologies if I missed anyone!
Global changes
--------------
Many many pages
mtk
Many many formatting fixes
Stepan Kasal
Add section number to .TH line for POSIX pages in man[013]p.
Changes to individual pages

View File

@ -180,7 +180,8 @@ The process name, as set by
.IR "ps \-o comm" ),
is reset to the name of the new executable file.
.IP * 4
The termination signal is reset to SIGCHLD
The termination signal is reset to
.B SIGCHLD
(see
.BR clone (2)).
.PP
@ -195,7 +196,9 @@ is executed at program start-up.
.IP * 4
POSIX.1-2001 specifies that the dispositions of any signals that
are ignored or set to the default are left unchanged.
POSIX.1-2001 specifies one exception: if SIGCHLD is being ignored,
POSIX.1-2001 specifies one exception: if
.B SIGCHLD
is being ignored,
then an implementation may leave the disposition unchanged or
reset it to the default; Linux does the former.
.IP * 4

View File

@ -376,15 +376,21 @@ and
are used to manage I/O availability signals:
.TP
.B F_GETOWN
Get the process ID or process group currently receiving SIGIO
and SIGURG signals for events on file descriptor
Get the process ID or process group currently receiving
.B SIGIO
and
.B SIGURG
signals for events on file descriptor
.IR fd .
Process IDs are returned as positive values;
process group IDs are returned as negative values (but see BUGS below).
.TP
.B F_SETOWN
Set the process ID or process group ID that will receive SIGIO
and SIGURG signals for events on file descriptor
Set the process ID or process group ID that will receive
.B SIGIO
and
.B SIGURG
signals for events on file descriptor
.IR fd .
A process ID is specified as a positive value;
a process group ID is specified as a negative value.
@ -401,10 +407,13 @@ status flag on a file descriptor by using the
.B F_SETFL
command of
.BR fcntl ()),
a SIGIO signal is sent whenever input or output becomes possible
a
.B SIGIO
signal is sent whenever input or output becomes possible
on that file descriptor.
.B F_SETSIG
can be used to obtain delivery of a signal other than SIGIO.
can be used to obtain delivery of a signal other than
.BR SIGIO .
If this permission check fails, then the signal is
silently discarded.
@ -421,9 +430,12 @@ If the file descriptor
refers to a socket,
.B F_SETOWN
also selects
the recipient of SIGURG signals that are delivered when out-of-band
the recipient of
.B SIGURG
signals that are delivered when out-of-band
data arrives on that socket.
(SIGURG is sent in any situation where
.RB ( SIGURG
is sent in any situation where
.BR select (2)
would report the socket as having an "exceptional condition".)
.\" The following appears to be rubbish. It doesn't seem to
@ -465,7 +477,9 @@ or
.BR getpid (2)
in this scenario.)
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
.B SIGURG
signal generated for out-of-band data on a socket:
this signal is always sent to either a process or a process group,
depending on the value given to
.BR F_SETOWN .
@ -480,23 +494,34 @@ process (see
and
.BR signal (7))
and if this limit is reached, then the kernel reverts to
delivering SIGIO, and this signal is delivered to the entire
delivering
.BR SIGIO ,
and this signal is delivered to the entire
process rather than to a specific thread.
.\" See fs/fcntl.c::send_sigio_to_task() (2.4/2.6) sources -- MTK, Apr 05
.TP
.B F_GETSIG
Get the signal sent when input or output becomes possible.
A value of zero means SIGIO is sent.
Any other value (including SIGIO) is the
A value of zero means
.B SIGIO
is sent.
Any other value (including
.BR SIGIO )
is the
signal sent instead, and in this case additional info is available to
the signal handler if installed with SA_SIGINFO.
the signal handler if installed with
.BR SA_SIGINFO .
.TP
.B F_SETSIG
Sets the signal sent when input or output becomes possible.
A value of zero means to send the default SIGIO signal.
A value of zero means to send the default
.B SIGIO
signal.
Any other value (including
SIGIO) is the signal to send instead, and in this case additional info
is available to the signal handler if installed with SA_SIGINFO.
.BR SIGIO )
is the signal to send instead, and in this case additional info
is available to the signal handler if installed with
.BR SA_SIGINFO .
.sp
Additionally, passing a non-zero value to
.B F_SETSIG
@ -508,7 +533,9 @@ for more details.
.sp
By using
.B F_SETSIG
with a non-zero value, and setting SA_SIGINFO for the
with a non-zero value, and setting
.B SA_SIGINFO
for the
signal handler (see
.BR sigaction (2)),
extra information about I/O events is passed to
@ -517,7 +544,9 @@ the handler in a
structure.
If the
.I si_code
field indicates the source is SI_SIGIO, the
field indicates the source is
.BR SI_SIGIO ,
the
.I si_fd
field gives the file descriptor associated with the event.
Otherwise,
@ -530,11 +559,14 @@ with
.B O_NONBLOCK
set etc.) to determine which file descriptors are available for I/O.
.sp
By selecting a real time signal (value >= SIGRTMIN), multiple
I/O events may be queued using the same signal numbers.
By selecting a real time signal (value >=
.BR SIGRTMIN ),
multiple I/O events may be queued using the same signal numbers.
(Queuing is dependent on available memory).
Extra information is available
if SA_SIGINFO is set for the signal handler, as above.
if
.B SA_SIGINFO
is set for the signal handler, as above.
.PP
Using these mechanisms, a program can implement fully asynchronous I/O
without using
@ -627,7 +659,8 @@ that conflicts with a lease established via
.BR F_SETLEASE ,
the system call is blocked by the kernel and
the kernel notifies the lease holder by sending it a signal
(SIGIO by default).
.RB ( SIGIO
by default).
The lease holder should respond to receipt of this signal by doing
whatever cleanup is required in preparation for the file to be
accessed by another process (e.g., flushing cached buffers) and
@ -678,16 +711,20 @@ then the call immediately fails with the error
.BR EWOULDBLOCK ,
but the other steps still occur as described above.
The default signal used to notify the lease holder is SIGIO,
The default signal used to notify the lease holder is
.BR SIGIO ,
but this can be changed using the
.B F_SETSIG
command to
.BR fcntl ().
If a
.B F_SETSIG
command is performed (even one specifying SIGIO), and the signal
handler is established using SA_SIGINFO, then the handler will
receive a
command is performed (even one specifying
.BR SIGIO ),
and the signal
handler is established using
.BR SA_SIGINFO ,
then the handler will receive a
.I siginfo_t
structure as its second argument, and the
.I si_fd
@ -747,14 +784,18 @@ call specifying
as 0.
.sp
Notification occurs via delivery of a signal.
The default signal is SIGIO, but this can be changed using the
The default signal is
.BR SIGIO ,
but this can be changed using the
.B F_SETSIG
command to
.BR fcntl ().
In the latter case, the signal handler receives a
.I siginfo_t
structure as its second argument (if the handler was
established using SA_SIGINFO) and the
established using
.BR SA_SIGINFO )
and the
.I si_fd
field of this structure contains the file descriptor which
generated the notification (useful when establishing notification
@ -790,7 +831,9 @@ Value of descriptor owner.
.TP
.B F_GETSIG
Value of signal sent when read or write becomes possible, or zero
for traditional SIGIO behavior.
for traditional
.B SIGIO
behavior.
.TP
All other commands
Zero.
@ -861,13 +904,30 @@ Attempted to clear the
flag on a file that has the append-only attribute set.
.SH "CONFORMING TO"
SVr4, 4.3BSD, POSIX.1-2001.
Only the operations F_DUPFD,
F_GETFD, F_SETFD, F_GETFL, F_SETFL, F_GETLK, F_SETLK, F_SETLKW,
F_GETOWN, and F_SETOWN are specified in POSIX.1-2001.
Only the operations
.BR F_DUPFD ,
.BR F_GETFD ,
.BR F_SETFD ,
.BR F_GETFL ,
.BR F_SETFL ,
.BR F_GETLK ,
.BR F_SETLK ,
.BR F_SETLKW ,
.BR F_GETOWN ,
and
.BR F_SETOWN
are specified in POSIX.1-2001.
F_GETSIG, F_SETSIG, F_NOTIFY, F_GETLEASE, and F_SETLEASE
.BR F_GETSIG ,
.BR F_SETSIG ,
.BR F_NOTIFY ,
.BR F_GETLEASE ,
and
.BR F_SETLEASE
are Linux specific.
(Define the _GNU_SOURCE macro to obtain these definitions.)
(Define the
.BR _GNU_SOURCE
macro to obtain these definitions.)
.\" .PP
.\" SVr4 documents additional EIO, ENOLINK and EOVERFLOW error conditions.
.SH NOTES

View File

@ -111,7 +111,8 @@ Memory mappings that have been marked with the
flag are not inherited across a
.BR fork (2).
.IP * 4
The termination signal of the child is always SIGCHLD
The termination signal of the child is always
.B SIGCHLD
(see
.BR clone (2)).
.PP

View File

@ -79,7 +79,9 @@ it must either be privileged (under Linux: have the
capability), or the real or effective
user ID of the sending process must equal the real or
saved set-user-ID of the target process.
In the case of SIGCONT it suffices when the sending and receiving
In the case of
.B SIGCONT
it suffices when the sending and receiving
processes belong to the same session.
.SH "RETURN VALUE"
On success (at least one signal was sent), zero is returned.

View File

@ -69,7 +69,9 @@ it must either be privileged (under Linux: have the
capability), or the real or effective
user ID of the sending process must equal the real or
saved set-user-ID of the target process.
In the case of SIGCONT it suffices when the sending and receiving
In the case of
.B SIGCONT
it suffices when the sending and receiving
processes belong to the same session.
.SH "RETURN VALUE"
On success, zero is returned.

View File

@ -231,7 +231,9 @@ that are already present in RAM.
Do not reserve swap space for this mapping.
When swap space is reserved, one has the guarantee
that it is possible to modify the mapping.
When swap space is not reserved one might get SIGSEGV upon a write
When swap space is not reserved one might get
.B SIGSEGV
upon a write
if no physical memory is available.
See also the discussion of the file
.I /proc/sys/vm/overcommit_memory
@ -285,7 +287,8 @@ The address
must be a multiple of the page size.
All pages containing a part
of the indicated range are unmapped, and subsequent references
to these pages will generate SIGSEGV.
to these pages will generate
.BR SIGSEGV .
It is not an error if the
indicated range does not contain any mapped pages.

View File

@ -139,10 +139,13 @@ current 2.4 kernels, but not in 2.6 kernels.
.PP
In Linux 2.4, if
.BR nanosleep ()
is stopped by a signal (e.g., SIGTSTP),
is stopped by a signal (e.g.,
.BR SIGTSTP ),
then the call fails with the error
.BR EINTR
after the process is resumed by a SIGCONT signal.
after the process is resumed by a
.B SIGCONT
signal.
If the system call is subsequently restarted,
then the time that the process spent in the stopped state is
\fInot\fP counted against the sleep interval.

View File

@ -131,7 +131,9 @@ can't be done without a race condition.
.TP
.B O_ASYNC
Enable signal-driven I/O:
generate a signal (SIGIO by default, but this can be changed via
generate a signal
.RB ( SIGIO
by default, but this can be changed via
.BR fcntl (2))
when input or output becomes possible on this file descriptor.
This feature is only available for terminals, pseudo-terminals,

View File

@ -152,7 +152,9 @@ or
Set unaligned access control bits to \fIarg2\fP.
Pass
\fBPR_UNALIGN_NOPRINT\fP to silently fix up unaligned user accesses,
or \fBPR_UNALIGN_SIGBUS\fP to generate SIGBUS on unaligned user access.
or \fBPR_UNALIGN_SIGBUS\fP to generate
.B SIGBUS
on unaligned user access.
.TP
.B PR_GET_UNALIGN
(Since Linux 2.3.48, only on parisc and ia64)
@ -162,7 +164,9 @@ Get unaligned access control bits from \fIarg2\fP.
(Since Linux 2.4.18, 2.5.9, only on ia64)
Set floating-point emulation control bits to \fIarg2\fP.
Pass \fBPR_FPEMU_NOPRINT\fP to silently emulate fp operations accesses, or
\fBPR_FPEMU_SIGFPE\fP to not emulate fp operations and send SIGFPE instead.
\fBPR_FPEMU_SIGFPE\fP to not emulate fp operations and send
.B SIGFPE
instead.
.TP
.B PR_GET_FPEMU
(Since Linux 2.4.18, 2.5.9, only on ia64)

View File

@ -61,15 +61,18 @@ call tracing.
.LP
The parent can initiate a trace by calling
.BR fork (2)
and having the resulting child do a PTRACE_TRACEME,
and having the resulting child do a
.BR PTRACE_TRACEME ,
followed (typically) by an
.BR exec (3).
Alternatively, the parent may commence trace of an existing process using
PTRACE_ATTACH.
.BR PTRACE_ATTACH .
.LP
While being traced, the child will stop each time a signal is delivered,
even if the signal is being ignored.
(The exception is SIGKILL, which has its usual effect.)
(The exception is
.BR SIGKILL ,
which has its usual effect.)
The parent will be notified at its next
.BR wait (2)
and may inspect and modify the child process while it is stopped.
@ -78,20 +81,26 @@ optionally ignoring the delivered signal
(or even delivering a different signal instead).
.LP
When the parent is finished tracing, it can terminate the child with
PTRACE_KILL or cause it to continue executing in a normal, untraced mode
via PTRACE_DETACH.
.B PTRACE_KILL
or cause it to continue executing in a normal, untraced mode
via
.BR PTRACE_DETACH .
.LP
The value of \fIrequest\fP determines the action to be performed:
.TP
PTRACE_TRACEME
.B PTRACE_TRACEME
Indicates that this process is to be traced by its parent.
Any signal
(except SIGKILL) delivered to this process will cause it to stop and its
(except
.BR SIGKILL )
delivered to this process will cause it to stop and its
parent to be notified via
.BR wait (2).
Also, all subsequent calls to
.BR execve (2)
by this process will cause a SIGTRAP to be sent to it,
by this process will cause a
.B SIGTRAP
to be sent to it,
giving the parent a chance to gain control before the new program
begins execution.
A process probably shouldn't make this request if its parent
@ -102,10 +111,12 @@ The above request is used only by the child process;
the rest are used only by the parent.
In the following requests, \fIpid\fP specifies the child process
to be acted on.
For requests other than PTRACE_KILL, the child process must
For requests other than
.BR PTRACE_KILL ,
the child process must
be stopped.
.TP
PTRACE_PEEKTEXT, PTRACE_PEEKDATA
.BR PTRACE_PEEKTEXT ", " PTRACE_PEEKDATA
Reads a word at the location
.IR addr
in the child's memory, returning the word as the result of the
@ -115,12 +126,11 @@ Linux does not have separate text and data address spaces, so the two
requests are currently equivalent.
(The argument \fIdata\fP is ignored.)
.TP
PTRACE_PEEKUSR
.B PTRACE_PEEKUSR
Reads a word at offset
.I addr
in the child's
.B USER
area, which holds the registers and other information about the process
in the child's USER area,
which holds the registers and other information about the process
(see \fI<linux/user.h>\fP and <sys/user.h>).
The word is returned as the result of the
.BR ptrace ()
@ -128,7 +138,7 @@ call.
Typically the offset must be word-aligned, though this might vary by
architecture. (\fIdata\fP is ignored.)
.TP
PTRACE_POKETEXT, PTRACE_POKEDATA
.BR PTRACE_POKETEXT ", " PTRACE_POKEDATA
Copies the word
.IR data
to location
@ -136,41 +146,39 @@ to location
in the child's memory.
As above, the two requests are currently equivalent.
.TP
PTRACE_POKEUSR
.B PTRACE_POKEUSR
Copies the word
.IR data
to offset
.I addr
in the child's
.B USER
area.
in the child's USER area.
As above, the offset must typically be word-aligned.
In order to maintain the integrity of the kernel,
some modifications to the
.B USER
area are disallowed.
some modifications to the USER area are disallowed.
.TP
PTRACE_GETREGS, PTRACE_GETFPREGS
.BR PTRACE_GETREGS ", " PTRACE_GETFPREGS
Copies the child's general purpose or floating-point registers,
respectively, to location \fIdata\fP in the parent.
See \fI<linux/user.h>\fP for information on
the format of this data. (\fIaddr\fP is ignored.)
.TP
PTRACE_GETSIGINFO (since Linux 2.3.99-pre6)
.BR PTRACE_GETSIGINFO " (since Linux 2.3.99-pre6)"
Retrieve information about the signal that caused the stop.
Copies a \fIsiginfo_t\fP structure (see
.BR sigaction (2))
from the child to location \fIdata\fP in the parent.
(\fIaddr\fP is ignored.)
.TP
PTRACE_SETREGS, PTRACE_SETFPREGS
.BR PTRACE_SETREGS " , " PTRACE_SETFPREGS
Copies the child's general purpose or floating-point registers,
respectively, from location \fIdata\fP in the parent.
As for PTRACE_POKEUSER, some general
As for
.BR PTRACE_POKEUSER ,
some general
purpose register modifications may be disallowed.
(\fIaddr\fP is ignored.)
.TP
PTRACE_SETSIGINFO (since Linux 2.3.99-pre6)
.BR PTRACE_SETSIGINFO " (since Linux 2.3.99-pre6)"
Set signal information.
Copies a \fIsiginfo_t\fP structure from location \fIdata\fP in the
parent to the child.
@ -181,65 +189,84 @@ these normal signals from synthetic signals generated by
.BR ptrace ()
itself. (\fIaddr\fP is ignored.)
.TP
PTRACE_SETOPTIONS (since Linux 2.4.6; see BUGS for caveats)
.BR PTRACE_SETOPTIONS " (since Linux 2.4.6; see BUGS for caveats)"
Sets ptrace options from \fIdata\fP in the parent.
(\fIaddr\fP is ignored.)
\fIdata\fP is interpreted
as a bitmask of options, which are specified by the following flags:
.RS
.TP
PTRACE_O_TRACESYSGOOD (since Linux 2.4.6)
.BR PTRACE_O_TRACESYSGOOD " (since Linux 2.4.6)"
When delivering syscall traps, set bit 7 in the signal number
(i.e., deliver (SIGTRAP | 0x80)
(i.e., deliver \fI(SIGTRAP | 0x80)\fP
This makes it easy for the tracer to tell the difference
between normal traps and those caused by a syscall.
(PTRACE_O_TRACESYSGOOD may not work on all architectures.)
.RB ( PTRACE_O_TRACESYSGOOD
may not work on all architectures.)
.TP
PTRACE_O_TRACEFORK (since Linux 2.5.46)
.BR PTRACE_O_TRACEFORK " (since Linux 2.5.46)"
Stop the child at the next
.BR fork (2)
call with SIGTRAP | PTRACE_EVENT_FORK << 8 and automatically
call with \fISIGTRAP | PTRACE_EVENT_FORK\ <<\ 8\fP and automatically
start tracing the newly forked process,
which will start with a SIGSTOP.
The PID for the new process can be retrieved with PTRACE_GETEVENTMSG.
which will start with a
.BR SIGSTOP .
The PID for the new process can be retrieved with
.BR PTRACE_GETEVENTMSG .
.TP
PTRACE_O_TRACEVFORK (since Linux 2.5.46)
.BR PTRACE_O_TRACEVFORK " (since Linux 2.5.46)"
Stop the child at the next
.BR vfork (2)
call with SIGTRAP | PTRACE_EVENT_VFORK << 8 and automatically start
tracing the newly vforked process, which will start with a SIGSTOP.
The PID for the new process can be retrieved with PTRACE_GETEVENTMSG.
call with \fISIGTRAP | PTRACE_EVENT_VFORK\ <<\ 8\fP and automatically start
tracing the newly vforked process, which will start with a
.BR SIGSTOP .
The PID for the new process can be retrieved with
.BR PTRACE_GETEVENTMSG .
.TP
PTRACE_O_TRACECLONE (since Linux 2.5.46)
.BR PTRACE_O_TRACECLONE " (since Linux 2.5.46)"
Stop the child at the next
.BR clone (2)
call with SIGTRAP | PTRACE_EVENT_CLONE << 8 and automatically start
tracing the newly cloned process, which will start with a SIGSTOP.
The PID for the new process can be retrieved with PTRACE_GETEVENTMSG.
call with \fISIGTRAP | PTRACE_EVENT_CLONE\ <<\ 8\fP and automatically start
tracing the newly cloned process, which will start with a
.BR SIGSTOP .
The PID for the new process can be retrieved with
.BR PTRACE_GETEVENTMSG .
This option may not catch
.BR clone (2)
calls in all cases.
If the child calls
.BR clone (2)
with the CLONE_VFORK flag, PTRACE_EVENT_VFORK will be delivered instead
if PTRACE_O_TRACEVFORK is set; otherwise if the child calls
with the
.BR CLONE_VFORK
flag,
.B PTRACE_EVENT_VFORK
will be delivered instead
if
.B PTRACE_O_TRACEVFORK
is set; otherwise if the child calls
.BR clone (2)
with the exit signal set to SIGCHLD, PTRACE_EVENT_FORK will be delivered
if PTRACE_O_TRACEFORK is set.
with the exit signal set to
.BR SIGCHLD ,
.B PTRACE_EVENT_FORK
will be delivered
if
.B PTRACE_O_TRACEFORK
is set.
.TP
PTRACE_O_TRACEEXEC (since Linux 2.5.46)
.BR PTRACE_O_TRACEEXEC " (since Linux 2.5.46)"
Stop the child at the next
.BR execve (2)
call with SIGTRAP | PTRACE_EVENT_EXEC << 8.
call with \fISIGTRAP | PTRACE_EVENT_EXEC\ <<\ 8\fP.
.TP
PTRACE_O_TRACEVFORKDONE (since Linux 2.5.60)
.BR PTRACE_O_TRACEVFORKDONE " (since Linux 2.5.60)"
Stop the child at the completion of the next
.BR vfork (2)
call with SIGTRAP | PTRACE_EVENT_VFORK_DONE << 8.
call with \fISIGTRAP | PTRACE_EVENT_VFORK_DONE\ <<\ 8\fP.
.TP
PTRACE_O_TRACEEXIT (since Linux 2.5.60)
Stop the child at exit with SIGTRAP | PTRACE_EVENT_EXIT << 8.
The child's exit status can be retrieved with PTRACE_GETEVENTMSG.
.BR PTRACE_O_TRACEEXIT " (since Linux 2.5.60)"
Stop the child at exit with \fISIGTRAP | PTRACE_EVENT_EXIT\ <<\ 8\fP.
The child's exit status can be retrieved with
.BR PTRACE_GETEVENTMSG .
This stop will be done early during process exit when registers
are still available, allowing the tracer to see where the exit occurred,
whereas the normal exit notification is done after the process
@ -248,59 +275,82 @@ Even though context is available, the tracer cannot prevent the exit from
happening at this point.
.RE
.TP
PTRACE_GETEVENTMSG (since Linux 2.5.46)
.BR PTRACE_GETEVENTMSG " (since Linux 2.5.46)"
Retrieve a message (as an
.IR "unsigned long" )
about the ptrace event
that just happened, placing it in the location \fIdata\fP in the parent.
For PTRACE_EVENT_EXIT this is the child's exit status.
For PTRACE_EVENT_FORK, PTRACE_EVENT_VFORK and PTRACE_EVENT_CLONE this
For
.BR PTRACE_EVENT_EXIT
this is the child's exit status.
For
.BR PTRACE_EVENT_FORK ,
.BR PTRACE_EVENT_VFORK
and
.B PTRACE_EVENT_CLONE
this
is the PID of the new process.
Since Linux 2.6.18, the PID of the new process is also available
for PTRACE_EVENT_VFORK_DONE.
for
.BR PTRACE_EVENT_VFORK_DONE .
(\fIaddr\fP is ignored.)
.TP
PTRACE_CONT
.B PTRACE_CONT
Restarts the stopped child process.
If \fIdata\fP is non-zero and not
SIGSTOP, it is interpreted as a signal to be delivered to the child;
.BR SIGSTOP ,
it is interpreted as a signal to be delivered to the child;
otherwise, no signal is delivered.
Thus, for example, the parent can control
whether a signal sent to the child is delivered or not.
(\fIaddr\fP is ignored.)
.TP
PTRACE_SYSCALL, PTRACE_SINGLESTEP
Restarts the stopped child as for PTRACE_CONT, but arranges for
.BR PTRACE_SYSCALL ", " PTRACE_SINGLESTEP
Restarts the stopped child as for
.BR PTRACE_CONT ,
but arranges for
the child to be stopped at the next entry to or exit from a system call,
or after execution of a single instruction, respectively.
(The child will also, as usual, be stopped upon receipt of a signal.)
From the parent's perspective, the child will appear to have been
stopped by receipt of a SIGTRAP.
So, for PTRACE_SYSCALL, for example, the idea is to inspect
stopped by receipt of a
.BR SIGTRAP .
So, for
.BR PTRACE_SYSCALL ,
for example, the idea is to inspect
the arguments to the system call at the first stop,
then do another PTRACE_SYSCALL and inspect the return value of
then do another
.B PTRACE_SYSCALL
and inspect the return value of
the system call at the second stop.
(\fIaddr\fP is ignored.)
.TP
PTRACE_SYSEMU, PTRACE_SYSEMU_SINGLESTEP (since Linux 2.6.14)
For PTRACE_SYSEMU, continue and stop on entry to the next syscall,
.BR PTRACE_SYSEMU " , " PTRACE_SYSEMU_SINGLESTEP " (since Linux 2.6.14)"
For
.BR PTRACE_SYSEMU ,
continue and stop on entry to the next syscall,
which will not be executed.
For PTRACE_SYSEMU_SINGLESTEP, do the same
For
.BR PTRACE_SYSEMU_SINGLESTEP ,
do the same
but also singlestep if not a syscall.
This call is used by programs like
User Mode Linux that want to emulate all the child's system calls.
(\fIaddr\fP and \fIdata\fP are ignored;
not supported on all architectures.)
.TP
PTRACE_KILL
Sends the child a SIGKILL to terminate it.
.B PTRACE_KILL
Sends the child a
.B SIGKILL
to terminate it.
(\fIaddr\fP and \fIdata\fP are ignored.)
.TP
PTRACE_ATTACH
.B PTRACE_ATTACH
Attaches to the process specified in
.IR pid ,
making it a traced "child" of the current process;
the behavior of the child is as if it had done a PTRACE_TRACEME.
the behavior of the child is as if it had done a
.BR PTRACE_TRACEME .
The current process actually becomes the parent of the child
process for most purposes (e.g., it will receive
notification of child events and appears in
@ -308,27 +358,36 @@ notification of child events and appears in
output as the child's parent), but a
.BR getppid (2)
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
.BR SIGSTOP ,
but will not necessarily have stopped
by the completion of this call; use
.BR wait (2)
to wait for the child to stop.
(\fIaddr\fP and \fIdata\fP are ignored.)
.TP
PTRACE_DETACH
Restarts the stopped child as for PTRACE_CONT, but first detaches
from the process, undoing the reparenting effect of PTRACE_ATTACH,
and the effects of PTRACE_TRACEME.
.B PTRACE_DETACH
Restarts the stopped child as for
.BR PTRACE_CONT ,
but first detaches
from the process, undoing the reparenting effect of
.BR PTRACE_ATTACH ,
and the effects of
.BR PTRACE_TRACEME .
Although perhaps not intended, under Linux a traced child can be
detached in this way regardless of which method was used to initiate
tracing.
(\fIaddr\fP is ignored.)
.SH "RETURN VALUE"
On success, PTRACE_PEEK* requests return the requested data,
On success,
.BR PTRACE_PEEK*
requests return the requested data,
while other requests return zero.
On error, all requests return \-1, and
.I errno
is set appropriately.
Since the value returned by a successful PTRACE_PEEK*
Since the value returned by a successful
.BR PTRACE_PEEK*
request may be \-1, the caller must check
.I errno
after such requests to determine whether or not an error occurred.
@ -394,20 +453,25 @@ The size of a "word" is determined by the OS variant
.LP
Tracing causes a few subtle differences in the semantics of
traced processes.
For example, if a process is attached to with PTRACE_ATTACH,
For example, if a process is attached to with
.BR PTRACE_ATTACH ,
its original parent can no longer receive notification via
.BR wait (2)
when it stops, and there is no way for the new parent to
effectively simulate this notification.
.LP
When the parent receives an event with PTRACE_EVENT_* set,
When the parent receives an event with
.BR PTRACE_EVENT_*
set,
the child is not in the normal signal delivery path.
This means the parent cannot do
.BR ptrace (PTRACE_CONT)
with a signal or
.BR ptrace (PTRACE_KILL).
.BR kill (2)
with a SIGKILL signal can be used instead to kill the child process
with a
.BR SIGKILL
signal can be used instead to kill the child process
after receiving one of these messages.
.LP
This page documents the way the
@ -426,12 +490,17 @@ present in Solaris 2 implements a superset of
.BR ptrace ()
functionality in a more powerful and uniform way.
.SH BUGS
On hosts with 2.6 kernel headers, PTRACE_SETOPTIONS is declared
On hosts with 2.6 kernel headers,
.BR PTRACE_SETOPTIONS
is declared
with a different value than the one for 2.4.
This leads to applications compiled with such
headers failing when run on 2.4 kernels.
This can be worked around by redefining PTRACE_SETOPTIONS to
PTRACE_OLDSETOPTIONS, if that is defined.
This can be worked around by redefining
.BR PTRACE_SETOPTIONS
to
.BR PTRACE_OLDSETOPTIONS ,
if that is defined.
.SH "SEE ALSO"
.BR gdb (1),
.BR strace (1),

View File

@ -105,7 +105,9 @@ or the current file offset is not suitably aligned.
I/O error.
This will happen for example when the process is in a
background process group, tries to read from its controlling tty,
and either it is ignoring or blocking SIGTTIN or its process group
and either it is ignoring or blocking
.B SIGTTIN
or its process group
is orphaned.
It may also occur when there is a low-level I/O error
while reading from a disk or tape.

View File

@ -111,7 +111,9 @@ the action associated with LINUX_REBOOT_CMD_RESTART.
.B LINUX_REBOOT_CMD_CAD_OFF
(RB_DISABLE_CAD, 0).
CAD is disabled.
This means that the CAD keystroke will cause a SIGINT signal to be
This means that the CAD keystroke will cause a
.B SIGINT
signal to be
sent to init (process 1), whereupon this process may decide upon a
proper action (maybe: kill all processes, sync, reboot).
.LP

View File

@ -111,14 +111,20 @@ calls described in
are used to get/set the process group of the control terminal.
If a session has a controlling terminal, CLOCAL is not set and a hangup
occurs, then the session leader is sent a SIGHUP.
occurs, then the session leader is sent a
.BR SIGHUP .
If the session leader
exits, the SIGHUP signal will be sent to each process in the foreground
exits, the
.B SIGHUP
signal will be sent to each process in the foreground
process group of the controlling terminal.
If the exit of the process causes a process group to become orphaned,
and if any member of the newly-orphaned process group is stopped, then a
SIGHUP signal followed by a SIGCONT signal will be sent to each process
.B SIGHUP
signal followed by a
.B SIGCONT
signal will be sent to each process
in the newly-orphaned process group.
.SH "RETURN VALUE"
On success,

View File

@ -124,7 +124,9 @@ flag.
Do not reserve swap space for this segment.
When swap space is reserved, one has the guarantee
that it is possible to modify the segment.
When swap space is not reserved one might get SIGSEGV upon a write
When swap space is not reserved one might get
.B SIGSEGV
upon a write
if no physical memory is available.
See also the discussion of the file
.I /proc/sys/vm/overcommit_memory

View File

@ -402,7 +402,8 @@ Integer division by zero has undefined result.
On some architectures it will generate a
.B SIGFPE
signal.
(Also dividing the most negative integer by \-1 may generate SIGFPE.)
(Also dividing the most negative integer by \-1 may generate
.BR SIGFPE .)
Ignoring this signal might lead to an endless loop.
.PP
POSIX.1-1990 disallowed setting the action for

View File

@ -150,7 +150,9 @@ is defined, also
.SS Portability
The original Unix
.BR signal ()
would reset the handler to SIG_DFL, and System V
would reset the handler to
.BR SIG_DFL ,
and System V
(and the Linux kernel and libc4,5) does the same.
On the other hand, BSD does not reset the handler, but blocks
new instances of this signal from occurring during a call of the handler.

View File

@ -48,7 +48,10 @@ returns after the signal handler returns,
and the signal mask is restored to the state before the call to
.BR sigsuspend ().
It is not possible to block SIGKILL or SIGSTOP;
It is not possible to block
.B SIGKILL
or
.BR SIGSTOP ;
specifying these signals in
.IR mask ,
has no effect on the process's signal mask.

View File

@ -174,7 +174,11 @@ The BSD man page states:
"To avoid a possible deadlock situation, processes that are children
in the middle of a
.BR vfork ()
are never sent SIGTTOU or SIGTTIN signals; rather, output or
are never sent
.B SIGTTOU
or
.B SIGTTIN
signals; rather, output or
.IR ioctl s
are allowed and input attempts result in an end-of-file indication."
.\"

View File

@ -382,8 +382,10 @@ and
.I id
.RB ( waitid ())
does not exist or is not a child of the calling process.
(This can happen for one's own child if the action for SIGCHLD
is set to SIG_IGN.
(This can happen for one's own child if the action for
.B SIGCHLD
is set to
.BR SIG_IGN .
See also the \fILinux Notes\fP section about threads.)
.TP
.B EINTR

View File

@ -40,13 +40,17 @@ abort \- cause abnormal program termination
The
.BR abort ()
function causes abnormal program termination unless
the signal SIGABRT is caught and the signal handler does not return.
the signal
.B SIGABRT
is caught and the signal handler does not return.
If the
.BR abort ()
function causes program termination, all open
streams are closed and flushed.
.PP
If the SIGABRT signal is blocked or ignored, the
If the
.B SIGABRT
signal is blocked or ignored, the
.BR abort ()
function will still override it.
.SH "RETURN VALUE"

View File

@ -95,7 +95,11 @@ calls either
or
.BR longjmp (3).
.LP
The use of EXIT_SUCCESS and EXIT_FAILURE is slightly more portable
The use of
.B EXIT_SUCCESS
and
.B EXIT_FAILURE
is slightly more portable
(to non-Unix environments) than the use of 0 and some non-zero value
like 1 or \-1.
In particular, VMS uses a different convention.
@ -109,8 +113,12 @@ the exit status must be transmitted to the
parent process.
There are three cases.
If the parent has set
SA_NOCLDWAIT, or has set the SIGCHLD handler to SIG_IGN, the
status is discarded.
.BR SA_NOCLDWAIT ,
or has set the
.B SIGCHLD
handler to
.BR SIG_IGN ,
the status is discarded.
If the parent was waiting on the child
it is notified of the exit status.
In both cases the exiting
@ -124,21 +132,32 @@ it later calls one of the
.BR wait (2)
functions.
.LP
If the implementation supports the SIGCHLD signal, this signal
If the implementation supports the
.BR SIGCHLD
signal, this signal
is sent to the parent.
If the parent has set SA_NOCLDWAIT,
it is undefined whether a SIGCHLD signal is sent.
If the parent has set
.BR SA_NOCLDWAIT ,
it is undefined whether a
.B SIGCHLD
signal is sent.
.LP
If the process is a session leader and its controlling terminal
is the controlling terminal of the session, then each process in
the foreground process group of this controlling terminal
is sent a SIGHUP signal, and the terminal is disassociated
is sent a
.B SIGHUP
signal, and the terminal is disassociated
from this session, allowing it to be acquired by a new controlling
process.
.LP
If the exit of the process causes a process group to become orphaned,
and if any member of the newly orphaned process group is stopped,
then a SIGHUP signal followed by a SIGCONT signal will be
then a
.B SIGHUP
signal followed by a
.B SIGCONT
signal will be
sent to each process in this process group.
.SH "SEE ALSO"
.BR _exit (2),

View File

@ -76,8 +76,12 @@ cannot be opened, the password is read from
.IR stdin .
The static buffer has length 128 so that only the first 127
bytes of the password are returned.
While reading the password, signal generation (SIGINT, SIGQUIT,
SIGSTOP, SIGTSTOP) is disabled and the corresponding characters
While reading the password, signal generation
.RB (SIGINT ,
.BR SIGQUIT ,
.BR SIGSTOP ,
.BR SIGTSTOP )
is disabled and the corresponding characters
(usually control-C, control-\e, control-Z and control-Y)
are transmitted as part of the password.
Since libc 5.4.19 also line editing is disabled, so that also

View File

@ -24,7 +24,9 @@ The mode of the slave is set to 0620 (crw\-\-w\-\-\-\-).
.PP
The behavior of
.BR grantpt ()
is unspecified if a signal handler is installed to catch SIGCHLD signals.
is unspecified if a signal handler is installed to catch
.B SIGCHLD
signals.
.SH "RETURN VALUE"
When successful,
.BR grantpt ()

View File

@ -53,17 +53,24 @@ number
.I signum
is raised using the function
.BR gsignal (),
and returns the previous such action or SIG_DFL.
and returns the previous such action or
.BR SIG_DFL .
The function
.BR gsignal ()
does the following: if no action (or the action SIG_DFL) was
does the following: if no action (or the action
.BR SIG_DFL )
was
specified for
.IR signum ,
then it does nothing and returns 0.
If the action SIG_IGN was specified for
If the action
.BR SIG_IGN
was specified for
.IR signum ,
then it does nothing and returns 1.
Otherwise, it resets the action to SIG_DFL and calls
Otherwise, it resets the action to
.BR SIG_DFL
and calls
the action function with parameter
.IR signum ,
and returns the value returned by that function.

View File

@ -66,7 +66,9 @@ flag of
Out-of-band data is only supported on some stream socket protocols.
.BR sockatmark ()
can safely be called from a handler for the SIGURG signal.
can safely be called from a handler for the
.B SIGURG
signal.
.BR sockatmark ()
is implemented using the
@ -78,8 +80,9 @@ Prior to glibc 2.4,
.BR sockatmark ()
did not work.
.SH EXAMPLE
The following code can be used after receipt of a SIGURG signal
to read (and discard) all data up to the mark,
The following code can be used after receipt of a
.B SIGURG
signal to read (and discard) all data up to the mark,
and then read the byte of data at the mark:
.nf

View File

@ -87,7 +87,10 @@ etc.) are made available when including
.PP
As mentioned,
.BR system ()
ignores SIGINT and SIGQUIT.
ignores
.B SIGINT
and
.BR SIGQUIT .
This may make programs that call it
from a loop uninterruptible, unless they take care themselves
to check the exit status of the child.

View File

@ -52,8 +52,11 @@ the same session as the calling process.
If
.BR tcsetpgrp ()
is called by a member of a background process group in its session,
and the calling process is not blocking or ignoring SIGTTOU,
a SIGTTOU signal is sent to all members of this background process group.
and the calling process is not blocking or ignoring
.BR SIGTTOU ,
a
.B SIGTTOU
signal is sent to all members of this background process group.
.SH "RETURN VALUE"
When
.I fd

View File

@ -362,12 +362,18 @@ the DISCARD character.
[requires _BSD_SOURCE or _SVID_SOURCE]
.TP
.B NOFLSH
Disable flushing the input and output queues when generating the SIGINT,
SIGQUIT and SIGSUSP signals.
Disable flushing the input and output queues when generating the
.BR SIGINT ,
.BR SIGQUIT ,
and
.B SIGSUSP
signals.
.\" Stevens lets SIGSUSP only flush the input queue
.TP
.B TOSTOP
Send the SIGTTOU signal to the process group of a background process
Send the
.B SIGTTOU
signal to the process group of a background process
which tries to write to its controlling terminal.
.TP
.B PENDIN
@ -389,13 +395,17 @@ The symbolic indices (initial values) and meaning are:
.B VINTR
(003, ETX, Ctrl-C, or also 0177, DEL, rubout)
Interrupt character.
Send a SIGINT signal.
Send a
.B SIGINT
signal.
Recognized when ISIG is set, and then not passed as input.
.TP
.B VQUIT
(034, FS, Ctrl-\e)
Quit character.
Send SIGQUIT signal.
Send
.BR SIGQUIT
signal.
Recognized when ISIG is set, and then not passed as input.
.TP
.B VERASE
@ -457,13 +467,17 @@ Recognized when IXON is set, and then not passed as input.
.B VSUSP
(032, SUB, Ctrl-Z)
Suspend character.
Send SIGTSTP signal.
Send
.B SIGTSTP
signal.
Recognized when ISIG is set, and then not passed as input.
.TP
.B VDSUSP
(not in POSIX; not supported under Linux; 031, EM, Ctrl-Y)
Delayed suspend character:
send SIGTSTP signal when the character is read by the user program.
send
.B SIGTSTP
signal when the character is read by the user program.
Recognized when IEXTEN and ISIG are set, and the system supports
job control, and then not passed as input.
.TP

View File

@ -33,19 +33,24 @@ ualarm \- schedule signal after given number of microseconds
.SH DESCRIPTION
The
.BR ualarm ()
function causes the signal SIGALRM to be sent
to the invoking process after (not less than)
function causes the signal
.B SIGALRM
to be sent to the invoking process after (not less than)
.I usecs
microseconds.
The delay may be lengthened slightly by any system activity
or by the time spent processing the call or by the
granularity of system timers.
.LP
Unless caught or ignored, the SIGALRM signal will terminate the process.
Unless caught or ignored, the
.B SIGALRM
signal will terminate the process.
.LP
If the
.I interval
argument is non-zero, further SIGALRM signals will be sent every
argument is non-zero, further
.B SIGALRM
signals will be sent every
.I interval
microseconds after the first.
.SH "RETURN VALUE"

View File

@ -91,8 +91,9 @@ Use
.fi
.RE
.LP
The interaction of this function with the SIGALRM signal, and with
other timer functions such as
The interaction of this function with the
.B SIGALRM
signal, and with other timer functions such as
.BR alarm (2),
.BR sleep (3),
.BR nanosleep (2),

View File

@ -41,7 +41,11 @@ request \fBTIOCNOTTY\fP is supported.
Detach the current process from its controlling terminal.
.sp
If the process is the session leader,
then SIGHUP and SIGCONT signals are sent to the foreground process group
then
.B SIGHUP
and
.B SIGCONT
signals are sent to the foreground process group
and all processes in the current session lose their controlling tty.
.sp
This

View File

@ -101,7 +101,9 @@ struct winsize {
};
.fi
When the window size changes, a SIGWINCH signal is sent to the
When the window size changes, a
.B SIGWINCH
signal is sent to the
foreground process group.
.SS "Sending a Break"
.TP
@ -215,7 +217,11 @@ it as controlling tty lose it.
If the given tty was the controlling tty of the current process,
give up this controlling tty.
If the process was session leader,
then send SIGHUP and SIGCONT to the foreground process group
then send
.B SIGHUP
and
.B SIGCONT
to the foreground process group
and all processes in the current session lose their controlling tty.
.SS "Process group and session ID"
.TP

View File

@ -408,8 +408,9 @@ This value is hard coded to 0 as a placeholder for a removed field.
.TP
\fIitrealvalue\fP %ld
.\" FIXME . does this field disappear in 2.6.17-rc1?
The time in jiffies before the next SIGALRM is sent to the process
due to an interval timer.
The time in jiffies before the next
.B SIGALRM
is sent to the process due to an interval timer.
.TP
\fIstarttime\fP %lu
The time in jiffies the process started after system boot.

View File

@ -47,7 +47,8 @@ that uses both ends of the connection in order to communicate
with itself should be very careful to avoid deadlocks.
.SH NOTES
When a process tries to write to a FIFO that is not opened
for read on the other side, the process is sent a SIGPIPE
for read on the other side, the process is sent a
.B SIGPIPE
signal.
FIFO special files can be created by

View File

@ -146,7 +146,11 @@ This thread handles thread creation and termination.
.IP \- 3
Signals are used internally by the implementation.
On Linux 2.2 and later, the first three real-time signals are used.
On older Linux kernels, SIGUSR1 and SIGUSR2 are used.
On older Linux kernels,
.B SIGUSR1
and
.B SIGUSR2
are used.
Applications must avoid the use of whichever set of signals is
employed by the implementation.
.IP \- 3

View File

@ -37,7 +37,8 @@ then be driven by a program that has opened the master end.
Anything that is written on the master end is provided to the process
on the slave end as though it was input typed on a terminal.
For example, writing the interrupt character (usually control-C)
to the master device would cause an interrupt signal (SIGINT)
to the master device would cause an interrupt signal
.RB ( SIGINT )
to be generated for the foreground process group
that is connected to the slave.
Conversely, anything that is written to the slave end of the