os/ossrv/genericopenlibs/openenvcore/include/sys/wait.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/ossrv/genericopenlibs/openenvcore/include/sys/wait.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,116 @@
     1.4 +/*-
     1.5 + * Copyright (c) 1982, 1986, 1989, 1993, 1994
     1.6 + *	The Regents of the University of California.  All rights reserved.
     1.7 + *
     1.8 + * Redistribution and use in source and binary forms, with or without
     1.9 + * modification, are permitted provided that the following conditions
    1.10 + * are met:
    1.11 + * 1. Redistributions of source code must retain the above copyright
    1.12 + *    notice, this list of conditions and the following disclaimer.
    1.13 + * 2. Redistributions in binary form must reproduce the above copyright
    1.14 + *    notice, this list of conditions and the following disclaimer in the
    1.15 + *    documentation and/or other materials provided with the distribution.
    1.16 + * 4. Neither the name of the University nor the names of its contributors
    1.17 + *    may be used to endorse or promote products derived from this software
    1.18 + *    without specific prior written permission.
    1.19 + *
    1.20 + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
    1.21 + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    1.22 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
    1.23 + * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
    1.24 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
    1.25 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
    1.26 + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
    1.27 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
    1.28 + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
    1.29 + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    1.30 + * SUCH DAMAGE.
    1.31 + * © * Portions Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.
    1.32 + *	@(#)wait.h	8.2 (Berkeley) 7/10/94
    1.33 + * $FreeBSD: src/sys/sys/wait.h,v 1.21 2005/01/05 22:19:44 jhb Exp $
    1.34 + */
    1.35 +
    1.36 +#ifndef _SYS_WAIT_H_
    1.37 +#define _SYS_WAIT_H_
    1.38 +
    1.39 +#include <sys/cdefs.h>
    1.40 +
    1.41 +/*
    1.42 + * This file holds definitions relevant to the wait4 system call and the
    1.43 + * alternate interfaces that use it (wait, wait3, waitpid).
    1.44 + */
    1.45 +
    1.46 +/*
    1.47 + * Macros to test the exit status returned by wait and extract the relevant
    1.48 + * values.
    1.49 + */
    1.50 +#if __BSD_VISIBLE
    1.51 +#define	_W_INT(w)	(*(int *)&(w))	/* Convert union wait to int. */
    1.52 +#define	WCOREFLAG	0200
    1.53 +#else
    1.54 +#define	_W_INT(i)	(i)
    1.55 +#endif
    1.56 +
    1.57 +#define	_WSTATUS(x)	(_W_INT(x) & 0177)
    1.58 +#define	_WSTOPPED	0177		/* _WSTATUS if process is stopped */
    1.59 +#define	WIFSTOPPED(x)	(_WSTATUS(x) == _WSTOPPED)
    1.60 +#define	WSTOPSIG(x)	(_W_INT(x) >> 8)
    1.61 +#define	WIFSIGNALED(x)	(_WSTATUS(x) != _WSTOPPED && _WSTATUS(x) != 0)
    1.62 +#define	WTERMSIG(x)	(_WSTATUS(x))
    1.63 +#define	WIFEXITED(x)	(_WSTATUS(x) == 0)
    1.64 +#define	WEXITSTATUS(x)	(_W_INT(x) >> 8)
    1.65 +#define	WIFCONTINUED(x)	(x == 0x13)	/* 0x13 == SIGCONT */
    1.66 +#if __BSD_VISIBLE
    1.67 +#define	WCOREDUMP(x)	(_W_INT(x) & WCOREFLAG)
    1.68 +
    1.69 +#define	W_EXITCODE(ret, sig)	((ret) << 8 | (sig))
    1.70 +#define	W_STOPCODE(sig)		((sig) << 8 | _WSTOPPED)
    1.71 +#endif
    1.72 +
    1.73 +#ifdef __SYMBIAN32__
    1.74 +#define WIFTERMINATED(x) (_WSTATUS(x)==1)
    1.75 +#define WTERMINATESTATUS(x)	 (_W_INT(x) >> 8)
    1.76 +#define WIFPANICED(x)	 (_WSTATUS(x)==2)
    1.77 +#define WPANICCODE(x)		 (_W_INT(x) >> 8)
    1.78 +#endif	/* __SYMBIAN32__ */
    1.79 +
    1.80 +/*
    1.81 + * Option bits for the third argument of wait4.  WNOHANG causes the
    1.82 + * wait to not hang if there are no stopped or terminated processes, rather
    1.83 + * returning an error indication in this case (pid==0).  WUNTRACED
    1.84 + * indicates that the caller should receive status about untraced children
    1.85 + * which stop due to signals.  If children are stopped and a wait without
    1.86 + * this option is done, it is as though they were still running... nothing
    1.87 + * about them is returned.
    1.88 + */
    1.89 +#define	WNOHANG		1	/* Don't hang in wait. */
    1.90 +#define	WUNTRACED	2	/* Tell about stopped, untraced children. */
    1.91 +#define	WCONTINUED	4	/* Report a job control continued process. */
    1.92 +
    1.93 +#if __BSD_VISIBLE
    1.94 +#define	WLINUXCLONE 0x80000000	/* Wait for kthread spawned from linux_clone. */
    1.95 +#endif
    1.96 +
    1.97 +/*
    1.98 + * Tokens for special values of the "pid" parameter to wait4.
    1.99 + */
   1.100 +#if __BSD_VISIBLE
   1.101 +#define	WAIT_ANY	(-1)	/* any process */
   1.102 +#define	WAIT_MYPGRP	0	/* any process in my process group */
   1.103 +#endif /* __BSD_VISIBLE */
   1.104 +
   1.105 +#ifndef _KERNEL
   1.106 +#include <sys/types.h>
   1.107 +
   1.108 +__BEGIN_DECLS
   1.109 +IMPORT_C
   1.110 +pid_t	wait(int *);
   1.111 +IMPORT_C
   1.112 +pid_t	waitpid(pid_t, int *, int);
   1.113 +#if __BSD_VISIBLE
   1.114 +struct rusage;
   1.115 +#endif
   1.116 +__END_DECLS
   1.117 +#endif /* !_KERNEL */
   1.118 +
   1.119 +#endif /* !_SYS_WAIT_H_ */