1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 18:28:12 +00:00

LibCore: Add waitpid() wrapper that return ErrorOr<pid_t>

This commit is contained in:
Kenneth Myhra 2021-12-13 18:43:39 +01:00 committed by Brian Gianforcaro
parent 123e49994d
commit 11578c623c
2 changed files with 10 additions and 0 deletions

View file

@ -380,4 +380,12 @@ ErrorOr<pid_t> posix_spawnp(StringView const path, posix_spawn_file_actions_t* c
return child_pid;
}
ErrorOr<pid_t> waitpid(pid_t waitee, int* wstatus, int options)
{
pid_t pid = ::waitpid(waitee, wstatus, options);
if (pid < 0)
return Error::from_syscall("waitpid"sv, -errno);
return pid;
}
}