summaryrefslogtreecommitdiff
path: root/acinclude.m4
diff options
context:
space:
mode:
authortjg <tjg>1999-05-10 15:19:14 +0000
committerToby Goodwin <toby@paccrat.org>2015-05-16 21:23:15 +0100
commit67e60012a3076479bb7de91b78a2c972ae0b6901 (patch)
treeb6b28a2ba59e032d643067e09955d323b55ccee1 /acinclude.m4
parent3df02408cbd92b1c07fc96dfc09417c7dcf713bd (diff)
Portability: Linux *almost* has SysV SIGCLD semantics, and we need to
detect them.
Diffstat (limited to 'acinclude.m4')
-rw-r--r--acinclude.m410
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;
}