diff options
| author | tjg <tjg> | 1999-05-10 15:19:14 +0000 |
|---|---|---|
| committer | Toby Goodwin <toby@paccrat.org> | 2015-05-16 21:23:15 +0100 |
| commit | 67e60012a3076479bb7de91b78a2c972ae0b6901 (patch) | |
| tree | b6b28a2ba59e032d643067e09955d323b55ccee1 | |
| parent | 3df02408cbd92b1c07fc96dfc09417c7dcf713bd (diff) | |
Portability: Linux *almost* has SysV SIGCLD semantics, and we need to
detect them.
| -rw-r--r-- | acinclude.m4 | 10 |
1 files changed, 8 insertions, 2 deletions
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 <unistd.h> 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; } |