From 67e60012a3076479bb7de91b78a2c972ae0b6901 Mon Sep 17 00:00:00 2001 From: tjg Date: Mon, 10 May 1999 15:19:14 +0000 Subject: Portability: Linux *almost* has SysV SIGCLD semantics, and we need to detect them. --- acinclude.m4 | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'acinclude.m4') diff --git a/acinclude.m4 b/acinclude.m4 index 814bae2..4c1a07e 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -145,7 +145,12 @@ sigaction(SIGINT, 0, 0); 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? +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. (I'm +dnl almost, but not quite 100% sure that real SysV will *always* return +dnl ECHILD.) 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([ @@ -156,13 +161,14 @@ AC_DEFUN(RC_SYS_V_SIGCLD, [ #include int main(void) { int i; - sigset(SIGCLD, SIG_IGN); + 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; } -- cgit v1.2.3