|
|
1.1 ! root 1: /* ! 2: * This file holds definitions relevent to the wait system call. ! 3: * Some of the options here are available only through the ``wait3'' ! 4: * entry point; the old entry point with one argument has more fixed ! 5: * semantics, never returning status of unstopped children, hanging until ! 6: * a process terminates if any are outstanding, and never returns ! 7: * detailed information about process resource utilization (<vtimes.h>). ! 8: */ ! 9: ! 10: /* ! 11: * Structure of the information in the first word returned by both ! 12: * wait and wait3. If w_stopval==WSTOPPED, then the second structure ! 13: * describes the information returned, else the first. See WUNTRACED below. ! 14: */ ! 15: union wait { ! 16: int w_status; /* used in syscall */ ! 17: /* ! 18: * Terminated process status. ! 19: */ ! 20: struct { ! 21: unsigned short w_Filler; /* upper bits filler */ ! 22: unsigned char w_Retcode; /* exit code if w_termsig==0 */ ! 23: unsigned char w_Coredump:1; /* core dump indicator */ ! 24: unsigned char w_Termsig:7; /* termination signal */ ! 25: } w_T; ! 26: /* ! 27: * Stopped process status. Returned ! 28: * only for traced children unless requested ! 29: * with the WUNTRACED option bit. ! 30: */ ! 31: struct { ! 32: unsigned short w_Filler; /* upper bits filler */ ! 33: unsigned char w_Stopsig; /* signal that stopped us */ ! 34: unsigned char w_Stopval; /* == W_STOPPED if stopped */ ! 35: } w_S; ! 36: }; ! 37: #define w_termsig w_T.w_Termsig ! 38: #define w_coredump w_T.w_Coredump ! 39: #define w_retcode w_T.w_Retcode ! 40: #define w_stopval w_S.w_Stopval ! 41: #define w_stopsig w_S.w_Stopsig ! 42: ! 43: ! 44: #define WSTOPPED 0177 /* value of s.stopval if process is stopped */ ! 45: ! 46: /* ! 47: * Option bits for the second argument of wait3. WNOHANG causes the ! 48: * wait to not hang if there are no stopped or terminated processes, rather ! 49: * returning an error indication in this case (pid==0). WUNTRACED ! 50: * indicates that the caller should receive status about untraced children ! 51: * which stop due to signals. If children are stopped and a wait without ! 52: * this option is done, it is as though they were still running... nothing ! 53: * about them is returned. ! 54: */ ! 55: #define WNOHANG 1 /* dont hang in wait */ ! 56: #define WUNTRACED 2 /* tell about stopped, untraced children */ ! 57: ! 58: #define WIFSTOPPED(x) ((x).w_stopval == WSTOPPED) ! 59: #define WIFSIGNALED(x) ((x).w_stopval != WSTOPPED && (x).w_termsig != 0) ! 60: #define WIFEXITED(x) ((x).w_stopval != WSTOPPED && (x).w_termsig == 0)
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.