mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-21 20:15:17 +00:00
LibCore: Add rmdir system call wrapper
This commit is contained in:
parent
1dd70a6f49
commit
b455363ce7
Notes:
sideshowbarker
2024-07-17 18:09:08 +09:00
Author: https://github.com/ldm5180 Commit: https://github.com/SerenityOS/serenity/commit/b455363ce7 Pull-request: https://github.com/SerenityOS/serenity/pull/12421 Reviewed-by: https://github.com/timschumi
2 changed files with 16 additions and 1 deletions
|
@ -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();
|
||||
|
|
|
@ -111,6 +111,7 @@ ErrorOr<bool> isatty(int fd);
|
|||
ErrorOr<void> symlink(StringView target, StringView link_path);
|
||||
ErrorOr<void> mkdir(StringView path, mode_t);
|
||||
ErrorOr<void> chdir(StringView path);
|
||||
ErrorOr<void> rmdir(StringView path);
|
||||
ErrorOr<pid_t> fork();
|
||||
ErrorOr<int> mkstemp(Span<char> pattern);
|
||||
ErrorOr<void> fchmod(int fd, mode_t mode);
|
||||
|
@ -142,5 +143,4 @@ ErrorOr<void> socketpair(int domain, int type, int protocol, int sv[2]);
|
|||
ErrorOr<Vector<gid_t>> getgroups();
|
||||
ErrorOr<void> mknod(StringView pathname, mode_t mode, dev_t dev);
|
||||
ErrorOr<void> mkfifo(StringView pathname, mode_t mode);
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue