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