sl@0: /*- sl@0: * Copyright (c) 1982, 1986, 1989, 1993, 1994 sl@0: * The Regents of the University of California. All rights reserved. sl@0: * sl@0: * Redistribution and use in source and binary forms, with or without sl@0: * modification, are permitted provided that the following conditions sl@0: * are met: sl@0: * 1. Redistributions of source code must retain the above copyright sl@0: * notice, this list of conditions and the following disclaimer. sl@0: * 2. Redistributions in binary form must reproduce the above copyright sl@0: * notice, this list of conditions and the following disclaimer in the sl@0: * documentation and/or other materials provided with the distribution. sl@0: * 4. Neither the name of the University nor the names of its contributors sl@0: * may be used to endorse or promote products derived from this software sl@0: * without specific prior written permission. sl@0: * sl@0: * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND sl@0: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE sl@0: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE sl@0: * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE sl@0: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL sl@0: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS sl@0: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) sl@0: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT sl@0: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY sl@0: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF sl@0: * SUCH DAMAGE. sl@0: * © * Portions Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. sl@0: * @(#)wait.h 8.2 (Berkeley) 7/10/94 sl@0: * $FreeBSD: src/sys/sys/wait.h,v 1.21 2005/01/05 22:19:44 jhb Exp $ sl@0: */ sl@0: sl@0: #ifndef _SYS_WAIT_H_ sl@0: #define _SYS_WAIT_H_ sl@0: sl@0: #include sl@0: sl@0: /* sl@0: * This file holds definitions relevant to the wait4 system call and the sl@0: * alternate interfaces that use it (wait, wait3, waitpid). sl@0: */ sl@0: sl@0: /* sl@0: * Macros to test the exit status returned by wait and extract the relevant sl@0: * values. sl@0: */ sl@0: #if __BSD_VISIBLE sl@0: #define _W_INT(w) (*(int *)&(w)) /* Convert union wait to int. */ sl@0: #define WCOREFLAG 0200 sl@0: #else sl@0: #define _W_INT(i) (i) sl@0: #endif sl@0: sl@0: #define _WSTATUS(x) (_W_INT(x) & 0177) sl@0: #define _WSTOPPED 0177 /* _WSTATUS if process is stopped */ sl@0: #define WIFSTOPPED(x) (_WSTATUS(x) == _WSTOPPED) sl@0: #define WSTOPSIG(x) (_W_INT(x) >> 8) sl@0: #define WIFSIGNALED(x) (_WSTATUS(x) != _WSTOPPED && _WSTATUS(x) != 0) sl@0: #define WTERMSIG(x) (_WSTATUS(x)) sl@0: #define WIFEXITED(x) (_WSTATUS(x) == 0) sl@0: #define WEXITSTATUS(x) (_W_INT(x) >> 8) sl@0: #define WIFCONTINUED(x) (x == 0x13) /* 0x13 == SIGCONT */ sl@0: #if __BSD_VISIBLE sl@0: #define WCOREDUMP(x) (_W_INT(x) & WCOREFLAG) sl@0: sl@0: #define W_EXITCODE(ret, sig) ((ret) << 8 | (sig)) sl@0: #define W_STOPCODE(sig) ((sig) << 8 | _WSTOPPED) sl@0: #endif sl@0: sl@0: #ifdef __SYMBIAN32__ sl@0: #define WIFTERMINATED(x) (_WSTATUS(x)==1) sl@0: #define WTERMINATESTATUS(x) (_W_INT(x) >> 8) sl@0: #define WIFPANICED(x) (_WSTATUS(x)==2) sl@0: #define WPANICCODE(x) (_W_INT(x) >> 8) sl@0: #endif /* __SYMBIAN32__ */ sl@0: sl@0: /* sl@0: * Option bits for the third argument of wait4. WNOHANG causes the sl@0: * wait to not hang if there are no stopped or terminated processes, rather sl@0: * returning an error indication in this case (pid==0). WUNTRACED sl@0: * indicates that the caller should receive status about untraced children sl@0: * which stop due to signals. If children are stopped and a wait without sl@0: * this option is done, it is as though they were still running... nothing sl@0: * about them is returned. sl@0: */ sl@0: #define WNOHANG 1 /* Don't hang in wait. */ sl@0: #define WUNTRACED 2 /* Tell about stopped, untraced children. */ sl@0: #define WCONTINUED 4 /* Report a job control continued process. */ sl@0: sl@0: #if __BSD_VISIBLE sl@0: #define WLINUXCLONE 0x80000000 /* Wait for kthread spawned from linux_clone. */ sl@0: #endif sl@0: sl@0: /* sl@0: * Tokens for special values of the "pid" parameter to wait4. sl@0: */ sl@0: #if __BSD_VISIBLE sl@0: #define WAIT_ANY (-1) /* any process */ sl@0: #define WAIT_MYPGRP 0 /* any process in my process group */ sl@0: #endif /* __BSD_VISIBLE */ sl@0: sl@0: #ifndef _KERNEL sl@0: #include sl@0: sl@0: __BEGIN_DECLS sl@0: IMPORT_C sl@0: pid_t wait(int *); sl@0: IMPORT_C sl@0: pid_t waitpid(pid_t, int *, int); sl@0: #if __BSD_VISIBLE sl@0: struct rusage; sl@0: #endif sl@0: __END_DECLS sl@0: #endif /* !_KERNEL */ sl@0: sl@0: #endif /* !_SYS_WAIT_H_ */