2021-05-09 23:00:11 +02:00
|
|
|
#ifndef __SYS_WAIT_H__
|
|
|
|
# define __SYS_WAIT_H__
|
2020-09-17 19:27:01 +02:00
|
|
|
|
2021-06-28 15:49:05 +02:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2020-09-17 19:27:01 +02:00
|
|
|
#include <stddef.h>
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <sys/types.h>
|
2020-10-14 11:45:08 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
** This will define the `W*' macros for the flag bits to `waitpid', `wait3',
|
|
|
|
** and `wait4'.
|
|
|
|
*/
|
2021-05-09 17:34:00 +02:00
|
|
|
#include <bits/waitflags.h>
|
2020-10-14 11:45:08 +02:00
|
|
|
|
|
|
|
/* This will define all the `__W*' macros.*/
|
2021-05-09 17:34:00 +02:00
|
|
|
#include <bits/waitstatus.h>
|
2020-09-17 19:27:01 +02:00
|
|
|
|
|
|
|
/* Macros for the `waitpid`'s wstatus argument. */
|
|
|
|
#define WEXITSTATUS(status) __WEXITSTATUS(status)
|
|
|
|
#define WTERMSIG(status) __WTERMSIG(status)
|
|
|
|
#define WSTOPSIG(status) __WSTOPSIG(status)
|
|
|
|
#define WIFEXITED(status) __WIFEXITED(status)
|
|
|
|
#define WIFSIGNALED(status) __WIFSIGNALED(status)
|
|
|
|
#define WIFSTOPPED(status) __WIFSTOPPED(status)
|
|
|
|
#define WIFCONTINUED(status) __WIFCONTINUED(status)
|
|
|
|
#define WCOREDUMP(status) __WCOREDUMP(status)
|
|
|
|
|
2020-10-14 11:45:08 +02:00
|
|
|
/*
|
|
|
|
** Wait for a child matching PID to die.
|
|
|
|
** - If PID is greater than 0, match any process whose process ID is PID.
|
|
|
|
** - If PID is (pid_t) -1, match any process.
|
|
|
|
** - If PID is (pid_t) 0, match any process with the same process group as the
|
|
|
|
** current process.
|
|
|
|
** - If PID is less than -1, match any process whose process group is the absolute
|
|
|
|
** value of PID.
|
|
|
|
** - If the WNOHANG bit is set in OPTIONS, and that child is not already dead,
|
|
|
|
** return (pid_t) 0. If successful, return PID and store the dead child's
|
|
|
|
** status in STAT_LOC.
|
|
|
|
** - Return (pid_t) -1 for errors. If the WUNTRACED bit is set in OPTIONS,
|
|
|
|
** return status for stopped children; otherwise don't.
|
|
|
|
*/
|
2020-09-17 19:27:01 +02:00
|
|
|
extern pid_t waitpid(pid_t pid, int *wstatus, int options);
|
2020-10-14 11:45:08 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
** Wait for a child to die. When one does, put its status in *STAT_LOC
|
|
|
|
** and return its process ID. For errors, return (pid_t) -1.
|
|
|
|
*/
|
2020-09-17 19:27:01 +02:00
|
|
|
extern pid_t wait(int *wstatus);
|
|
|
|
|
2021-06-28 15:49:05 +02:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2021-05-09 23:00:11 +02:00
|
|
|
#endif /*__SYS_WAIT_H__*/
|