1: /*
   2:  * Copyright (c) 1982, 1986 Regents of the University of California.
   3:  * All rights reserved.  The Berkeley software License Agreement
   4:  * specifies the terms and conditions for redistribution.
   5:  *
   6:  *	@(#)wait.h	7.2.1 (2.11BSD GTE) 1995/06/23
   7:  */
   8: 
   9: /*
  10:  * This file holds definitions relevent to the wait system call.
  11:  * Some of the options here are available only through the ``wait3''
  12:  * entry point; the old entry point with one argument has more fixed
  13:  * semantics, never returning status of unstopped children, hanging until
  14:  * a process terminates if any are outstanding, and never returns
  15:  * detailed information about process resource utilization (<vtimes.h>).
  16:  */
  17: 
  18: /*
  19:  * Structure of the information in the first word returned by both
  20:  * wait and wait3.  If w_stopval==WSTOPPED, then the second structure
  21:  * describes the information returned, else the first.  See WUNTRACED below.
  22:  */
  23: union wait  {
  24:     int w_status;       /* used in syscall */
  25:     /*
  26: 	 * Terminated process status.
  27: 	 */
  28:     struct {
  29:         unsigned short  w_Termsig:7;    /* termination signal */
  30:         unsigned short  w_Coredump:1;   /* core dump indicator */
  31:         unsigned short  w_Retcode:8;    /* exit code if w_termsig==0 */
  32:     } w_T;
  33:     /*
  34: 	 * Stopped process status.  Returned
  35: 	 * only for traced children unless requested
  36: 	 * with the WUNTRACED option bit.
  37: 	 */
  38:     struct {
  39:         unsigned short  w_Stopval:8;    /* == W_STOPPED if stopped */
  40:         unsigned short  w_Stopsig:8;    /* signal that stopped us */
  41:     } w_S;
  42: };
  43: #define w_termsig   w_T.w_Termsig
  44: #define w_coredump  w_T.w_Coredump
  45: #define w_retcode   w_T.w_Retcode
  46: #define w_stopval   w_S.w_Stopval
  47: #define w_stopsig   w_S.w_Stopsig
  48: 
  49: 
  50: #define WSTOPPED    0177    /* value of s.stopval if process is stopped */
  51: 
  52: /*
  53:  * Option bits for the second argument of wait3.  WNOHANG causes the
  54:  * wait to not hang if there are no stopped or terminated processes, rather
  55:  * returning an error indication in this case (pid==0).  WUNTRACED
  56:  * indicates that the caller should receive status about untraced children
  57:  * which stop due to signals.  If children are stopped and a wait without
  58:  * this option is done, it is as though they were still running... nothing
  59:  * about them is returned.
  60:  */
  61: #define WNOHANG     1   /* dont hang in wait */
  62: #define WUNTRACED   2   /* tell about stopped, untraced children */
  63: 
  64: #define WIFSTOPPED(x)   ((x).w_stopval == WSTOPPED)
  65: #define WIFSIGNALED(x)  ((x).w_stopval != WSTOPPED && (x).w_termsig != 0)
  66: #define WIFEXITED(x)    ((x).w_stopval != WSTOPPED && (x).w_termsig == 0)
  67: #define WEXITSTATUS(x)  ((x).w_retcode)
  68: 
  69: #define W_STOPCODE(sig) ((sig << 8) | WSTOPPED)
  70: #define W_EXITCODE(ret,sig) ((ret << 8) | (sig))
  71: 
  72: #define WAIT_ANY    (-1)
  73: #define WAIT_MYPGRP 0

Defined union's

wait defined in line 23; used 80 times

Defined macros

WAIT_MYPGRP defined in line 73; used 1 times
WSTOPPED defined in line 50; used 5 times
W_EXITCODE defined in line 70; used 1 times
W_STOPCODE defined in line 69; used 2 times
w_stopsig defined in line 47; used 2 times
w_stopval defined in line 46; used 4 times

Usage of this include

wait.h used 64 times
Last modified: 1995-06-24
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 3495
Valid CSS Valid XHTML 1.0 Strict