Commit | Line | Data |
---|---|---|
43626ea4 | 1 | /* Define wait system call interface for Emacs. |
ab422c4d | 2 | Copyright (C) 1993-1995, 2000-2013 Free Software Foundation, Inc. |
43626ea4 RS |
3 | |
4 | This file is part of GNU Emacs. | |
5 | ||
b9b1cc14 | 6 | GNU Emacs is free software: you can redistribute it and/or modify |
43626ea4 | 7 | it under the terms of the GNU General Public License as published by |
b9b1cc14 GM |
8 | the Free Software Foundation, either version 3 of the License, or |
9 | (at your option) any later version. | |
43626ea4 RS |
10 | |
11 | GNU Emacs is distributed in the hope that it will be useful, | |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | GNU General Public License for more details. | |
15 | ||
16 | You should have received a copy of the GNU General Public License | |
b9b1cc14 | 17 | along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ |
43626ea4 RS |
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 | ||
d72c1cad DL |
23 | #ifndef EMACS_SYSWAIT_H |
24 | #define EMACS_SYSWAIT_H | |
25 | ||
bb5f74ee | 26 | #include <stdbool.h> |
d72c1cad | 27 | #include <sys/types.h> |
1f0bb0ab | 28 | |
3bddb272 | 29 | #ifdef HAVE_SYS_WAIT_H /* We have sys/wait.h with POSIXoid definitions. */ |
d72c1cad | 30 | #include <sys/wait.h> |
557713d8 RS |
31 | #endif /* !HAVE_SYS_WAIT_H */ |
32 | ||
1f0bb0ab DL |
33 | #ifndef WCOREDUMP /* not POSIX */ |
34 | #define WCOREDUMP(status) ((status) & 0x80) | |
d72c1cad | 35 | #endif |
557713d8 | 36 | #ifndef WEXITSTATUS |
1f0bb0ab | 37 | #define WEXITSTATUS(status) (((status) & 0xff00) >> 8) |
557713d8 RS |
38 | #endif |
39 | #ifndef WIFEXITED | |
1f0bb0ab | 40 | #define WIFEXITED(status) (WTERMSIG(status) == 0) |
557713d8 RS |
41 | #endif |
42 | #ifndef WIFSTOPPED | |
1f0bb0ab | 43 | #define WIFSTOPPED(status) (((status) & 0xff) == 0x7f) |
557713d8 RS |
44 | #endif |
45 | #ifndef WIFSIGNALED | |
1f0bb0ab | 46 | #define WIFSIGNALED(status) (!WIFSTOPPED(status) && !WIFEXITED(status)) |
557713d8 RS |
47 | #endif |
48 | #ifndef WSTOPSIG | |
1f0bb0ab | 49 | #define WSTOPSIG(status) WEXITSTATUS(status) |
557713d8 RS |
50 | #endif |
51 | #ifndef WTERMSIG | |
1f0bb0ab | 52 | #define WTERMSIG(status) ((status) & 0x7f) |
557713d8 | 53 | #endif |
d72c1cad | 54 | |
afea8a8a | 55 | /* Defined in sysdep.c. */ |
bb5f74ee PE |
56 | extern void wait_for_termination (pid_t, int *, bool); |
57 | extern pid_t child_status_changed (pid_t, int *, int); | |
afea8a8a | 58 | |
d72c1cad | 59 | #endif /* EMACS_SYSWAIT_H */ |