The manual
ginnOS
The reference: libc, the libraries and the kernel
Loading...
Searching...
No Matches
wait_status.h
Go to the documentation of this file.
1#pragma once
2
3/**
4 * the status word waitpid reports for a child, encoded as on other Unix
5 * systems (the libc's <sys/wait.h> decodes it):
6 * exited with code c: (c & 0xff) << 8
7 * killed by signal s: s (bits 0-6)
8 * stopped by signal s: (s << 8) | 0x7f
9 * continued: 0xffff
10 */
11
12#define WAIT_STATUS_EXITED(code) (((code) & 0xff) << 8)
13#define WAIT_STATUS_SIGNALED(sig) ((sig) & 0x7f)
14#define WAIT_STATUS_STOPPED(sig) ((((sig) & 0xff) << 8) | 0x7f)
15#define WAIT_STATUS_CONTINUED 0xffff
16
17// waitpid options
18#define WNOHANG 1 // return 0 at once if no child has exited
19#define WUNTRACED 2 // also report children that stopped
20#define WCONTINUED 8 // also report children that continued