waiting for child processes.
More...
Go to the source code of this file.
|
| pid_t | waitpid (pid_t pid, int *status, int options) |
| | wait for a child process to exit and reap it.
|
| pid_t | wait (int *status) |
| | wait for any child to exit and reap it.
|
waiting for child processes.
the status word and the option values are ABI and must match the kernel side in src/kernel/process/wait_status.h.
◆ WNOHANG
◆ WUNTRACED
◆ WCONTINUED
◆ WIFEXITED
| #define WIFEXITED |
( |
| status | ) |
|
◆ WEXITSTATUS
| #define WEXITSTATUS |
( |
| status | ) |
|
◆ WIFSIGNALED
| #define WIFSIGNALED |
( |
| status | ) |
|
Value:(((status) & 0x7f) != 0 && ((status) & 0x7f) != 0x7f)
◆ WTERMSIG
| #define WTERMSIG |
( |
| status | ) |
|
◆ WIFSTOPPED
| #define WIFSTOPPED |
( |
| status | ) |
|
Value:(((status) & 0xff) == 0x7f)
◆ WSTOPSIG
| #define WSTOPSIG |
( |
| status | ) |
|
◆ WIFCONTINUED
| #define WIFCONTINUED |
( |
| status | ) |
|
◆ waitpid()
| pid_t waitpid |
( |
pid_t | pid, |
|
|
int * | status, |
|
|
int | options ) |
wait for a child process to exit and reap it.
- Parameters
-
| pid | a child's pid, or -1 for any child. |
| status | receives the status word (may be NULL). |
| options | 0 or WNOHANG. |
- Returns
- the reaped child's pid, 0 with WNOHANG if no matching child has exited yet, or -1 on error (errno set; ECHILD if there is no matching child).
◆ wait()
| pid_t wait |
( |
int * | status | ) |
|
wait for any child to exit and reap it.
- Parameters
-
| status | receives the status word (may be NULL). |
- Returns
- the child's pid, or -1 on error (errno set).