mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-25 09:00:22 +00:00
LibCore: Add waitpid() wrapper that return ErrorOr<pid_t>
This commit is contained in:
parent
123e49994d
commit
11578c623c
Notes:
sideshowbarker
2024-07-17 22:43:52 +09:00
Author: https://github.com/kennethmyhra Commit: https://github.com/SerenityOS/serenity/commit/11578c623c3 Pull-request: https://github.com/SerenityOS/serenity/pull/11253 Reviewed-by: https://github.com/alimpfard Reviewed-by: https://github.com/bgianfo ✅
2 changed files with 10 additions and 0 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include <signal.h>
|
||||
#include <spawn.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/wait.h>
|
||||
#include <termios.h>
|
||||
#include <time.h>
|
||||
|
||||
|
@ -53,5 +54,6 @@ ErrorOr<struct passwd> getpwnam(StringView name);
|
|||
ErrorOr<struct group> getgrnam(StringView name);
|
||||
ErrorOr<void> clock_settime(clockid_t clock_id, struct timespec* ts);
|
||||
ErrorOr<pid_t> posix_spawnp(StringView const path, posix_spawn_file_actions_t* const file_actions, posix_spawnattr_t* const attr, char* const arguments[], char* const envp[]);
|
||||
ErrorOr<pid_t> waitpid(pid_t waitee, int* wstatus, int options);
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue