4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
22 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
23 /* All Rights Reserved */
27 * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
28 * Use is subject to license terms.
34 #pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.10 */
36 #include <sys/feature_tests.h>
38 #include <sys/types.h>
40 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__)
41 #include <sys/resource.h> /* Added for XSH4.2 */
42 #include <sys/siginfo.h>
43 #include <sys/procset.h>
44 #endif /* !defined(__XOPEN_OR_POSIX) || (defined(_XPG4_2) ... */
51 * arguments to wait functions
54 #define WUNTRACED 0004 /* wait for processes stopped by signals */
55 #define WNOHANG 0100 /* non blocking form of wait */
58 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__)
59 #define WEXITED 0001 /* wait for processes that have exited */
60 #define WTRAPPED 0002 /* wait for processes stopped while tracing */
61 #define WSTOPPED WUNTRACED /* backwards compatibility */
62 #define WCONTINUED 0010 /* wait for processes continued */
63 #define WNOWAIT 0200 /* non destructive form of wait */
64 #define WOPTMASK (WEXITED|WTRAPPED|WSTOPPED|WCONTINUED|WNOHANG|WNOWAIT)
65 #endif /* !defined(__XOPEN_OR_POSIX) || (defined(_XPG4_2) ... */
68 * macros for stat return from wait functions
71 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__)
74 #define WCONTFLG 0177777
78 #define WLOBYTE(stat) ((int)((stat)&0377))
79 #define WHIBYTE(stat) ((int)(((stat)>>8)&0377))
80 #define WWORD(stat) ((int)((stat))&0177777)
82 #define WIFCONTINUED(stat) (WWORD(stat) == WCONTFLG)
83 #define WCOREDUMP(stat) ((stat)&WCOREFLG)
85 #endif /* !defined(__XOPEN_OR_POSIX) || (defined(_XPG4_2) ... */
87 #define WIFEXITED(stat) ((int)((stat)&0xFF) == 0)
88 #define WIFSIGNALED(stat) ((int)((stat)&0xFF) > 0 && \
89 (int)((stat)&0xFF00) == 0)
90 #define WIFSTOPPED(stat) ((int)((stat)&0xFF) == 0177 && \
91 (int)((stat)&0xFF00) != 0)
92 #define WEXITSTATUS(stat) ((int)(((stat)>>8)&0xFF))
93 #define WTERMSIG(stat) ((int)((stat)&0x7F))
94 #define WSTOPSIG(stat) ((int)(((stat)>>8)&0xFF))
100 extern pid_t
wait(int *);
101 extern pid_t
waitpid(pid_t
, int *, int);
103 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__)
104 extern int waitid(idtype_t
, id_t
, siginfo_t
*, int);
105 /* Marked as LEGACY in SUSv2 and removed in SUSv3 */
106 #if !defined(_XPG6) || defined(__EXTENSIONS__)
107 extern pid_t
wait3(int *, int, struct rusage
*);
108 #endif /* !defined(_XPG6) || defined(__EXTENSIONS__) */
109 #endif /* !defined(__XOPEN_OR_POSIX) || (defined(_XPG4_2) ... */
111 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
112 extern pid_t
wait4(pid_t
, int *, int, struct rusage
*);
113 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
118 extern pid_t
waitpid();
119 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__)
121 /* Marked as LEGACY in SUSv2 and removed in SUSv3 */
122 #if !defined(_XPG6) || defined(__EXTENSIONS__)
123 extern pid_t
wait3();
124 #endif /* !defined(_XPG6) || defined(__EXTENSIONS__) */
125 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
127 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
128 extern pid_t
wait4();
129 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
131 #endif /* __STDC__ */
138 #endif /* _SYS_WAIT_H */