epoc32/include/stdapis/sys/wait.h
branchSymbian2
changeset 2 2fe1408b6811
parent 0 061f57f2323e
child 4 837f303aceeb
equal deleted inserted replaced
1:666f914201fb 2:2fe1408b6811
     1 wait.h
     1 /*-
       
     2  * Copyright (c) 1982, 1986, 1989, 1993, 1994
       
     3  *	The Regents of the University of California.  All rights reserved.
       
     4  *
       
     5  * Redistribution and use in source and binary forms, with or without
       
     6  * modification, are permitted provided that the following conditions
       
     7  * are met:
       
     8  * 1. Redistributions of source code must retain the above copyright
       
     9  *    notice, this list of conditions and the following disclaimer.
       
    10  * 2. Redistributions in binary form must reproduce the above copyright
       
    11  *    notice, this list of conditions and the following disclaimer in the
       
    12  *    documentation and/or other materials provided with the distribution.
       
    13  * 4. Neither the name of the University nor the names of its contributors
       
    14  *    may be used to endorse or promote products derived from this software
       
    15  *    without specific prior written permission.
       
    16  *
       
    17  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
       
    18  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
       
    19  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
       
    20  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
       
    21  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
       
    22  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
       
    23  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
       
    24  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
       
    25  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
       
    26  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
       
    27  * SUCH DAMAGE.
       
    28  * © Portions copyright (c) 2007 Symbian Software Ltd. All rights reserved.
       
    29  *	@(#)wait.h	8.2 (Berkeley) 7/10/94
       
    30  * $FreeBSD: src/sys/sys/wait.h,v 1.21 2005/01/05 22:19:44 jhb Exp $
       
    31  */
       
    32 
       
    33 #ifndef _SYS_WAIT_H_
       
    34 #define _SYS_WAIT_H_
       
    35 
       
    36 #include <sys/cdefs.h>
       
    37 
       
    38 /*
       
    39  * This file holds definitions relevant to the wait4 system call and the
       
    40  * alternate interfaces that use it (wait, wait3, waitpid).
       
    41  */
       
    42 
       
    43 /*
       
    44  * Macros to test the exit status returned by wait and extract the relevant
       
    45  * values.
       
    46  */
       
    47 #if __BSD_VISIBLE
       
    48 #define	_W_INT(w)	(*(int *)&(w))	/* Convert union wait to int. */
       
    49 #define	WCOREFLAG	0200
       
    50 #else
       
    51 #define	_W_INT(i)	(i)
       
    52 #endif
       
    53 
       
    54 #define	_WSTATUS(x)	(_W_INT(x) & 0177)
       
    55 #define	_WSTOPPED	0177		/* _WSTATUS if process is stopped */
       
    56 #define	WIFSTOPPED(x)	(_WSTATUS(x) == _WSTOPPED)
       
    57 #define	WSTOPSIG(x)	(_W_INT(x) >> 8)
       
    58 #define	WIFSIGNALED(x)	(_WSTATUS(x) != _WSTOPPED && _WSTATUS(x) != 0)
       
    59 #define	WTERMSIG(x)	(_WSTATUS(x))
       
    60 #define	WIFEXITED(x)	(_WSTATUS(x) == 0)
       
    61 #define	WEXITSTATUS(x)	(_W_INT(x) >> 8)
       
    62 #define	WIFCONTINUED(x)	(x == 0x13)	/* 0x13 == SIGCONT */
       
    63 #if __BSD_VISIBLE
       
    64 #define	WCOREDUMP(x)	(_W_INT(x) & WCOREFLAG)
       
    65 
       
    66 #define	W_EXITCODE(ret, sig)	((ret) << 8 | (sig))
       
    67 #define	W_STOPCODE(sig)		((sig) << 8 | _WSTOPPED)
       
    68 #endif
       
    69 
       
    70 #ifdef __SYMBIAN32__
       
    71 #define WIFTERMINATED(x) (_WSTATUS(x)==1)
       
    72 #define WTERMINATESTATUS(x)	 (_W_INT(x) >> 8)
       
    73 #define WIFPANICED(x)	 (_WSTATUS(x)==2)
       
    74 #define WPANICCODE(x)		 (_W_INT(x) >> 8)
       
    75 #endif	/* __SYMBIAN32__ */
       
    76 
       
    77 /*
       
    78  * Option bits for the third argument of wait4.  WNOHANG causes the
       
    79  * wait to not hang if there are no stopped or terminated processes, rather
       
    80  * returning an error indication in this case (pid==0).  WUNTRACED
       
    81  * indicates that the caller should receive status about untraced children
       
    82  * which stop due to signals.  If children are stopped and a wait without
       
    83  * this option is done, it is as though they were still running... nothing
       
    84  * about them is returned.
       
    85  */
       
    86 #define	WNOHANG		1	/* Don't hang in wait. */
       
    87 #define	WUNTRACED	2	/* Tell about stopped, untraced children. */
       
    88 #define	WCONTINUED	4	/* Report a job control continued process. */
       
    89 
       
    90 #if __BSD_VISIBLE
       
    91 #define	WLINUXCLONE 0x80000000	/* Wait for kthread spawned from linux_clone. */
       
    92 #endif
       
    93 
       
    94 /*
       
    95  * Tokens for special values of the "pid" parameter to wait4.
       
    96  */
       
    97 #if __BSD_VISIBLE
       
    98 #define	WAIT_ANY	(-1)	/* any process */
       
    99 #define	WAIT_MYPGRP	0	/* any process in my process group */
       
   100 #endif /* __BSD_VISIBLE */
       
   101 
       
   102 #ifndef _KERNEL
       
   103 #include <sys/types.h>
       
   104 
       
   105 __BEGIN_DECLS
       
   106 IMPORT_C
       
   107 pid_t	wait(int *);
       
   108 IMPORT_C
       
   109 pid_t	waitpid(pid_t, int *, int);
       
   110 #if __BSD_VISIBLE
       
   111 struct rusage;
       
   112 #endif
       
   113 __END_DECLS
       
   114 #endif /* !_KERNEL */
       
   115 
       
   116 #endif /* !_SYS_WAIT_H_ */