mirror of https://github.com/mkerrisk/man-pages
signal.2: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
parent
cc560d7743
commit
3d113fbfd7
|
@ -38,9 +38,9 @@
|
|||
signal \- ANSI C signal handling
|
||||
.SH SYNOPSIS
|
||||
.B #include <signal.h>
|
||||
.sp
|
||||
.PP
|
||||
.B typedef void (*sighandler_t)(int);
|
||||
.sp
|
||||
.PP
|
||||
.BI "sighandler_t signal(int " signum ", sighandler_t " handler );
|
||||
.SH DESCRIPTION
|
||||
The behavior of
|
||||
|
@ -51,7 +51,7 @@ and has also varied historically across different versions of Linux.
|
|||
.BR sigaction (2)
|
||||
instead.
|
||||
See \fIPortability\fP below.
|
||||
|
||||
.PP
|
||||
.BR signal ()
|
||||
sets the disposition of the signal
|
||||
.I signum
|
||||
|
@ -61,7 +61,7 @@ which is either
|
|||
.BR SIG_IGN ,
|
||||
.BR SIG_DFL ,
|
||||
or the address of a programmer-defined function (a "signal handler").
|
||||
|
||||
.PP
|
||||
If the signal
|
||||
.I signum
|
||||
is delivered to the process, then one of the following happens:
|
||||
|
@ -163,9 +163,9 @@ is defined.
|
|||
Without use of such a type, the declaration of
|
||||
.BR signal ()
|
||||
is the somewhat harder to read:
|
||||
.PP
|
||||
.in +4n
|
||||
.nf
|
||||
|
||||
.BI "void ( *" signal "(int " signum ", void (*" handler ")(int)) ) (int);"
|
||||
.fi
|
||||
.in
|
||||
|
@ -181,13 +181,13 @@ The semantics when using
|
|||
to establish a signal handler vary across systems
|
||||
(and POSIX.1 explicitly permits this variation);
|
||||
.B do not use it for this purpose.
|
||||
|
||||
.PP
|
||||
POSIX.1 solved the portability mess by specifying
|
||||
.BR sigaction (2),
|
||||
which provides explicit control of the semantics when a
|
||||
signal handler is invoked; use that interface instead of
|
||||
.BR signal ().
|
||||
|
||||
.PP
|
||||
In the original UNIX systems, when a handler that was established using
|
||||
.BR signal ()
|
||||
was invoked by the delivery of a signal,
|
||||
|
@ -197,16 +197,18 @@ and the system did not block delivery of further instances of the signal.
|
|||
This is equivalent to calling
|
||||
.BR sigaction (2)
|
||||
with the following flags:
|
||||
|
||||
.PP
|
||||
.EX
|
||||
sa.sa_flags = SA_RESETHAND | SA_NODEFER;
|
||||
|
||||
.EE
|
||||
.PP
|
||||
System\ V also provides these semantics for
|
||||
.BR signal ().
|
||||
This was bad because the signal might be delivered again
|
||||
before the handler had a chance to reestablish itself.
|
||||
Furthermore, rapid deliveries of the same signal could
|
||||
result in recursive invocations of the handler.
|
||||
|
||||
.PP
|
||||
BSD improved on this situation, but unfortunately also
|
||||
changed the semantics of the existing
|
||||
.BR signal ()
|
||||
|
@ -221,9 +223,11 @@ restarted if interrupted by a signal handler (see
|
|||
The BSD semantics are equivalent to calling
|
||||
.BR sigaction (2)
|
||||
with the following flags:
|
||||
|
||||
.PP
|
||||
.EX
|
||||
sa.sa_flags = SA_RESTART;
|
||||
|
||||
.EE
|
||||
.PP
|
||||
The situation on Linux is as follows:
|
||||
.IP * 2
|
||||
The kernel's
|
||||
|
|
Loading…
Reference in New Issue