[BACK]Return to wait.h CVS log [TXT][DIR] Up to [local] / prex-old / include / sys

Annotation of prex-old/include/sys/wait.h, Revision 1.1.1.1

1.1       nbrk        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:  * 3. 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:  *
                     29:  *     @(#)wait.h      8.2 (Berkeley) 7/10/94
                     30:  */
                     31:
                     32: /*
                     33:  * This file holds definitions relevent to the wait4 system call
                     34:  * and the alternate interfaces that use it (wait, wait3, waitpid).
                     35:  */
                     36:
                     37: /*
                     38:  * Macros to test the exit status returned by wait
                     39:  * and extract the relevant values.
                     40:  */
                     41: #ifdef _POSIX_SOURCE
                     42: #define        _W_INT(i)       (i)
                     43: #else
                     44: #define        _W_INT(w)       (*(int *)&(w))  /* convert union wait to int */
                     45: #define        WCOREFLAG       0200
                     46: #endif
                     47:
                     48: #define        _WSTATUS(x)     (_W_INT(x) & 0177)
                     49: #define        _WSTOPPED       0177            /* _WSTATUS if process is stopped */
                     50: #define WIFSTOPPED(x)  (_WSTATUS(x) == _WSTOPPED)
                     51: #define WSTOPSIG(x)    (_W_INT(x) >> 8)
                     52: #define WIFSIGNALED(x) (_WSTATUS(x) != _WSTOPPED && _WSTATUS(x) != 0)
                     53: #define WTERMSIG(x)    (_WSTATUS(x))
                     54: #define WIFEXITED(x)   (_WSTATUS(x) == 0)
                     55: #define WEXITSTATUS(x) (_W_INT(x) >> 8)
                     56: #ifndef _POSIX_SOURCE
                     57: #define WCOREDUMP(x)   (_W_INT(x) & WCOREFLAG)
                     58:
                     59: #define        W_EXITCODE(ret, sig)    ((ret) << 8 | (sig))
                     60: #define        W_STOPCODE(sig)         ((sig) << 8 | _WSTOPPED)
                     61: #endif
                     62:
                     63: /*
                     64:  * Option bits for the third argument of wait4.  WNOHANG causes the
                     65:  * wait to not hang if there are no stopped or terminated processes, rather
                     66:  * returning an error indication in this case (pid==0).  WUNTRACED
                     67:  * indicates that the caller should receive status about untraced children
                     68:  * which stop due to signals.  If children are stopped and a wait without
                     69:  * this option is done, it is as though they were still running... nothing
                     70:  * about them is returned.
                     71:  */
                     72: #define WNOHANG                1       /* don't hang in wait */
                     73: #define WUNTRACED      2       /* tell about stopped, untraced children */
                     74:
                     75: #ifndef _POSIX_SOURCE
                     76: /* POSIX extensions and 4.2/4.3 compatability: */
                     77:
                     78: /*
                     79:  * Tokens for special values of the "pid" parameter to wait4.
                     80:  */
                     81: #define        WAIT_ANY        (-1)    /* any process */
                     82: #define        WAIT_MYPGRP     0       /* any process in my process group */
                     83:
                     84: #include <sys/endian.h>
                     85:
                     86: /*
                     87:  * Deprecated:
                     88:  * Structure of the information in the status word returned by wait4.
                     89:  * If w_stopval==WSTOPPED, then the second structure describes
                     90:  * the information returned, else the first.
                     91:  */
                     92: union wait {
                     93:        int     w_status;               /* used in syscall */
                     94:        /*
                     95:         * Terminated process status.
                     96:         */
                     97:        struct {
                     98: #if BYTE_ORDER == LITTLE_ENDIAN
                     99:                unsigned int    w_Termsig:7,    /* termination signal */
                    100:                                w_Coredump:1,   /* core dump indicator */
                    101:                                w_Retcode:8,    /* exit code if w_termsig==0 */
                    102:                                w_Filler:16;    /* upper bits filler */
                    103: #endif
                    104: #if BYTE_ORDER == BIG_ENDIAN
                    105:                unsigned int    w_Filler:16,    /* upper bits filler */
                    106:                                w_Retcode:8,    /* exit code if w_termsig==0 */
                    107:                                w_Coredump:1,   /* core dump indicator */
                    108:                                w_Termsig:7;    /* termination signal */
                    109: #endif
                    110:        } w_T;
                    111:        /*
                    112:         * Stopped process status.  Returned
                    113:         * only for traced children unless requested
                    114:         * with the WUNTRACED option bit.
                    115:         */
                    116:        struct {
                    117: #if BYTE_ORDER == LITTLE_ENDIAN
                    118:                unsigned int    w_Stopval:8,    /* == W_STOPPED if stopped */
                    119:                                w_Stopsig:8,    /* signal that stopped us */
                    120:                                w_Filler:16;    /* upper bits filler */
                    121: #endif
                    122: #if BYTE_ORDER == BIG_ENDIAN
                    123:                unsigned int    w_Filler:16,    /* upper bits filler */
                    124:                                w_Stopsig:8,    /* signal that stopped us */
                    125:                                w_Stopval:8;    /* == W_STOPPED if stopped */
                    126: #endif
                    127:        } w_S;
                    128: };
                    129: #define        w_termsig       w_T.w_Termsig
                    130: #define w_coredump     w_T.w_Coredump
                    131: #define w_retcode      w_T.w_Retcode
                    132: #define w_stopval      w_S.w_Stopval
                    133: #define w_stopsig      w_S.w_Stopsig
                    134:
                    135: #define        WSTOPPED        _WSTOPPED
                    136: #endif /* _POSIX_SOURCE */
                    137:
                    138: #ifndef KERNEL
                    139: #include <sys/types.h>
                    140: #include <sys/cdefs.h>
                    141:
                    142: __BEGIN_DECLS
                    143: struct rusage; /* forward declaration */
                    144:
                    145: pid_t  wait(int *);
                    146: pid_t  waitpid(pid_t, int *, int);
                    147:
                    148: __END_DECLS
                    149: #endif

CVSweb