summaryrefslogtreecommitdiff
path: root/Libraries/LibC/sys
diff options
context:
space:
mode:
authorSergey Bugaev <bugaevc@serenityos.org>2020-02-03 18:51:48 +0300
committerAndreas Kling <kling@serenityos.org>2020-02-03 19:50:45 +0100
commita6e7797a31423170005f5d92e83bbb671ee4111b (patch)
treea9469e9338c7caf7e713599aaf285cb2cf4047a7 /Libraries/LibC/sys
parent4e79a60b78d46869e3edb52d8eb4fc0e557e80d3 (diff)
downloadserenity-a6e7797a31423170005f5d92e83bbb671ee4111b.zip
LibC: Move waitpid() to sys/wait.h
That's where POSIX says it should be.
Diffstat (limited to 'Libraries/LibC/sys')
-rw-r--r--Libraries/LibC/sys/wait.cpp7
-rw-r--r--Libraries/LibC/sys/wait.h1
2 files changed, 8 insertions, 0 deletions
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