* syswait.h: Remove old if 0 code. Do not define WAITTYPE, it was
[bpt/emacs.git] / src / syswait.h
CommitLineData
43626ea4 1/* Define wait system call interface for Emacs.
429ab54e 2 Copyright (C) 1993, 1994, 1995, 2000, 2001, 2002, 2003, 2004,
8cabe764 3 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
43626ea4
RS
4
5This file is part of GNU Emacs.
6
b9b1cc14 7GNU Emacs is free software: you can redistribute it and/or modify
43626ea4 8it under the terms of the GNU General Public License as published by
b9b1cc14
GM
9the Free Software Foundation, either version 3 of the License, or
10(at your option) any later version.
43626ea4
RS
11
12GNU Emacs is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
b9b1cc14 18along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
43626ea4
RS
19
20/* Define the structure that the wait system call stores.
21 On many systems, there is a structure defined for this.
22 But on vanilla-ish USG systems there is not. */
23
d72c1cad
DL
24#ifndef EMACS_SYSWAIT_H
25#define EMACS_SYSWAIT_H
26
43626ea4 27#ifndef VMS
d72c1cad 28
d72c1cad 29#include <sys/types.h>
1f0bb0ab 30
3bddb272 31#ifdef HAVE_SYS_WAIT_H /* We have sys/wait.h with POSIXoid definitions. */
d72c1cad 32#include <sys/wait.h>
557713d8
RS
33#endif /* !HAVE_SYS_WAIT_H */
34
1f0bb0ab
DL
35#ifndef WCOREDUMP /* not POSIX */
36#define WCOREDUMP(status) ((status) & 0x80)
d72c1cad 37#endif
557713d8 38#ifndef WEXITSTATUS
1f0bb0ab 39#define WEXITSTATUS(status) (((status) & 0xff00) >> 8)
557713d8
RS
40#endif
41#ifndef WIFEXITED
1f0bb0ab 42#define WIFEXITED(status) (WTERMSIG(status) == 0)
557713d8
RS
43#endif
44#ifndef WIFSTOPPED
1f0bb0ab 45#define WIFSTOPPED(status) (((status) & 0xff) == 0x7f)
557713d8
RS
46#endif
47#ifndef WIFSIGNALED
1f0bb0ab 48#define WIFSIGNALED(status) (!WIFSTOPPED(status) && !WIFEXITED(status))
557713d8
RS
49#endif
50#ifndef WSTOPSIG
1f0bb0ab 51#define WSTOPSIG(status) WEXITSTATUS(status)
557713d8
RS
52#endif
53#ifndef WTERMSIG
1f0bb0ab 54#define WTERMSIG(status) ((status) & 0x7f)
557713d8 55#endif
d72c1cad 56
1f0bb0ab
DL
57#undef WRETCODE
58#define WRETCODE(status) WEXITSTATUS (status)
d72c1cad 59
43626ea4 60#else /* VMS */
da149a8f 61
43626ea4
RS
62#define WIFSTOPPED(w) 0
63#define WIFSIGNALED(w) 0
64#define WIFEXITED(w) ((w) != -1)
65#define WRETCODE(w) (w)
66#define WSTOPSIG(w) (w)
67#define WCOREDUMP(w) 0
68#define WTERMSIG(w) (w)
69#include <ssdef.h>
70#include <iodef.h>
71#include <clidef.h>
72#include "vmsproc.h"
da149a8f 73
43626ea4 74#endif /* VMS */
d72c1cad
DL
75
76#endif /* EMACS_SYSWAIT_H */
ab5796a9
MB
77
78/* arch-tag: 7e5d9719-ec66-4b6f-89bb-563eea16a899
79 (do not change this comment) */