1250079Scarl/* The <sys/wait.h> header contains macros related to wait(). The value
2250079Scarl * returned by wait() and waitpid() depends on whether the process
3289542Scem * terminated by an exit() call, was killed by a signal, or was stopped
4250079Scarl * due to job control, as follows:
5250079Scarl *
6250079Scarl *				 High byte   Low byte
7250079Scarl *				+---------------------+
8250079Scarl *	exit(status)		|  status  |    0     |
9250079Scarl *				+---------------------+
10250079Scarl *      killed by signal	|    0     |  signal  |
11250079Scarl *				+---------------------+
12250079Scarl *	stopped (job control)	|  signal  |   0177   |
13250079Scarl *				+---------------------+
14250079Scarl */
15250079Scarl
16250079Scarl#ifndef _WAIT_H
17250079Scarl#define _WAIT_H
18250079Scarl
19250079Scarl#ifndef _TYPES_H		/* not quite right */
20250079Scarl#include <sys/types.h>
21250079Scarl#endif
22250079Scarl
23250079Scarl#define __LOW(v)	((v) & 0377)
24250079Scarl#define __HIGH(v)	(((v) >> 8) & 0377)
25250079Scarl
26250079Scarl#define WNOHANG         1	/* do not wait for child to exit */
27250079Scarl#define WUNTRACED       2	/* for job control; not implemented */
28250079Scarl
29250079Scarl#define WIFEXITED(s)	(__LOW(s) == 0)		    /* normal exit */
30250079Scarl#define WEXITSTATUS(s)	(__HIGH(s))			    /* exit status */
31250079Scarl#define WTERMSIG(s)	(__LOW(s) & 0177)		    /* sig value */
32250079Scarl#define WIFSIGNALED(s)	((((unsigned int)(s)-1) & 0xFFFF) < 0xFF) /* signaled */
33250079Scarl#define WIFSTOPPED(s)	(__LOW(s) == 0177)		    /* stopped */
34250079Scarl#define WSTOPSIG(s)	(__HIGH(s) & 0377)		    /* stop signal */
35289774Scem
36250079Scarl/* Function Prototypes. */
37250079Scarl#ifndef _ANSI_H
38250079Scarl#include <ansi.h>
39250079Scarl#endif
40289774Scem
41289207Scem_PROTOTYPE( pid_t wait, (int *_stat_loc)			   	   );
42250079Scarl_PROTOTYPE( pid_t waitpid, (pid_t _pid, int *_stat_loc, int _options)	   );
43250079Scarl
44250079Scarl#endif /* _WAIT_H */
45250079Scarl