+2008-10-19 Bruno Haible <bruno@clisp.org>
+
+ Assume that waitpid() fills an 'int' status, not a 'union wait'.
+ * lib/wait-process.c (WAIT_T): Remove type.
+ (WTERMSIG, WCOREDUMP, WEXITSTATUS): Define fallbacks using bit masks.
+ (wait_subprocess): Update.
+
2008-10-19 Bruno Haible <bruno@clisp.org>
New module 'atoll'.
/* Native Woe32 API. */
#include <process.h>
#define waitpid(pid,statusp,options) _cwait (statusp, pid, WAIT_CHILD)
-#define WAIT_T int
#define WTERMSIG(x) ((x) & 0xff) /* or: SIGABRT ?? */
#define WCOREDUMP(x) 0
#define WEXITSTATUS(x) (((x) >> 8) & 0xff) /* or: (x) ?? */
#include <sys/wait.h>
/* On Linux, WEXITSTATUS are bits 15..8 and WTERMSIG are bits 7..0, while
BeOS uses the contrary. Therefore we use the abstract macros. */
-#if HAVE_UNION_WAIT
-# define WAIT_T union wait
-# ifndef WTERMSIG
-# define WTERMSIG(x) ((x).w_termsig)
-# endif
-# ifndef WCOREDUMP
-# define WCOREDUMP(x) ((x).w_coredump)
-# endif
-# ifndef WEXITSTATUS
-# define WEXITSTATUS(x) ((x).w_retcode)
-# endif
-#else
-# define WAIT_T int
-# ifndef WTERMSIG
-# define WTERMSIG(x) ((x) & 0x7f)
-# endif
-# ifndef WCOREDUMP
-# define WCOREDUMP(x) ((x) & 0x80)
-# endif
-# ifndef WEXITSTATUS
-# define WEXITSTATUS(x) (((x) >> 8) & 0xff)
-# endif
+#ifndef WTERMSIG
+# define WTERMSIG(x) ((x) & 0x7f)
+#endif
+#ifndef WCOREDUMP
+# define WCOREDUMP(x) ((x) & 0x80)
+#endif
+#ifndef WEXITSTATUS
+# define WEXITSTATUS(x) (((x) >> 8) & 0xff)
#endif
/* For valid x, exactly one of WIFSIGNALED(x), WIFEXITED(x), WIFSTOPPED(x)
is true. */
}
#else
/* waitpid() is just as portable as wait() nowadays. */
- WAIT_T status;
+ int status;
if (termsigp != NULL)
*termsigp = 0;