diff options
Diffstat (limited to 'Userland/Libraries/LibCore/System.cpp')
-rw-r--r-- | Userland/Libraries/LibCore/System.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/Userland/Libraries/LibCore/System.cpp b/Userland/Libraries/LibCore/System.cpp index e19b111b54..bcac0946b4 100644 --- a/Userland/Libraries/LibCore/System.cpp +++ b/Userland/Libraries/LibCore/System.cpp @@ -766,6 +766,21 @@ ErrorOr<void> chdir(StringView path) #endif } +ErrorOr<void> rmdir(StringView path) +{ + if (path.is_null()) + return Error::from_errno(EFAULT); +#ifdef __serenity__ + int rc = syscall(SC_rmdir, path.characters_without_null_termination(), path.length()); + HANDLE_SYSCALL_RETURN_VALUE("rmdir"sv, rc, {}); +#else + String path_string = path; + if (::rmdir(path_string.characters()) < 0) + return Error::from_syscall("rmdir"sv, -errno); + return {}; +#endif +} + ErrorOr<pid_t> fork() { pid_t pid = ::fork(); |