rc

[fork] interactive rc shell
Log | Files | Refs | README | LICENSE

commit 67a87ad0104d88e8b1711a3831d616598edb30c2
parent dff49d84c0ef9880b191ebbaac2cf65a17eb481a
Author: Toby Goodwin <toby@paccrat.org>
Date:   Sat, 17 Feb 2018 16:03:30 +0000

remove all references to SIGCLD

Diffstat:
MAUTHORS | 14+++++++-------
Macinclude.m4 | 36------------------------------------
Mconfigure.ac | 2--
Mfn.c | 11+++--------
Msignal.c | 10++++------
Dtestcld.c | 19-------------------
6 files changed, 14 insertions(+), 78 deletions(-)

diff --git a/AUTHORS b/AUTHORS @@ -31,10 +31,10 @@ version of rc presented here differs in some respects. Toby would like to thank these people for their contributions since he took over maintenance of rc. Aharon Robbins, Arvid Requate, Bengt Kleberg, Bert Münnich, Brynjulv Hauksson, Byron Rakitzis, Callum Gibson, -Casper Ti. Vector, Chris Siebenmann, Christian Neukirchen, Dale Scheetz, -Dan Moniz, David Luyer, David Swasey, Decklin Foster, Donn Cave, Erik -Quanstrom, Gary Carvell, Gerry Tomlinson, Gert-Jan Vons, Ian Lance -Taylor, Jakub Wilk, Jeremy Fitzhardinge, Leah Neukirchen, Marc -Moorcroft, Mark H Wilkinson, Mark K Gardner, Raymond Venneker, Rich -$alz, Rob Savoye, Scott Schwartz, Stefan Dalibor, Steve Simon, Thomas -Nordin, Tom Culliton, Tom Tromey, Vincent Broman, Wolfgang Zekoll. +Casper Ti. Vector, Chris Siebenmann, Dale Scheetz, Dan Moniz, David +Luyer, David Swasey, Decklin Foster, Donn Cave, Erik Quanstrom, Gary +Carvell, Gerry Tomlinson, Gert-Jan Vons, Ian Lance Taylor, Jakub Wilk, +Jeremy Fitzhardinge, Leah Neukirchen, Marc Moorcroft, Mark H Wilkinson, +Mark K Gardner, Raymond Venneker, Rich $alz, Rob Savoye, Scott Schwartz, +Stefan Dalibor, Steve Simon, Thomas Nordin, Tom Culliton, Tom Tromey, +Vincent Broman, Wolfgang Zekoll. diff --git a/acinclude.m4 b/acinclude.m4 @@ -128,42 +128,6 @@ AC_DEFUN([RC_TYPE_SIG_ATOMIC_T], [ ]) -dnl Do we have SysV SIGCLD semantics? In other words, if we set the -dnl action for SIGCLD to SIG_IGN does wait() always say ECHILD? Linux, -dnl of course, is bizarre here. It basically implements the SysV -dnl semantics, but if the parent calls wait() before the child calls -dnl exit(), wait() returns with the PID of the child as normal. (Real -dnl SysV waits for all children to exit, then returns with ECHILD.) -dnl Anyway, this is why the `sleep(1)' is there. -AC_DEFUN([RC_SYS_V_SIGCLD], [ - AC_CACHE_CHECK(for SysV SIGCLD semantics, rc_cv_sysv_sigcld, - AC_TRY_RUN([ -#include <errno.h> -#include <signal.h> -#include <sys/types.h> -#include <sys/wait.h> -#include <unistd.h> -int main(void) { - int i; - signal(SIGCLD, SIG_IGN); - switch (fork()) { - case -1: - return 1; - case 0: - return 0; - default: - sleep(1); - if (wait(&i) == -1 && errno == ECHILD) return 0; - else return 1; - } -} - ], rc_cv_sysv_sigcld=yes, rc_cv_sysv_sigcld=no, rc_cv_sysv_sigcld=yes)) - case "$rc_cv_sysv_sigcld" in - yes) AC_DEFINE(HAVE_SYSV_SIGCLD, 1, [Has SysV SIGCLD]) ;; - esac -]) - - dnl Do we have /dev/fd or /proc/self/fd? AC_DEFUN([RC_SYS_DEV_FD], [ AC_CACHE_CHECK(for /dev/fd, rc_cv_sys_dev_fd, diff --git a/configure.ac b/configure.ac @@ -63,8 +63,6 @@ RC_TYPE_RLIM_T RC_TYPE_SIG_ATOMIC_T -RC_SYS_V_SIGCLD - dnl Does the kernel handle `#! /interpreter'? AC_SYS_INTERPRETER case "$ac_cv_sys_interpreter" in diff --git a/fn.c b/fn.c @@ -29,10 +29,7 @@ extern void inithandler() { null.type = nBody; null.u[0].p = null.u[1].p = NULL; for (i = 1; i < NUMOFSIGNALS; i++) -#if HAVE_SYSV_SIGCLD - if (i != SIGCLD) -#endif - if (sighandlers[i] == SIG_IGN) + if (i != SIGCHLD && sighandlers[i] == SIG_IGN) fnassign(signals[i].name, NULL); /* ignore incoming ignored signals */ if (interactive || sighandlers[SIGINT] != SIG_IGN) { def_sigint = sigint; @@ -151,10 +148,8 @@ extern void fnassign(char *name, Node *def) { new->def = newdef; new->extdef = NULL; if (strncmp(name, "sig", conststrlen("sig")) == 0) { /* slight optimization */ -#if HAVE_SYSV_SIGCLD /* System V machines treat SIGCLD very specially */ - if (streq(name, "sigcld")) - rc_error("can't trap SIGCLD"); -#endif + if (streq(name, "sigchld") || streq(name, "sigcld")) + rc_error("can't trap SIGCHLD"); if (streq(name, "sigexit")) runexit = TRUE; for (i = 1; i < NUMOFSIGNALS; i++) /* zero is a bogus signal */ diff --git a/signal.c b/signal.c @@ -83,14 +83,12 @@ extern void initsignal() { void (*h)(int); int i; -#if HAVE_SYSV_SIGCLD - /* Ensure that SIGCLD is not SIG_IGN. Solaris's rshd does this. :-( */ - h = sys_signal(SIGCLD, SIG_IGN); + /* Ensure that SIGCHLD is not SIG_IGN. Solaris's rshd does this. :-( */ + h = sys_signal(SIGCHLD, SIG_IGN); if (h != SIG_IGN && h != SIG_ERR) - sys_signal(SIGCLD, h); + sys_signal(SIGCHLD, h); else - sys_signal(SIGCLD, SIG_DFL); -#endif + sys_signal(SIGCHLD, SIG_DFL); for (i = 1; i < NUMOFSIGNALS; i++) { #ifdef SIGKILL diff --git a/testcld.c b/testcld.c @@ -1,19 +0,0 @@ -#include <errno.h> -#include <signal.h> -#include <sys/types.h> -#include <sys/wait.h> -#include <unistd.h> -int main(void) { - int i; - sigset(SIGCLD, SIG_IGN); - switch (fork()) { - case -1: - return 1; - case 0: - return 0; - default: - sleep(1); - if (wait(&i) == -1 && errno == ECHILD) return 0; - else return 1; - } -}