1 /* unionwait.h -- definitions for using a `union wait' on systems without
4 /* Copyright (C) 1996 Free Software Foundation, Inc.
6 This file is part of GNU Bash, the Bourne Again SHell.
8 Bash is free software: you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation, either version 3 of the License, or
11 (at your option) any later version.
13 Bash is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with Bash. If not, see <http://www.gnu.org/licenses/>.
25 #if !defined (WORDS_BIGENDIAN)
28 int w_status
; /* used in syscall */
30 /* Terminated process status. */
34 w_Termsig
: 7, /* termination signal */
35 w_Coredump
: 1, /* core dump indicator */
36 w_Retcode
: 8, /* exit code if w_termsig==0 */
37 w_Fill1
: 16; /* high 16 bits unused */
40 /* Stopped process status. Returned
41 only for traced children unless requested
42 with the WUNTRACED option bit. */
46 w_Stopval
: 8, /* == W_STOPPED if stopped */
47 w_Stopsig
: 8, /* actually zero on XENIX */
48 w_Fill2
: 16; /* high 16 bits unused */
52 #else /* WORDS_BIGENDIAN */
54 /* This is for big-endian machines like the IBM RT, HP 9000, or Sun-3 */
58 int w_status
; /* used in syscall */
60 /* Terminated process status. */
63 unsigned short w_Fill1
: 16; /* high 16 bits unused */
64 unsigned w_Retcode
: 8; /* exit code if w_termsig==0 */
65 unsigned w_Coredump
: 1; /* core dump indicator */
66 unsigned w_Termsig
: 7; /* termination signal */
69 /* Stopped process status. Returned
70 only for traced children unless requested
71 with the WUNTRACED option bit. */
74 unsigned short w_Fill2
: 16; /* high 16 bits unused */
75 unsigned w_Stopsig
: 8; /* signal that stopped us */
76 unsigned w_Stopval
: 8; /* == W_STOPPED if stopped */
80 #endif /* WORDS_BIGENDIAN */
82 #define w_termsig w_T.w_Termsig
83 #define w_coredump w_T.w_Coredump
84 #define w_retcode w_T.w_Retcode
85 #define w_stopval w_S.w_Stopval
86 #define w_stopsig w_S.w_Stopsig
89 #define WIFSTOPPED(x) ((x).w_stopval == WSTOPPED)
90 #define WIFEXITED(x) ((x).w_stopval != WSTOPPED && (x).w_termsig == 0)
91 #define WIFSIGNALED(x) ((x).w_stopval != WSTOPPED && (x).w_termsig != 0)
93 #define WTERMSIG(x) ((x).w_termsig)
94 #define WSTOPSIG(x) ((x).w_stopsig)
95 #define WEXITSTATUS(x) ((x).w_retcode)
96 #define WIFCORED(x) ((x).w_coredump)
98 #endif /* _UNIONWAIT_H */