xref: /dflybsd-src/contrib/cvs-1.12/lib/wait.h (revision 86d7f5d305c6adaa56ff4582ece9859d73106103)
1*86d7f5d3SJohn Marino /* wait.h -- POSIX macros for evaluating exit statuses
2*86d7f5d3SJohn Marino    Copyright (C) 1990 Free Software Foundation, Inc.
3*86d7f5d3SJohn Marino 
4*86d7f5d3SJohn Marino    This program is free software; you can redistribute it and/or modify
5*86d7f5d3SJohn Marino    it under the terms of the GNU General Public License as published by
6*86d7f5d3SJohn Marino    the Free Software Foundation; either version 2, or (at your option)
7*86d7f5d3SJohn Marino    any later version.
8*86d7f5d3SJohn Marino 
9*86d7f5d3SJohn Marino    This program is distributed in the hope that it will be useful,
10*86d7f5d3SJohn Marino    but WITHOUT ANY WARRANTY; without even the implied warranty of
11*86d7f5d3SJohn Marino    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12*86d7f5d3SJohn Marino    GNU General Public License for more details.  */
13*86d7f5d3SJohn Marino 
14*86d7f5d3SJohn Marino #ifdef HAVE_SYS_WAIT_H
15*86d7f5d3SJohn Marino #include <sys/types.h>		/* For pid_t. */
16*86d7f5d3SJohn Marino #ifdef HAVE_SYS_RESOURCE_H
17*86d7f5d3SJohn Marino #include <sys/resource.h>	/* for rusage */
18*86d7f5d3SJohn Marino #endif
19*86d7f5d3SJohn Marino #include <sys/wait.h>
20*86d7f5d3SJohn Marino #endif
21*86d7f5d3SJohn Marino #ifndef WIFSTOPPED
22*86d7f5d3SJohn Marino #define WIFSTOPPED(w) (((w) & 0xff) == 0x7f)
23*86d7f5d3SJohn Marino #endif
24*86d7f5d3SJohn Marino #ifndef WIFSIGNALED
25*86d7f5d3SJohn Marino #define WIFSIGNALED(w) (((w) & 0xff) != 0x7f && ((w) & 0xff) != 0)
26*86d7f5d3SJohn Marino #endif
27*86d7f5d3SJohn Marino #ifndef WIFEXITED
28*86d7f5d3SJohn Marino #define WIFEXITED(w) (((w) & 0xff) == 0)
29*86d7f5d3SJohn Marino #endif
30*86d7f5d3SJohn Marino #ifndef WCOREDUMP	/* not POSIX, but common and useful */
31*86d7f5d3SJohn Marino #define WCOREDUMP(w) (((w) & 0x80) != 0)
32*86d7f5d3SJohn Marino #endif
33*86d7f5d3SJohn Marino 
34*86d7f5d3SJohn Marino #ifndef WSTOPSIG
35*86d7f5d3SJohn Marino #define WSTOPSIG(w) (((w) >> 8) & 0xff)
36*86d7f5d3SJohn Marino #endif
37*86d7f5d3SJohn Marino #ifndef WTERMSIG
38*86d7f5d3SJohn Marino #define WTERMSIG(w) ((w) & 0x7f)
39*86d7f5d3SJohn Marino #endif
40*86d7f5d3SJohn Marino #ifndef WEXITSTATUS
41*86d7f5d3SJohn Marino #define WEXITSTATUS(w) (((w) >> 8) & 0xff)
42*86d7f5d3SJohn Marino #endif
43