summaryrefslogtreecommitdiffstats
path: root/include/unionwait.h
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 06:17:24 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 06:17:24 +0000
commit9d8085074991d5c0a42d6fc96a2d1a3ee918aad1 (patch)
treec85bca1e6c11eb872edfc64c524d20f2b7e3307b /include/unionwait.h
parentInitial commit. (diff)
downloadbash-9d8085074991d5c0a42d6fc96a2d1a3ee918aad1.tar.xz
bash-9d8085074991d5c0a42d6fc96a2d1a3ee918aad1.zip
Adding upstream version 5.1.upstream/5.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--include/unionwait.h98
1 files changed, 98 insertions, 0 deletions
diff --git a/include/unionwait.h b/include/unionwait.h
new file mode 100644
index 0000000..b1b4dfa
--- /dev/null
+++ b/include/unionwait.h
@@ -0,0 +1,98 @@
+/* unionwait.h -- definitions for using a `union wait' on systems without
+ one. */
+
+/* Copyright (C) 1996 Free Software Foundation, Inc.
+
+ This file is part of GNU Bash, the Bourne Again SHell.
+
+ Bash is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ Bash is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Bash. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef _UNIONWAIT_H
+#define _UNIONWAIT_H
+
+#if !defined (WORDS_BIGENDIAN)
+union wait
+ {
+ int w_status; /* used in syscall */
+
+ /* Terminated process status. */
+ struct
+ {
+ unsigned short
+ w_Termsig : 7, /* termination signal */
+ w_Coredump : 1, /* core dump indicator */
+ w_Retcode : 8, /* exit code if w_termsig==0 */
+ w_Fill1 : 16; /* high 16 bits unused */
+ } w_T;
+
+ /* Stopped process status. Returned
+ only for traced children unless requested
+ with the WUNTRACED option bit. */
+ struct
+ {
+ unsigned short
+ w_Stopval : 8, /* == W_STOPPED if stopped */
+ w_Stopsig : 8, /* actually zero on XENIX */
+ w_Fill2 : 16; /* high 16 bits unused */
+ } w_S;
+ };
+
+#else /* WORDS_BIGENDIAN */
+
+/* This is for big-endian machines like the IBM RT, HP 9000, or Sun-3 */
+
+union wait
+ {
+ int w_status; /* used in syscall */
+
+ /* Terminated process status. */
+ struct
+ {
+ unsigned short w_Fill1 : 16; /* high 16 bits unused */
+ unsigned w_Retcode : 8; /* exit code if w_termsig==0 */
+ unsigned w_Coredump : 1; /* core dump indicator */
+ unsigned w_Termsig : 7; /* termination signal */
+ } w_T;
+
+ /* Stopped process status. Returned
+ only for traced children unless requested
+ with the WUNTRACED option bit. */
+ struct
+ {
+ unsigned short w_Fill2 : 16; /* high 16 bits unused */
+ unsigned w_Stopsig : 8; /* signal that stopped us */
+ unsigned w_Stopval : 8; /* == W_STOPPED if stopped */
+ } w_S;
+ };
+
+#endif /* WORDS_BIGENDIAN */
+
+#define w_termsig w_T.w_Termsig
+#define w_coredump w_T.w_Coredump
+#define w_retcode w_T.w_Retcode
+#define w_stopval w_S.w_Stopval
+#define w_stopsig w_S.w_Stopsig
+
+#define WSTOPPED 0177
+#define WIFSTOPPED(x) ((x).w_stopval == WSTOPPED)
+#define WIFEXITED(x) ((x).w_stopval != WSTOPPED && (x).w_termsig == 0)
+#define WIFSIGNALED(x) ((x).w_stopval != WSTOPPED && (x).w_termsig != 0)
+
+#define WTERMSIG(x) ((x).w_termsig)
+#define WSTOPSIG(x) ((x).w_stopsig)
+#define WEXITSTATUS(x) ((x).w_retcode)
+#define WIFCORED(x) ((x).w_coredump)
+
+#endif /* _UNIONWAIT_H */