Mail Archives: djgpp-workers/1996/09/01/06:14:24
When a program launches a child program, it expects (on Unix) to get both
its exit code and the signal, if any, that aborted that child. Our
<sys/wait.h> doesn't support extraction of the signal from the status
returned by `system' and `spawnXX'. I used to hack the necessary defines
into the programs' code, but after I found myself doing it for the third
program in a row (find, xargs, and now Make), I think it's time to make it
official. Especially, since the latest version of `dosexec' already puts
SIGINT into the return status when the child was aborted with Ctrl-C.
So how about the following change:
*** include/sys/wait.h~0 Wed Aug 23 07:57:50 1995
--- include/sys/wait.h Sat Aug 31 19:05:18 1996
***************
*** 12,24 ****
#include <sys/djtypes.h>
! #define WEXITSTATUS(stat_val) ( (stat_val) & 0x00ff)
! #define WIFEXITED(stat_val) (!((stat_val) & 0xff00))
! #define WIFSIGNALED(stat_val) ( ((stat_val) & 0xff00))
#define WIFSTOPPED(stat_val) 0
#define WNOHANG 1
#define WSTOPSIG(stat_val) 0
! #define WTERMSIG(stat_val) ( (stat_val) & 0x00ff)
#define WUNTRACED
__DJ_pid_t
--- 12,24 ----
#include <sys/djtypes.h>
! #define WEXITSTATUS(stat_val) ( (stat_val) & 0x000ff)
! #define WIFEXITED(stat_val) (!((stat_val) & 0x3ff00))
! #define WIFSIGNALED(stat_val) ( ((stat_val) & 0x3ff00))
#define WIFSTOPPED(stat_val) 0
#define WNOHANG 1
#define WSTOPSIG(stat_val) 0
! #define WTERMSIG(stat_val) ( ((stat_val) >> 8 ) & 0x3ff)
#define WUNTRACED
__DJ_pid_t
- Raw text -