LibC: add wait and waitpid

Note that wait() doesn't work since only waiting for specified
pid is supported. wait() will just return -1 and set errno to
ECHILD.
This commit is contained in:
Bananymous
2023-06-04 17:59:13 +03:00
parent 9fbb2b9369
commit 40055f023c
5 changed files with 26 additions and 2 deletions

13
libc/sys/wait.cpp Normal file
View File

@@ -0,0 +1,13 @@
#include <sys/syscall.h>
#include <sys/wait.h>
#include <unistd.h>
pid_t wait(int* stat_loc)
{
return waitpid(-1, stat_loc, 0);
}
pid_t waitpid(pid_t pid, int* stat_loc, int options)
{
return (pid_t)syscall(SYS_WAIT, pid, stat_loc, options);
}