Pristine Ack-5.5
[Ack-5.5.git] / lib / minix / include / sys / wait.h
1 /* The <sys/wait.h> header contains macros related to wait(). The value
2  * returned by wait() and waitpid() depends on whether the process 
3  * terminated by an exit() call, was killed by a signal, or was stopped
4  * due to job control, as follows:
5  *
6  *                               High byte   Low byte
7  *                              +---------------------+
8  *      exit(status)            |  status  |    0     |
9  *                              +---------------------+
10  *      killed by signal        |    0     |  signal  |
11  *                              +---------------------+
12  *      stopped (job control)   |  signal  |   0177   |
13  *                              +---------------------+
14  */
15
16 #ifndef _WAIT_H
17 #define _WAIT_H
18
19 #define _LOW(v)         ( (v) & 0377)
20 #define _HIGH(v)        ( ((v) >> 8) & 0377)
21
22 #define WNOHANG         1       /* do not wait for child to exit */
23 #define WUNTRACED       2       /* for job control; not implemented */
24
25 #define WIFEXITED(s)    (_LOW(s) == 0)                      /* normal exit */
26 #define WEXITSTATUS(s)  (_HIGH(s))                          /* exit status */
27 #define WTERMSIG(s)     (_LOW(s) & 0177)                    /* sig value */
28 #define WIFSIGNALED(s)  (((unsigned int)(s)-1 & 0xFFFF) < 0xFF) /* signaled */
29 #define WIFSTOPPED(s)   (_LOW(s) == 0177)                   /* stopped */
30 #define WSTOPSIG(s)     (_HIGH(s) & 0377)                   /* stop signal */
31
32 /* Function Prototypes. */
33 #ifndef _ANSI_H
34 #include <ansi.h>
35 #endif
36
37 _PROTOTYPE( pid_t wait, (int *_stat_loc)                                );
38 _PROTOTYPE( pid_t waitpid, (pid_t _pid, int *_stat_loc, int _options)   );
39
40 #endif /* _WAIT_H */