# HG changeset patch # User Bruno Haible # Date 1224446302 -7200 # Node ID fbb2ccfb180de0bfc2c5eee57ae269076dc92b8b # Parent 8e54ec4dc6913d41e6e56f6406e8cde0a11b90b2 Assume that waitpid() fills an 'int' status, not a 'union wait'. diff --git a/ChangeLog b/ChangeLog --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +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'. diff --git a/lib/wait-process.c b/lib/wait-process.c --- 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 @@ } #else /* waitpid() is just as portable as wait() nowadays. */ - WAIT_T status; + int status; if (termsigp != NULL) *termsigp = 0;