1*7c478bd9Sstevel@tonic-gate /* 2*7c478bd9Sstevel@tonic-gate * CDDL HEADER START 3*7c478bd9Sstevel@tonic-gate * 4*7c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*7c478bd9Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 6*7c478bd9Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 7*7c478bd9Sstevel@tonic-gate * with the License. 8*7c478bd9Sstevel@tonic-gate * 9*7c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*7c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 11*7c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 12*7c478bd9Sstevel@tonic-gate * and limitations under the License. 13*7c478bd9Sstevel@tonic-gate * 14*7c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 15*7c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*7c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 17*7c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 18*7c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 19*7c478bd9Sstevel@tonic-gate * 20*7c478bd9Sstevel@tonic-gate * CDDL HEADER END 21*7c478bd9Sstevel@tonic-gate */ 22*7c478bd9Sstevel@tonic-gate /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ 23*7c478bd9Sstevel@tonic-gate /* All Rights Reserved */ 24*7c478bd9Sstevel@tonic-gate 25*7c478bd9Sstevel@tonic-gate 26*7c478bd9Sstevel@tonic-gate /* 27*7c478bd9Sstevel@tonic-gate * Copyright 2004 Sun Microsystems, Inc. All rights reserved. 28*7c478bd9Sstevel@tonic-gate * Use is subject to license terms. 29*7c478bd9Sstevel@tonic-gate */ 30*7c478bd9Sstevel@tonic-gate 31*7c478bd9Sstevel@tonic-gate #ifndef _SYS_WAIT_H 32*7c478bd9Sstevel@tonic-gate #define _SYS_WAIT_H 33*7c478bd9Sstevel@tonic-gate 34*7c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.10 */ 35*7c478bd9Sstevel@tonic-gate 36*7c478bd9Sstevel@tonic-gate #include <sys/feature_tests.h> 37*7c478bd9Sstevel@tonic-gate 38*7c478bd9Sstevel@tonic-gate #include <sys/types.h> 39*7c478bd9Sstevel@tonic-gate 40*7c478bd9Sstevel@tonic-gate #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) 41*7c478bd9Sstevel@tonic-gate #include <sys/resource.h> /* Added for XSH4.2 */ 42*7c478bd9Sstevel@tonic-gate #include <sys/siginfo.h> 43*7c478bd9Sstevel@tonic-gate #include <sys/procset.h> 44*7c478bd9Sstevel@tonic-gate #endif /* !defined(__XOPEN_OR_POSIX) || (defined(_XPG4_2) ... */ 45*7c478bd9Sstevel@tonic-gate 46*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 47*7c478bd9Sstevel@tonic-gate extern "C" { 48*7c478bd9Sstevel@tonic-gate #endif 49*7c478bd9Sstevel@tonic-gate 50*7c478bd9Sstevel@tonic-gate /* 51*7c478bd9Sstevel@tonic-gate * arguments to wait functions 52*7c478bd9Sstevel@tonic-gate */ 53*7c478bd9Sstevel@tonic-gate 54*7c478bd9Sstevel@tonic-gate #define WUNTRACED 0004 /* wait for processes stopped by signals */ 55*7c478bd9Sstevel@tonic-gate #define WNOHANG 0100 /* non blocking form of wait */ 56*7c478bd9Sstevel@tonic-gate 57*7c478bd9Sstevel@tonic-gate 58*7c478bd9Sstevel@tonic-gate #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) 59*7c478bd9Sstevel@tonic-gate #define WEXITED 0001 /* wait for processes that have exited */ 60*7c478bd9Sstevel@tonic-gate #define WTRAPPED 0002 /* wait for processes stopped while tracing */ 61*7c478bd9Sstevel@tonic-gate #define WSTOPPED WUNTRACED /* backwards compatibility */ 62*7c478bd9Sstevel@tonic-gate #define WCONTINUED 0010 /* wait for processes continued */ 63*7c478bd9Sstevel@tonic-gate #define WNOWAIT 0200 /* non destructive form of wait */ 64*7c478bd9Sstevel@tonic-gate #define WOPTMASK (WEXITED|WTRAPPED|WSTOPPED|WCONTINUED|WNOHANG|WNOWAIT) 65*7c478bd9Sstevel@tonic-gate #endif /* !defined(__XOPEN_OR_POSIX) || (defined(_XPG4_2) ... */ 66*7c478bd9Sstevel@tonic-gate 67*7c478bd9Sstevel@tonic-gate /* 68*7c478bd9Sstevel@tonic-gate * macros for stat return from wait functions 69*7c478bd9Sstevel@tonic-gate */ 70*7c478bd9Sstevel@tonic-gate 71*7c478bd9Sstevel@tonic-gate #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) 72*7c478bd9Sstevel@tonic-gate 73*7c478bd9Sstevel@tonic-gate #define WSTOPFLG 0177 74*7c478bd9Sstevel@tonic-gate #define WCONTFLG 0177777 75*7c478bd9Sstevel@tonic-gate #define WCOREFLG 0200 76*7c478bd9Sstevel@tonic-gate #define WSIGMASK 0177 77*7c478bd9Sstevel@tonic-gate 78*7c478bd9Sstevel@tonic-gate #define WLOBYTE(stat) ((int)((stat)&0377)) 79*7c478bd9Sstevel@tonic-gate #define WHIBYTE(stat) ((int)(((stat)>>8)&0377)) 80*7c478bd9Sstevel@tonic-gate #define WWORD(stat) ((int)((stat))&0177777) 81*7c478bd9Sstevel@tonic-gate 82*7c478bd9Sstevel@tonic-gate #define WIFCONTINUED(stat) (WWORD(stat) == WCONTFLG) 83*7c478bd9Sstevel@tonic-gate #define WCOREDUMP(stat) ((stat)&WCOREFLG) 84*7c478bd9Sstevel@tonic-gate 85*7c478bd9Sstevel@tonic-gate #endif /* !defined(__XOPEN_OR_POSIX) || (defined(_XPG4_2) ... */ 86*7c478bd9Sstevel@tonic-gate 87*7c478bd9Sstevel@tonic-gate #define WIFEXITED(stat) ((int)((stat)&0xFF) == 0) 88*7c478bd9Sstevel@tonic-gate #define WIFSIGNALED(stat) ((int)((stat)&0xFF) > 0 && \ 89*7c478bd9Sstevel@tonic-gate (int)((stat)&0xFF00) == 0) 90*7c478bd9Sstevel@tonic-gate #define WIFSTOPPED(stat) ((int)((stat)&0xFF) == 0177 && \ 91*7c478bd9Sstevel@tonic-gate (int)((stat)&0xFF00) != 0) 92*7c478bd9Sstevel@tonic-gate #define WEXITSTATUS(stat) ((int)(((stat)>>8)&0xFF)) 93*7c478bd9Sstevel@tonic-gate #define WTERMSIG(stat) ((int)((stat)&0x7F)) 94*7c478bd9Sstevel@tonic-gate #define WSTOPSIG(stat) ((int)(((stat)>>8)&0xFF)) 95*7c478bd9Sstevel@tonic-gate 96*7c478bd9Sstevel@tonic-gate 97*7c478bd9Sstevel@tonic-gate #if !defined(_KERNEL) 98*7c478bd9Sstevel@tonic-gate #if defined(__STDC__) 99*7c478bd9Sstevel@tonic-gate 100*7c478bd9Sstevel@tonic-gate extern pid_t wait(int *); 101*7c478bd9Sstevel@tonic-gate extern pid_t waitpid(pid_t, int *, int); 102*7c478bd9Sstevel@tonic-gate 103*7c478bd9Sstevel@tonic-gate #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) 104*7c478bd9Sstevel@tonic-gate extern int waitid(idtype_t, id_t, siginfo_t *, int); 105*7c478bd9Sstevel@tonic-gate /* Marked as LEGACY in SUSv2 and removed in SUSv3 */ 106*7c478bd9Sstevel@tonic-gate #if !defined(_XPG6) || defined(__EXTENSIONS__) 107*7c478bd9Sstevel@tonic-gate extern pid_t wait3(int *, int, struct rusage *); 108*7c478bd9Sstevel@tonic-gate #endif /* !defined(_XPG6) || defined(__EXTENSIONS__) */ 109*7c478bd9Sstevel@tonic-gate #endif /* !defined(__XOPEN_OR_POSIX) || (defined(_XPG4_2) ... */ 110*7c478bd9Sstevel@tonic-gate 111*7c478bd9Sstevel@tonic-gate #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 112*7c478bd9Sstevel@tonic-gate extern pid_t wait4(pid_t, int *, int, struct rusage *); 113*7c478bd9Sstevel@tonic-gate #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ 114*7c478bd9Sstevel@tonic-gate 115*7c478bd9Sstevel@tonic-gate #else /* __STDC__ */ 116*7c478bd9Sstevel@tonic-gate 117*7c478bd9Sstevel@tonic-gate extern pid_t wait(); 118*7c478bd9Sstevel@tonic-gate extern pid_t waitpid(); 119*7c478bd9Sstevel@tonic-gate #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) 120*7c478bd9Sstevel@tonic-gate extern int waitid(); 121*7c478bd9Sstevel@tonic-gate /* Marked as LEGACY in SUSv2 and removed in SUSv3 */ 122*7c478bd9Sstevel@tonic-gate #if !defined(_XPG6) || defined(__EXTENSIONS__) 123*7c478bd9Sstevel@tonic-gate extern pid_t wait3(); 124*7c478bd9Sstevel@tonic-gate #endif /* !defined(_XPG6) || defined(__EXTENSIONS__) */ 125*7c478bd9Sstevel@tonic-gate #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ 126*7c478bd9Sstevel@tonic-gate 127*7c478bd9Sstevel@tonic-gate #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 128*7c478bd9Sstevel@tonic-gate extern pid_t wait4(); 129*7c478bd9Sstevel@tonic-gate #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ 130*7c478bd9Sstevel@tonic-gate 131*7c478bd9Sstevel@tonic-gate #endif /* __STDC__ */ 132*7c478bd9Sstevel@tonic-gate #endif /* _KERNEL */ 133*7c478bd9Sstevel@tonic-gate 134*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 135*7c478bd9Sstevel@tonic-gate } 136*7c478bd9Sstevel@tonic-gate #endif 137*7c478bd9Sstevel@tonic-gate 138*7c478bd9Sstevel@tonic-gate #endif /* _SYS_WAIT_H */ 139