]> git.ipfire.org Git - thirdparty/bash.git/blame - include/unionwait.h
Bash-4.4 patch 19
[thirdparty/bash.git] / include / unionwait.h
CommitLineData
d166f048 1/* unionwait.h -- definitions for using a `union wait' on systems without
ccc6cda3
JA
2 one. */
3
4/* Copyright (C) 1996 Free Software Foundation, Inc.
5
6 This file is part of GNU Bash, the Bourne Again SHell.
7
3185942a
JA
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.
ccc6cda3 12
3185942a
JA
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.
ccc6cda3 17
3185942a
JA
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/>.
20*/
ccc6cda3 21
d166f048
JA
22#ifndef _UNIONWAIT_H
23#define _UNIONWAIT_H
ccc6cda3
JA
24
25#if !defined (WORDS_BIGENDIAN)
26union wait
27 {
28 int w_status; /* used in syscall */
29
30 /* Terminated process status. */
31 struct
32 {
33 unsigned short
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 */
38 } w_T;
39
40 /* Stopped process status. Returned
41 only for traced children unless requested
42 with the WUNTRACED option bit. */
43 struct
44 {
45 unsigned short
46 w_Stopval : 8, /* == W_STOPPED if stopped */
47 w_Stopsig : 8, /* actually zero on XENIX */
48 w_Fill2 : 16; /* high 16 bits unused */
49 } w_S;
50 };
51
52#else /* WORDS_BIGENDIAN */
53
54/* This is for big-endian machines like the IBM RT, HP 9000, or Sun-3 */
55
56union wait
57 {
58 int w_status; /* used in syscall */
59
60 /* Terminated process status. */
61 struct
62 {
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 */
67 } w_T;
68
69 /* Stopped process status. Returned
70 only for traced children unless requested
71 with the WUNTRACED option bit. */
72 struct
73 {
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 */
77 } w_S;
78 };
79
80#endif /* WORDS_BIGENDIAN */
81
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
87
88#define WSTOPPED 0177
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)
92
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)
97
d166f048 98#endif /* _UNIONWAIT_H */