blob: e73594aed59d482bddb860a6ba47e62bc99e7eaf [file] [log] [blame]
Rich Felker0b44a032011-02-12 00:22:29 -05001#ifndef _SYS_WAIT_H
2#define _SYS_WAIT_H
3#ifdef __cplusplus
4extern "C" {
5#endif
6
Rich Felkerf492c952011-04-21 14:21:57 -04007#include <signal.h>
8
Rich Felker0b44a032011-02-12 00:22:29 -05009#define __NEED_pid_t
10#define __NEED_id_t
Rich Felker0b44a032011-02-12 00:22:29 -050011#define __NEED_siginfo_t
12#include <bits/alltypes.h>
13
14typedef int idtype_t;
15
16pid_t wait (int *);
17int waitid (idtype_t, id_t, siginfo_t *, int);
18pid_t waitpid (pid_t, int *, int );
Rich Felker52874c82011-02-19 02:26:11 -050019
20#ifdef _GNU_SOURCE
21#include <sys/resource.h>
22pid_t wait3 (int *, int, struct rusage *);
23pid_t wait4 (pid_t, int *, int, struct rusage *);
24#endif
Rich Felker0b44a032011-02-12 00:22:29 -050025
Rich Felker4b5f0542011-04-21 14:27:28 -040026#define WNOHANG 1
27#define WUNTRACED 2
28
29#define WSTOPPED 2
30#define WEXITED 4
31#define WCONTINUED 8
32#define WNOWAIT 0x1000000
33
34#define P_ALL 0
35#define P_PID 1
36#define P_PGID 2
37
38#ifndef WEXITSTATUS
39#define WEXITSTATUS(s) (((s) & 0xff00) >> 8)
40#define WTERMSIG(s) ((s) & 0x7f)
41#define WSTOPSIG(s) WEXITSTATUS(s)
42#define WCOREDUMP(s) ((s) & 0x80)
43#define WIFEXITED(s) (!WTERMSIG(s))
44#define WIFSTOPPED(s) (((s) & 0xff) == 0x7f)
45#define WIFSIGNALED(s) (((signed char) (((s) & 0x7f) + 1) >> 1) > 0)
46#define WIFCONTINUED(s) ((s) == 0xffff)
47#endif
Rich Felker0b44a032011-02-12 00:22:29 -050048
49#ifdef __cplusplus
50}
51#endif
52#endif