comparison src/syswait.h @ 0:376386a54a3c r19-14

Import from CVS: tag r19-14
author cvs
date Mon, 13 Aug 2007 08:45:50 +0200
parents
children 43dd3413c7c7
comparison
equal deleted inserted replaced
-1:000000000000 0:376386a54a3c
1 /* Define wait system call interface for Emacs.
2 Copyright (C) 1993, 1994, 1995 Free Software Foundation, Inc.
3 Copyright (C) 1995 Sun Microsystems, Inc.
4
5 This file is part of XEmacs.
6
7 XEmacs is free software; you can redistribute it and/or modify it
8 under the terms of the GNU General Public License as published by the
9 Free Software Foundation; either version 2, or (at your option) any
10 later version.
11
12 XEmacs is distributed in the hope that it will be useful, but WITHOUT
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with XEmacs; see the file COPYING. If not, write to
19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. */
21
22 /* Synched up with: FSF 19.30. */
23
24 /* Cleaned up by Ben Wing. */
25
26 /* Define the structure that the wait system call stores.
27 On many systems, there is a structure defined for this.
28 But on vanilla-ish USG systems there is not.
29
30 NOTE: POSIX specifies that int, rather than union wait,
31 be used. BSD systems based on BSD 4.3+ or newer generally
32 have int, but those based on BSD 4.3 or older have union wait.
33 */
34
35 #ifndef VMS
36
37 # ifdef HAVE_SYS_WAIT_H
38 # include <sys/wait.h>
39 # endif
40
41 # if !defined (HAVE_UNION_WAIT) /* the POSIX / SYSV way */
42
43 # define WAITTYPE int
44 # ifndef WIFSTOPPED
45 # define WIFSTOPPED(w) (((w) & 0377) == 0177)
46 # endif
47 # ifndef WIFSIGNALED
48 # define WIFSIGNALED(w) (((w) & 0377) != 0177 && ((w) & ~0377) == 0)
49 # endif
50 # ifndef WIFEXITED
51 # define WIFEXITED(w) (((w) & 0377) == 0)
52 # endif
53 # ifndef WRETCODE
54 # ifdef WEXITSTATUS
55 # define WRETCODE(w) WEXITSTATUS (w)
56 # else
57 # define WRETCODE(w) ((w) >> 8)
58 # endif
59 # endif
60 # ifndef WSTOPSIG
61 # define WSTOPSIG(w) ((w) >> 8)
62 # endif
63 # ifndef WTERMSIG
64 # define WTERMSIG(w) ((w) & 0377)
65 # endif
66 # ifndef WCOREDUMP
67 # define WCOREDUMP(w) (((w) & 0200) != 0)
68 # endif
69
70 # else /* the older BSD way */
71
72 # define WAITTYPE union wait
73
74 # ifndef WRETCODE
75 # ifdef WEXITSTATUS
76 # define WRETCODE(w) WEXITSTATUS(w)
77 # else
78 # define WRETCODE(w) w.w_retcode
79 # endif
80 # endif
81
82 # undef WCOREDUMP /* Later BSDs define this name differently. */
83 # define WCOREDUMP(w) w.w_coredump
84
85 # if defined (HPUX) || defined (convex)
86 /* HPUX version 7 has broken definitions of these. */
87 /* pvogel@convex.com says the convex does too. */
88 # undef WTERMSIG
89 # undef WSTOPSIG
90 # undef WIFSTOPPED
91 # undef WIFSIGNALED
92 # undef WIFEXITED
93 # endif /* HPUX | convex */
94
95 # ifndef WTERMSIG
96 # define WTERMSIG(w) w.w_termsig
97 # endif
98 # ifndef WSTOPSIG
99 # define WSTOPSIG(w) w.w_stopsig
100 # endif
101 # ifndef WIFSTOPPED
102 # define WIFSTOPPED(w) (WTERMSIG (w) == 0177)
103 # endif
104 # ifndef WIFSIGNALED
105 # define WIFSIGNALED(w) (WTERMSIG (w) != 0177 && (WSTOPSIG (w)) == 0)
106 # endif
107 # ifndef WIFEXITED
108 # define WIFEXITED(w) (WTERMSIG (w) == 0)
109 # endif
110
111 # endif /* HAVE_UNION_WAIT */
112
113 #else /* VMS */
114
115 # define WAITTYPE int
116 # define WIFSTOPPED(w) 0
117 # define WIFSIGNALED(w) 0
118 # define WIFEXITED(w) ((w) != -1)
119 # define WRETCODE(w) (w)
120 # define WSTOPSIG(w) (w)
121 # define WCOREDUMP(w) 0
122 # define WTERMSIG(w) (w)
123 # include <ssdef.h>
124 # include <iodef.h>
125 # include <clidef.h>
126 # include "vmsproc.h"
127
128 #endif /* VMS */