The manual
ginnOS
The reference: libc, the libraries and the kernel
Toggle main menu visibility
Loading...
Searching...
No Matches
wait.h
Go to the documentation of this file.
1
#pragma once
2
3
#include <
sys/types.h
>
4
5
/**
6
* @file sys/wait.h
7
* @brief waiting for child processes.
8
*
9
* the status word and the option values are ABI and must match the kernel
10
* side in src/kernel/process/wait_status.h.
11
*/
12
13
#define WNOHANG 1
// return 0 at once if no child has anything to report
14
#define WUNTRACED 2
// also report children that stopped
15
#define WCONTINUED 8
// also report children that continued
16
17
// decoding a status word from wait/waitpid
18
#define WIFEXITED(status) (((status) & 0x7f) == 0)
19
#define WEXITSTATUS(status) (((status) >> 8) & 0xff)
20
#define WIFSIGNALED(status) (((status) & 0x7f) != 0 && ((status) & 0x7f) != 0x7f)
21
#define WTERMSIG(status) ((status) & 0x7f)
22
#define WIFSTOPPED(status) (((status) & 0xff) == 0x7f)
23
#define WSTOPSIG(status) (((status) >> 8) & 0xff)
24
#define WIFCONTINUED(status) ((status) == 0xffff)
25
26
/**
27
* wait for a child process to exit and reap it.
28
* @param pid a child's pid, or -1 for any child.
29
* @param status receives the status word (may be NULL).
30
* @param options 0 or WNOHANG.
31
* @return the reaped child's pid, 0 with WNOHANG if no matching child has
32
* exited yet, or -1 on error (errno set; ECHILD if there is no
33
* matching child).
34
*/
35
pid_t
waitpid
(
pid_t
pid,
int
*status,
int
options);
36
37
/**
38
* wait for any child to exit and reap it.
39
* @param status receives the status word (may be NULL).
40
* @return the child's pid, or -1 on error (errno set).
41
*/
42
pid_t
wait
(
int
*status);
types.h
basic system types.
pid_t
int pid_t
Definition
types.h:16
waitpid
pid_t waitpid(pid_t pid, int *status, int options)
wait for a child process to exit and reap it.
wait
pid_t wait(int *status)
wait for any child to exit and reap it.
src
libc
include
sys
wait.h
Generated by
1.18.0