1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 01:07:36 +00:00

Implement waitpid() support for getting the waitee's exit code.

This commit is contained in:
Andreas Kling 2018-10-27 01:24:22 +02:00
parent 5cfeeede7c
commit ec07761d0f
7 changed files with 33 additions and 10 deletions

View file

@ -39,9 +39,9 @@ int close(int fd)
__RETURN_WITH_ERRNO(rc, rc, -1);
}
pid_t waitpid(pid_t waitee)
pid_t waitpid(pid_t waitee, int* wstatus, int options)
{
int rc = Syscall::invoke(Syscall::PosixWaitpid, waitee);
int rc = Syscall::invoke(Syscall::PosixWaitpid, waitee, (dword)wstatus);
__RETURN_WITH_ERRNO(rc, rc, -1);
}

View file

@ -10,13 +10,17 @@ pid_t getpid();
int open(const char* path);
ssize_t read(int fd, void* buf, size_t count);
int close(int fd);
pid_t waitpid(pid_t);
pid_t waitpid(pid_t, int* wstatus, int options);
int chdir(const char* path);
char* getcwd(char* buffer, size_t size);
int lstat(const char* path, stat* statbuf);
int sleep(unsigned seconds);
int gethostname(char*, size_t);
#define WEXITSTATUS(status) (((status) & 0xff00) >> 8)
#define WTERMSIG(status) ((status) & 0x7f)
#define WIFEXITED(status) (WTERMSIG(status) == 0)
#define HOST_NAME_MAX 64
#define S_IFMT 0170000