mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 07:47:35 +00:00
LibCore: Add posix_spawnp() wrapper that return ErrorOr<pid_t>
This commit is contained in:
parent
54f6829533
commit
123e49994d
2 changed files with 10 additions and 0 deletions
|
@ -372,4 +372,12 @@ ErrorOr<void> clock_settime(clockid_t clock_id, struct timespec* ts)
|
|||
#endif
|
||||
}
|
||||
|
||||
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[])
|
||||
{
|
||||
pid_t child_pid;
|
||||
if ((errno = ::posix_spawnp(&child_pid, path.to_string().characters(), file_actions, attr, arguments, envp)))
|
||||
return Error::from_syscall("posix_spawnp"sv, -errno);
|
||||
return child_pid;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#include <grp.h>
|
||||
#include <pwd.h>
|
||||
#include <signal.h>
|
||||
#include <spawn.h>
|
||||
#include <sys/stat.h>
|
||||
#include <termios.h>
|
||||
#include <time.h>
|
||||
|
@ -51,5 +52,6 @@ ErrorOr<void> chown(StringView pathname, uid_t uid, gid_t gid);
|
|||
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[]);
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue