diff --git a/Kernel/API/POSIX/sys/wait.h b/Kernel/API/POSIX/sys/wait.h new file mode 100644 index 0000000000..d83153830d --- /dev/null +++ b/Kernel/API/POSIX/sys/wait.h @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2018-2021, Andreas Kling + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +#pragma once + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define WEXITSTATUS(status) (((status)&0xff00) >> 8) +#define WSTOPSIG(status) WEXITSTATUS(status) +#define WTERMSIG(status) ((status)&0x7f) +#define WIFEXITED(status) (WTERMSIG(status) == 0) +#define WIFSTOPPED(status) (((status)&0xff) == 0x7f) +#define WIFSIGNALED(status) (((char)(((status)&0x7f) + 1) >> 1) > 0) + +#define WNOHANG 1 +#define WUNTRACED 2 +#define WSTOPPED WUNTRACED +#define WEXITED 4 +#define WCONTINUED 8 +#define WNOWAIT 0x1000000 + +typedef enum { + P_ALL = 1, + P_PID, + P_PGID +} idtype_t; + +#ifdef __cplusplus +} +#endif diff --git a/Kernel/UnixTypes.h b/Kernel/UnixTypes.h index 70178bdbff..22ec9ccbd2 100644 --- a/Kernel/UnixTypes.h +++ b/Kernel/UnixTypes.h @@ -19,6 +19,7 @@ #include #include #include +#include #include #include @@ -63,13 +64,6 @@ enum { PERF_EVENT_SIGNPOST = 32768, }; -#define WNOHANG 1 -#define WUNTRACED 2 -#define WSTOPPED WUNTRACED -#define WEXITED 4 -#define WCONTINUED 8 -#define WNOWAIT 0x1000000 - #define R_OK 4 #define W_OK 2 #define X_OK 1 @@ -141,12 +135,6 @@ struct timeval { suseconds_t tv_usec; }; -typedef enum { - P_ALL = 1, - P_PID, - P_PGID -} idtype_t; - #define UTSNAME_ENTRY_LEN 65 struct utsname { diff --git a/Userland/Libraries/LibC/sys/wait.h b/Userland/Libraries/LibC/sys/wait.h index 8e41010747..2091fc3fa3 100644 --- a/Userland/Libraries/LibC/sys/wait.h +++ b/Userland/Libraries/LibC/sys/wait.h @@ -6,32 +6,11 @@ #pragma once -#include -#include -#include +#include +#include __BEGIN_DECLS -#define WEXITSTATUS(status) (((status)&0xff00) >> 8) -#define WSTOPSIG(status) WEXITSTATUS(status) -#define WTERMSIG(status) ((status)&0x7f) -#define WIFEXITED(status) (WTERMSIG(status) == 0) -#define WIFSTOPPED(status) (((status)&0xff) == 0x7f) -#define WIFSIGNALED(status) (((char)(((status)&0x7f) + 1) >> 1) > 0) - -#define WNOHANG 1 -#define WUNTRACED 2 -#define WSTOPPED WUNTRACED -#define WEXITED 4 -#define WCONTINUED 8 -#define WNOWAIT 0x1000000 - -typedef enum { - P_ALL = 1, - P_PID, - P_PGID -} idtype_t; - pid_t waitpid(pid_t, int* wstatus, int options); pid_t wait(int* wstatus); int waitid(idtype_t idtype, id_t id, siginfo_t* infop, int options);