aboutsummaryrefslogtreecommitdiffstats
path: root/src/syswait.h
diff options
context:
space:
mode:
authorRichard M. Stallman2002-08-12 17:27:57 +0000
committerRichard M. Stallman2002-08-12 17:27:57 +0000
commit557713d896b8cc20686bee10579a4afaac8b274d (patch)
tree5cb0bb99387957e9d3e72c86e587f358c5f2d72d /src/syswait.h
parent1ac5826d934dcdecdd5fb6bc71604bb18231ebff (diff)
downloademacs-557713d896b8cc20686bee10579a4afaac8b274d.tar.gz
emacs-557713d896b8cc20686bee10579a4afaac8b274d.zip
Only the include of sys/wait.h tests HAVE_SYS_WAIT_H.
[!VMS] (WCOREDUMP, WEXITSTATUS, WIFEXITED, WIFSTOPPED, WIFSIGNALED) (WSTOPSIG, WTERMSIG): Define each one independently if not defined already.
Diffstat (limited to 'src/syswait.h')
-rw-r--r--src/syswait.h40
1 files changed, 19 insertions, 21 deletions
diff --git a/src/syswait.h b/src/syswait.h
index da5e52c689f..f317227b7ab 100644
--- a/src/syswait.h
+++ b/src/syswait.h
@@ -27,47 +27,45 @@ Boston, MA 02111-1307, USA. */
27 27
28#ifndef VMS 28#ifndef VMS
29 29
30/* Try the approach recommended by autoconf. If this doesn't cause 30/* This is now really the approach recommended by Autoconf. If this
31 trouble anywhere, remove the original code, which is #if'd out 31 doesn't cause trouble anywhere, remove the original code, which is
32 below. */ 32 #if'd out below. */
33 33
34#if 1 34#if 1
35#include <sys/types.h> 35#include <sys/types.h>
36 36
37#ifdef HAVE_SYS_WAIT_H /* We have sys/wait.h with POSIXoid definitions. */ 37#ifdef HAVE_SYS_WAIT_H /* We have sys/wait.h with POSIXoid definitions. */
38
39#include <sys/wait.h> 38#include <sys/wait.h>
39#endif /* !HAVE_SYS_WAIT_H */
40
40#ifndef WCOREDUMP /* not POSIX */ 41#ifndef WCOREDUMP /* not POSIX */
41#define WCOREDUMP(status) ((status) & 0x80) 42#define WCOREDUMP(status) ((status) & 0x80)
42#endif 43#endif
43 44#ifndef WEXITSTATUS
44#else /* !HAVE_SYS_WAIT_H */
45
46/* Note that sys/wait.h may still be included by stdlib.h or something
47 according to XPG. */
48
49#undef WEXITSTATUS
50#define WEXITSTATUS(status) (((status) & 0xff00) >> 8) 45#define WEXITSTATUS(status) (((status) & 0xff00) >> 8)
51#undef WIFEXITED 46#endif
47#ifndef WIFEXITED
52#define WIFEXITED(status) (WTERMSIG(status) == 0) 48#define WIFEXITED(status) (WTERMSIG(status) == 0)
53#undef WIFSTOPPED 49#endif
50#ifndef WIFSTOPPED
54#define WIFSTOPPED(status) (((status) & 0xff) == 0x7f) 51#define WIFSTOPPED(status) (((status) & 0xff) == 0x7f)
55#undef WIFSIGNALED 52#endif
53#ifndef WIFSIGNALED
56#define WIFSIGNALED(status) (!WIFSTOPPED(status) && !WIFEXITED(status)) 54#define WIFSIGNALED(status) (!WIFSTOPPED(status) && !WIFEXITED(status))
57#undef WSTOPSIG 55#endif
56#ifndef WSTOPSIG
58#define WSTOPSIG(status) WEXITSTATUS(status) 57#define WSTOPSIG(status) WEXITSTATUS(status)
59#undef WTERMSIG 58#endif
59#ifndef WTERMSIG
60#define WTERMSIG(status) ((status) & 0x7f) 60#define WTERMSIG(status) ((status) & 0x7f)
61#undef WCOREDUMP 61#endif
62#define WCOREDUMP(status) ((status) & 0x80)
63#endif /* HAVE_SYS_WAIT_H */
64 62
65#undef WAITTYPE 63#undef WAITTYPE
66#define WAITTYPE int 64#define WAITTYPE int
67#undef WRETCODE 65#undef WRETCODE
68#define WRETCODE(status) WEXITSTATUS (status) 66#define WRETCODE(status) WEXITSTATUS (status)
69 67
70#else /* !1 */ 68#else /* 0 */
71 69
72#ifndef WAITTYPE 70#ifndef WAITTYPE
73 71
@@ -134,7 +132,7 @@ Boston, MA 02111-1307, USA. */
134#endif /* not WAIT_USE_INT */ 132#endif /* not WAIT_USE_INT */
135#endif /* no WAITTYPE */ 133#endif /* no WAITTYPE */
136 134
137#endif /* 1 */ 135#endif /* 0 */
138 136
139#else /* VMS */ 137#else /* VMS */
140 138