From b9afdb7b4cec4d17ae64fce1e9b4ac0773b3cf5c Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sun, 19 Oct 2008 21:58:22 +0200 Subject: [PATCH] Assume that waitpid() fills an 'int' status, not a 'union wait'. --- ChangeLog | 7 +++++++ lib/wait-process.c | 33 +++++++++------------------------ 2 files changed, 16 insertions(+), 24 deletions(-) diff --git a/ChangeLog b/ChangeLog index f44d87422..23ede0f2f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,12 @@ 2008-10-19 Bruno Haible + 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 + New module 'atoll'. * modules/atoll: New file. * lib/stdlib.in.h (atoll): New declaration. diff --git a/lib/wait-process.c b/lib/wait-process.c index 585272682..b46962e51 100644 --- a/lib/wait-process.c +++ b/lib/wait-process.c @@ -33,7 +33,6 @@ /* Native Woe32 API. */ #include #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) ?? */ @@ -47,28 +46,14 @@ #include /* 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. */ @@ -346,7 +331,7 @@ wait_subprocess (pid_t child, const char *progname, } #else /* waitpid() is just as portable as wait() nowadays. */ - WAIT_T status; + int status; if (termsigp != NULL) *termsigp = 0; -- 2.11.0