From a6e7797a31423170005f5d92e83bbb671ee4111b Mon Sep 17 00:00:00 2001 From: Sergey Bugaev Date: Mon, 3 Feb 2020 18:51:48 +0300 Subject: LibC: Move waitpid() to sys/wait.h That's where POSIX says it should be. --- Libraries/LibC/stdio.cpp | 1 + Libraries/LibC/sys/wait.cpp | 7 +++++++ Libraries/LibC/sys/wait.h | 1 + Libraries/LibC/unistd.cpp | 6 ------ Libraries/LibC/unistd.h | 2 -- 5 files changed, 9 insertions(+), 8 deletions(-) (limited to 'Libraries') diff --git a/Libraries/LibC/stdio.cpp b/Libraries/LibC/stdio.cpp index e57f9b8245..5878be269f 100644 --- a/Libraries/LibC/stdio.cpp +++ b/Libraries/LibC/stdio.cpp @@ -37,6 +37,7 @@ #include #include #include +#include #include extern "C" { diff --git a/Libraries/LibC/sys/wait.cpp b/Libraries/LibC/sys/wait.cpp index d73d11847e..3119a91427 100644 --- a/Libraries/LibC/sys/wait.cpp +++ b/Libraries/LibC/sys/wait.cpp @@ -24,6 +24,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include #include #include #include @@ -35,3 +36,9 @@ pid_t wait(int* wstatus) return waitpid(-1, wstatus, 0); } } + +pid_t waitpid(pid_t waitee, int* wstatus, int options) +{ + int rc = syscall(SC_waitpid, waitee, wstatus, options); + __RETURN_WITH_ERRNO(rc, rc, -1); +} diff --git a/Libraries/LibC/sys/wait.h b/Libraries/LibC/sys/wait.h index 71b03c8430..2a2fc162a1 100644 --- a/Libraries/LibC/sys/wait.h +++ b/Libraries/LibC/sys/wait.h @@ -44,6 +44,7 @@ __BEGIN_DECLS #define WEXITED 4 #define WCONTINUED 8 +pid_t waitpid(pid_t, int* wstatus, int options); pid_t wait(int* wstatus); __END_DECLS diff --git a/Libraries/LibC/unistd.cpp b/Libraries/LibC/unistd.cpp index db2434c7f4..df6349111e 100644 --- a/Libraries/LibC/unistd.cpp +++ b/Libraries/LibC/unistd.cpp @@ -272,12 +272,6 @@ int close(int fd) __RETURN_WITH_ERRNO(rc, rc, -1); } -pid_t waitpid(pid_t waitee, int* wstatus, int options) -{ - int rc = syscall(SC_waitpid, waitee, wstatus, options); - __RETURN_WITH_ERRNO(rc, rc, -1); -} - int lstat(const char* path, struct stat* statbuf) { if (!path) { diff --git a/Libraries/LibC/unistd.h b/Libraries/LibC/unistd.h index 935392c01c..6d1d0c89f5 100644 --- a/Libraries/LibC/unistd.h +++ b/Libraries/LibC/unistd.h @@ -101,8 +101,6 @@ int tcsetpgrp(int fd, pid_t pgid); ssize_t read(int fd, void* buf, size_t count); ssize_t write(int fd, const void* buf, size_t count); int close(int fd); -pid_t waitpid(pid_t, int* wstatus, int options); -pid_t wait(int* wstatus); int chdir(const char* path); int fchdir(int fd); char* getcwd(char* buffer, size_t size); -- cgit v1.2.3