.\" based on work by Rik Faith <faith@cs.unc.edu>
.\" and Mike Battersby <mike@starbug.apana.org.au>.
.\"
+.\" %%%LICENSE_START(VERBATIM)
.\" Permission is granted to make and distribute verbatim copies of this
.\" manual provided the copyright notice and this permission notice are
.\" preserved on all copies.
.\"
.\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work.
+.\" %%%LICENSE_END
.\"
.\" Modified 2004-11-19, mtk:
.\" added pointer to sigaction.2 for details of ignoring SIGCHLD
.\" various sections.
.\" 2008-07-11, mtk: rewrote and expanded portability discussion.
.\"
-.TH SIGNAL 2 2012-05-05 "Linux" "Linux Programmer's Manual"
+.TH SIGNAL 2 2013-02-09 "Linux" "Linux Programmer's Manual"
.SH NAME
signal \- ANSI C signal handling
.SH SYNOPSIS
and
.B SIGSTOP
cannot be caught or ignored.
-.SH "RETURN VALUE"
+.SH RETURN VALUE
.BR signal ()
returns the previous value of the signal handler, or
.B SIG_ERR
.B EINVAL
.I signum
is invalid.
-.SH "CONFORMING TO"
+.SH CONFORMING TO
C89, C99, POSIX.1-2001.
.SH NOTES
The effects of
the disposition of the signal would be reset to
.BR SIG_DFL ,
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:
+
+ sa.sa_flags = SA_RESETHAND | SA_NODEFER;
+
System V also provides these semantics for
.BR signal ().
This was bad because the signal might be delivered again
Furthermore, rapid deliveries of the same signal could
result in recursive invocations of the handler.
-BSD improved on this situation by changing the semantics of
-signal handling
-(but, unfortunately, silently changed the semantics
-when establishing a handler with
-.BR signal ()).
+BSD improved on this situation, but unfortunately also
+changed the semantics of the existing
+.BR signal ()
+interface while doing so.
On BSD, when a signal handler is invoked,
the signal disposition is not reset,
and further instances of the signal are blocked from
being delivered while the handler is executing.
+Furthermore, certain blocking system calls are automatically
+restarted if interrupted by a signal handler (see
+.BR signal (7)).
+The BSD semantics are equivalent to calling
+.BR sigaction (2)
+with the following flags:
+
+ sa.sa_flags = SA_RESTART;
The situation on Linux is as follows:
.IP * 2
then
.BR signal ()
provides BSD semantics.
-.SH "SEE ALSO"
+.SH SEE ALSO
.BR kill (1),
.BR alarm (2),
.BR kill (2),