diff options
author | Andreas Kling <kling@serenityos.org> | 2021-12-16 20:28:54 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-12-16 22:48:17 +0100 |
commit | 2637a641301fa27df8f101f4b587e87390909ee3 (patch) | |
tree | f4fe797d74b779c17b46cdd23620781d091441f9 /Userland/Libraries/LibCore/System.cpp | |
parent | 01c2756e9a6796d56372e2776854c6378b00c0eb (diff) | |
download | serenity-2637a641301fa27df8f101f4b587e87390909ee3.zip |
LibCore: Add syscall wrapper for fork()
Diffstat (limited to 'Userland/Libraries/LibCore/System.cpp')
-rw-r--r-- | Userland/Libraries/LibCore/System.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Userland/Libraries/LibCore/System.cpp b/Userland/Libraries/LibCore/System.cpp index c86c22f083..d4807c8b17 100644 --- a/Userland/Libraries/LibCore/System.cpp +++ b/Userland/Libraries/LibCore/System.cpp @@ -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; +} + } |