1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 21:07:35 +00:00

LibCore+flock: Make Core::System::waitpid more ergonomic

This commit is contained in:
Junior Rantila 2022-01-10 14:34:09 +01:00 committed by Andreas Kling
parent 315e1c705f
commit 0d328f3c86
3 changed files with 11 additions and 5 deletions

View file

@ -517,12 +517,13 @@ 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)
ErrorOr<WaitPidResult> waitpid(pid_t waitee, int options)
{
pid_t pid = ::waitpid(waitee, wstatus, options);
int wstatus;
pid_t pid = ::waitpid(waitee, &wstatus, options);
if (pid < 0)
return Error::from_syscall("waitpid"sv, -errno);
return pid;
return WaitPidResult { pid, wstatus };
}
ErrorOr<void> setuid(uid_t uid)