OSDN Git Service

(split) LDP: Update original to LDP v3.50.
[linuxjm/LDP_man-pages.git] / original / man2 / signal.2
index 304a551..41edd4d 100644 (file)
@@ -5,6 +5,7 @@
 .\" 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.
@@ -24,6 +25,7 @@
 .\"
 .\" 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
@@ -31,7 +33,7 @@
 .\"     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
@@ -92,7 +94,7 @@ The signals
 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
@@ -102,7 +104,7 @@ on error.
 .B EINVAL
 .I signum
 is invalid.
-.SH "CONFORMING TO"
+.SH CONFORMING TO
 C89, C99, POSIX.1-2001.
 .SH NOTES
 The effects of
@@ -185,6 +187,12 @@ was invoked by the delivery of a signal,
 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
@@ -192,15 +200,22 @@ before the handler had a chance to reestablish itself.
 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
@@ -257,7 +272,7 @@ instead of
 then
 .BR signal ()
 provides BSD semantics.
-.SH "SEE ALSO"
+.SH SEE ALSO
 .BR kill (1),
 .BR alarm (2),
 .BR kill (2),