From 7d240a4e673d6119363eb695c759b7416274c2ee Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sun, 19 Oct 2008 23:29:38 +0200 Subject: [PATCH] Make use of sys_wait module. --- ChangeLog | 5 +++++ lib/wait-process.c | 43 ------------------------------------------- modules/wait-process | 1 + 3 files changed, 6 insertions(+), 43 deletions(-) diff --git a/ChangeLog b/ChangeLog index 18a0984c2..fda5d6239 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2008-10-19 Bruno Haible + * lib/wait-process.c: Include simply . + (waitpid, WTERMSIG, WCOREDUMP, WEXITSTATUS, WIFSIGNALED, WIFEXITED, + WIFSTOPPED): Remove fallback definitions. + * modules/wait-process (Depends-on): Add sys_wait. + New module 'sys_wait'. * modules/sys_wait: New file. * lib/sys_wait.in.h: New file, partially copied from diff --git a/lib/wait-process.c b/lib/wait-process.c index b46962e51..7db25e995 100644 --- a/lib/wait-process.c +++ b/lib/wait-process.c @@ -27,50 +27,7 @@ #include #include - -#if defined _MSC_VER || defined __MINGW32__ - -/* Native Woe32 API. */ -#include -#define waitpid(pid,statusp,options) _cwait (statusp, pid, WAIT_CHILD) -#define WTERMSIG(x) ((x) & 0xff) /* or: SIGABRT ?? */ -#define WCOREDUMP(x) 0 -#define WEXITSTATUS(x) (((x) >> 8) & 0xff) /* or: (x) ?? */ -#define WIFSIGNALED(x) (WTERMSIG (x) != 0) /* or: ((x) == 3) ?? */ -#define WIFEXITED(x) (WTERMSIG (x) == 0) /* or: ((x) != 3) ?? */ -#define WIFSTOPPED(x) 0 - -#else - -/* Unix API. */ #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. */ -#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. */ -#ifndef WIFSIGNALED -# define WIFSIGNALED(x) (WTERMSIG (x) != 0 && WTERMSIG(x) != 0x7f) -#endif -#ifndef WIFEXITED -# define WIFEXITED(x) (WTERMSIG (x) == 0) -#endif -#ifndef WIFSTOPPED -# define WIFSTOPPED(x) (WTERMSIG (x) == 0x7f) -#endif -/* Note that portable applications may access - WTERMSIG(x) only if WIFSIGNALED(x) is true, and - WEXITSTATUS(x) only if WIFEXITED(x) is true. */ - -#endif #include "error.h" #include "fatal-signal.h" diff --git a/modules/wait-process b/modules/wait-process index bfb54fa9e..447e580d5 100644 --- a/modules/wait-process +++ b/modules/wait-process @@ -14,6 +14,7 @@ exit xalloc gettext-h stdbool +sys_wait unistd configure.ac: -- 2.11.0