LibCore: Add syscall wrapper for fork()

This commit is contained in:
Andreas Kling 2021-12-16 20:28:54 +01:00
parent 01c2756e9a
commit 2637a64130
Notes: sideshowbarker 2024-07-17 22:41:35 +09:00
2 changed files with 9 additions and 0 deletions

View file

@ -480,4 +480,12 @@ ErrorOr<void> mkdir(StringView path, mode_t mode)
#endif
}
ErrorOr<pid_t> fork()
{
pid_t pid = ::fork();
if (pid < 0)
return Error::from_syscall("fork"sv, -errno);
return pid;
}
}

View file

@ -64,5 +64,6 @@ ErrorOr<void> setegid(gid_t);
ErrorOr<bool> isatty(int fd);
ErrorOr<void> symlink(StringView target, StringView link_path);
ErrorOr<void> mkdir(StringView path, mode_t);
ErrorOr<pid_t> fork();
}