summaryrefslogtreecommitdiff
path: root/signal.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1999-10-12 04:53:36 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1999-10-12 04:53:36 +0000
commitbe1fea072cd0d22788ef8a931c0c6b64a2503b5d (patch)
tree4d17e3f2cabbe9f4ea2bee8f523de11ce30f6a39 /signal.c
parent758cb647c7ac9e02a9ee0d7cb0934a5c963481e0 (diff)
19991012
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@537 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'signal.c')
-rw-r--r--signal.c26
1 files changed, 16 insertions, 10 deletions
diff --git a/signal.c b/signal.c
index 857aa8a..6489760 100644
--- a/signal.c
+++ b/signal.c
@@ -294,6 +294,13 @@ posix_signal(signum, handler)
sigact.sa_handler = handler;
sigemptyset(&sigact.sa_mask);
sigact.sa_flags = 0;
+#ifdef SA_RESTART
+ sigact.sa_flags |= SA_RESTART; /* SVR4, 4.3+BSD */
+#endif
+#ifdef SA_NOCLDWAIT
+ if (signum == SIGCHLD && handler == (RETSIGTYPE)SIG_IGN)
+ sigact.sa_flags |= SA_NOCLDWAIT;
+#endif
sigaction(signum, &sigact, 0);
}
#define ruby_signal(sig,handle) posix_signal((sig),(handle))
@@ -313,9 +320,6 @@ signal_exec(sig)
#ifndef NT
case SIGHUP:
#endif
-#ifdef SIGPIPE
- case SIGPIPE:
-#endif
#ifdef SIGQUIT
case SIGQUIT:
#endif
@@ -345,7 +349,7 @@ sighandle(sig)
rb_bug("trap_handler: Bad signal %d", sig);
}
-#if !defined(POSIX_SIGNAL) && !defined(BSD_SIGNAL)
+#if !defined(BSD_SIGNAL)
ruby_signal(sig, sighandle);
#endif
@@ -509,9 +513,6 @@ trap(arg)
#ifdef SIGUSR2
case SIGUSR2:
#endif
-#ifdef SIGPIPE
- case SIGPIPE:
-#endif
func = sighandle;
break;
#ifdef SIGBUS
@@ -524,6 +525,11 @@ trap(arg)
func = sigsegv;
break;
#endif
+#ifdef SIGPIPE
+ case SIGPIPE:
+ func = SIG_IGN;
+ break;
+#endif
}
}
ruby_signal(sig, func);
@@ -614,9 +620,6 @@ Init_signal()
#ifndef NT
ruby_signal(SIGHUP, sighandle);
#endif
-#ifdef SIGPIPE
- ruby_signal(SIGPIPE, sighandle);
-#endif
#ifdef SIGQUIT
ruby_signal(SIGQUIT, sighandle);
#endif
@@ -636,5 +639,8 @@ Init_signal()
#ifdef SIGSEGV
ruby_signal(SIGSEGV, sigsegv);
#endif
+#ifdef SIGPIPE
+ ruby_signal(SIGPIPE, SIG_IGN);
+#endif
#endif /* MACOS_UNUSE_SIGNAL */
}