Update and split ChangeLogs.
[bpt/emacs.git] / src / syswait.h
... / ...
CommitLineData
1/* Define wait system call interface for Emacs.
2 Copyright (C) 1993-1995, 2000-2011 Free Software Foundation, Inc.
3
4This file is part of GNU Emacs.
5
6GNU Emacs is free software: you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published by
8the Free Software Foundation, either version 3 of the License, or
9(at your option) any later version.
10
11GNU Emacs is distributed in the hope that it will be useful,
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
18
19/* Define the structure that the wait system call stores.
20 On many systems, there is a structure defined for this.
21 But on vanilla-ish USG systems there is not. */
22
23#ifndef EMACS_SYSWAIT_H
24#define EMACS_SYSWAIT_H
25
26#include <sys/types.h>
27
28#ifdef HAVE_SYS_WAIT_H /* We have sys/wait.h with POSIXoid definitions. */
29#include <sys/wait.h>
30#endif /* !HAVE_SYS_WAIT_H */
31
32#ifndef WCOREDUMP /* not POSIX */
33#define WCOREDUMP(status) ((status) & 0x80)
34#endif
35#ifndef WEXITSTATUS
36#define WEXITSTATUS(status) (((status) & 0xff00) >> 8)
37#endif
38#ifndef WIFEXITED
39#define WIFEXITED(status) (WTERMSIG(status) == 0)
40#endif
41#ifndef WIFSTOPPED
42#define WIFSTOPPED(status) (((status) & 0xff) == 0x7f)
43#endif
44#ifndef WIFSIGNALED
45#define WIFSIGNALED(status) (!WIFSTOPPED(status) && !WIFEXITED(status))
46#endif
47#ifndef WSTOPSIG
48#define WSTOPSIG(status) WEXITSTATUS(status)
49#endif
50#ifndef WTERMSIG
51#define WTERMSIG(status) ((status) & 0x7f)
52#endif
53
54#undef WRETCODE
55#define WRETCODE(status) WEXITSTATUS (status)
56
57
58#endif /* EMACS_SYSWAIT_H */
59