Rewrote various parts.

This commit is contained in:
Michael Kerrisk 2007-05-27 21:33:14 +00:00
parent bc0d5df316
commit 218d23e5a3
1 changed files with 36 additions and 23 deletions

View File

@ -1,4 +1,5 @@
.\" Copyright (c) 2000 Andries Brouwer <aeb@cwi.nl> .\" Copyright (c) 2000 Andries Brouwer <aeb@cwi.nl>
.\" and Copyrigh (c) 2007 Michael Kerrisk <mtk-manpages@gmx.net>
.\" based on work by Rik Faith <faith@cs.unc.edu> .\" based on work by Rik Faith <faith@cs.unc.edu>
.\" and Mike Battersby <mike@starbug.apana.org.au>. .\" and Mike Battersby <mike@starbug.apana.org.au>.
.\" .\"
@ -24,7 +25,8 @@
.\" .\"
.\" Modified 2004-11-19, mtk: .\" Modified 2004-11-19, mtk:
.\" added pointer to sigaction.2 for details of ignoring SIGCHLD .\" added pointer to sigaction.2 for details of ignoring SIGCHLD
.\" 2007-06-03, mtk: strengthened portability warning. .\" 2007-06-03, mtk: strengthened portability warning, and rerote
.\" various sections.
.\" .\"
.TH SIGNAL 2 2007-06-03 "Linux" "Linux Programmer's Manual" .TH SIGNAL 2 2007-06-03 "Linux" "Linux Programmer's Manual"
.SH NAME .SH NAME
@ -45,39 +47,43 @@ and has also varied historically across different versions of Linux.
instead. instead.
See \fIPortability\fP below. See \fIPortability\fP below.
The
.BR signal () .BR signal ()
system call installs a new signal handler for the signal with number sets the disposition of the signal
.IR signum . .IR signum
The signal handler is set to to
.I handler .IR handler ,
which may be a user specified function, or either which is either
.B SIG_IGN .BR SIG_IGN ,
or .BR SIG_DFL ,
.BR SIG_DFL . or the address of a programmer-defined function (a "signal handler"),
Upon arrival of a signal with number If the signal
.I signum .I signum
the following happens. is delivered to the process, then one of the following happens:
If the corresponding handler is set to .TP 3
*
If the disposition is set to
.BR SIG_IGN , .BR SIG_IGN ,
then the signal is ignored. then the signal is ignored.
If the handler is set to .TP
*
If the disposition is set to
.BR SIG_DFL , .BR SIG_DFL ,
then the default action associated with the signal (see then the default action associated with the signal (see
.BR signal (7)) .BR signal (7))
occurs. occurs.
Finally, if the handler is set to a function .TP
.I handler *
then first either the handler is reset to SIG_DFL If the disposition is set to a function,
or an implementation-dependent blocking of the signal then first either the disposition is reset to
is performed, and then .BR SIG_DFL ,
or the signal is blocked (see \fIPortability\fP below), and then
.I handler .I handler
is called with argument is called with argument
.IR signum . .IR signum .
If invokation of the handler caused the signal to be blocked,
Using a signal handler function for a signal then the signal is unblocked upon return from the handler.
is called "catching the signal". .PP
The signals The signals
.B SIGKILL .B SIGKILL
and and
@ -88,10 +94,17 @@ cannot be caught or ignored.
returns the previous value of the signal handler, or returns the previous value of the signal handler, or
.B SIG_ERR .B SIG_ERR
on error. on error.
.SH ERRORS
.TP
.B EINVAL
.I signum
is invalid.
.SH "CONFORMING TO" .SH "CONFORMING TO"
C89, C99, POSIX.1-2001. C89, C99, POSIX.1-2001.
.SH NOTES .SH NOTES
The effects of this call in a multi-threaded process are unspecified. The effects of
.BR signal ()
in a multi-threaded process are unspecified.
.PP .PP
According to POSIX, the behaviour of a process is undefined after it According to POSIX, the behaviour of a process is undefined after it
ignores a ignores a