diff options
author | Sergey Bugaev <bugaevc@serenityos.org> | 2020-02-03 18:51:48 +0300 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-02-03 19:50:45 +0100 |
commit | a6e7797a31423170005f5d92e83bbb671ee4111b (patch) | |
tree | a9469e9338c7caf7e713599aaf285cb2cf4047a7 /Libraries | |
parent | 4e79a60b78d46869e3edb52d8eb4fc0e557e80d3 (diff) | |
download | serenity-a6e7797a31423170005f5d92e83bbb671ee4111b.zip |
LibC: Move waitpid() to sys/wait.h
That's where POSIX says it should be.
Diffstat (limited to 'Libraries')
-rw-r--r-- | Libraries/LibC/stdio.cpp | 1 | ||||
-rw-r--r-- | Libraries/LibC/sys/wait.cpp | 7 | ||||
-rw-r--r-- | Libraries/LibC/sys/wait.h | 1 | ||||
-rw-r--r-- | Libraries/LibC/unistd.cpp | 6 | ||||
-rw-r--r-- | Libraries/LibC/unistd.h | 2 |
5 files changed, 9 insertions, 8 deletions
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 <stdlib.h> #include <string.h> #include <sys/types.h> +#include <sys/wait.h> #include <unistd.h> 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 <Kernel/Syscall.h> #include <assert.h> #include <sys/wait.h> #include <unistd.h> @@ -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); |