summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibCore/System.cpp
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-12-16 20:28:54 +0100
committerAndreas Kling <kling@serenityos.org>2021-12-16 22:48:17 +0100
commit2637a641301fa27df8f101f4b587e87390909ee3 (patch)
treef4fe797d74b779c17b46cdd23620781d091441f9 /Userland/Libraries/LibCore/System.cpp
parent01c2756e9a6796d56372e2776854c6378b00c0eb (diff)
downloadserenity-2637a641301fa27df8f101f4b587e87390909ee3.zip
LibCore: Add syscall wrapper for fork()
Diffstat (limited to 'Userland/Libraries/LibCore/System.cpp')
-rw-r--r--Userland/Libraries/LibCore/System.cpp8
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;
+}
+
}