xref: /titanic_41/usr/src/lib/libast/common/include/wait.h (revision 0bb073995ac5a95bd35f2dd790df1ea3d8c2d507)
1 /***********************************************************************
2 *                                                                      *
3 *               This software is part of the ast package               *
4 *           Copyright (c) 1985-2007 AT&T Knowledge Ventures            *
5 *                      and is licensed under the                       *
6 *                  Common Public License, Version 1.0                  *
7 *                      by AT&T Knowledge Ventures                      *
8 *                                                                      *
9 *                A copy of the License is available at                 *
10 *            http://www.opensource.org/licenses/cpl1.0.txt             *
11 *         (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9)         *
12 *                                                                      *
13 *              Information and Software Systems Research               *
14 *                            AT&T Research                             *
15 *                           Florham Park NJ                            *
16 *                                                                      *
17 *                 Glenn Fowler <gsf@research.att.com>                  *
18 *                  David Korn <dgk@research.att.com>                   *
19 *                   Phong Vo <kpv@research.att.com>                    *
20 *                                                                      *
21 ***********************************************************************/
22 #pragma prototyped
23 /*
24  * ast POSIX wait/exit support
25  */
26 
27 #ifndef _WAIT_H
28 #define _WAIT_H
29 
30 #include <ast.h>
31 #include <ast_wait.h>
32 
33 #if _sys_wait
34 #if defined(__STDPP__directive) && defined(__STDPP__hide)
35 __STDPP__directive pragma pp:hide wait waitpid
36 #else
37 #define wait		______wait
38 #define waitpid		______waitpid
39 #endif
40 #include <sys/wait.h>
41 #if defined(__STDPP__directive) && defined(__STDPP__hide)
42 __STDPP__directive pragma pp:nohide wait waitpid
43 #else
44 #undef	wait
45 #undef	waitpid
46 #endif
47 #endif
48 
49 #ifndef WNOHANG
50 #define WNOHANG		1
51 #endif
52 
53 #ifndef WUNTRACED
54 #define WUNTRACED	2
55 #endif
56 
57 #if !_ok_wif
58 #undef	WIFEXITED
59 #undef	WEXITSTATUS
60 #undef	WIFSIGNALED
61 #undef	WTERMSIG
62 #undef	WIFSTOPPED
63 #undef	WSTOPSIG
64 #undef	WTERMCORE
65 #endif
66 
67 #ifndef WIFEXITED
68 #define WIFEXITED(x)	(!((x)&((1<<(EXIT_BITS-1))-1)))
69 #endif
70 
71 #ifndef WEXITSTATUS
72 #define WEXITSTATUS(x)	(((x)>>EXIT_BITS)&((1<<EXIT_BITS)-1))
73 #endif
74 
75 #ifndef WIFSIGNALED
76 #define WIFSIGNALED(x)	(((x)&((1<<(EXIT_BITS-1))-1))!=0)
77 #endif
78 
79 #ifndef WTERMSIG
80 #define WTERMSIG(x)	((x)&((1<<(EXIT_BITS-1))-1))
81 #endif
82 
83 #ifndef WIFSTOPPED
84 #define WIFSTOPPED(x)	(((x)&((1<<EXIT_BITS)-1))==((1<<(EXIT_BITS-1))-1))
85 #endif
86 
87 #ifndef WSTOPSIG
88 #define WSTOPSIG(x)	WEXITSTATUS(x)
89 #endif
90 
91 #ifndef WTERMCORE
92 #define WTERMCORE(x)	((x)&(1<<(EXIT_BITS-1)))
93 #endif
94 
95 extern pid_t		wait(int*);
96 extern pid_t		waitpid(pid_t, int*, int);
97 
98 #endif
99