From 2291ef6c3ce8af3bcf2ff1dfd00c5a1b4930afa8 Mon Sep 17 00:00:00 2001 From: Federico Guerinoni Date: Fri, 21 Jan 2022 23:10:59 +0100 Subject: [PATCH] LibCore: Add syscall wrapper for umount() --- Userland/Libraries/LibCore/System.cpp | 9 +++++++++ Userland/Libraries/LibCore/System.h | 1 + 2 files changed, 10 insertions(+) diff --git a/Userland/Libraries/LibCore/System.cpp b/Userland/Libraries/LibCore/System.cpp index d360c4d4f5..68f0b36ccc 100644 --- a/Userland/Libraries/LibCore/System.cpp +++ b/Userland/Libraries/LibCore/System.cpp @@ -122,6 +122,15 @@ ErrorOr mount(int source_fd, StringView target, StringView fs_type, int fl HANDLE_SYSCALL_RETURN_VALUE("mount", rc, {}); } +ErrorOr umount(StringView mount_point) +{ + if (mount_point.is_null()) + return Error::from_errno(EFAULT); + + int rc = syscall(SC_umount, mount_point.characters_without_null_termination(), mount_point.length()); + HANDLE_SYSCALL_RETURN_VALUE("umount", rc, {}); +} + ErrorOr ptrace(int request, pid_t tid, void* address, void* data) { auto rc = ::ptrace(request, tid, address, data); diff --git a/Userland/Libraries/LibCore/System.h b/Userland/Libraries/LibCore/System.h index 60ffea982b..0bba07f5bc 100644 --- a/Userland/Libraries/LibCore/System.h +++ b/Userland/Libraries/LibCore/System.h @@ -40,6 +40,7 @@ ErrorOr recvfd(int sockfd, int options); ErrorOr ptrace_peekbuf(pid_t tid, void const* tracee_addr, Bytes destination_buf); ErrorOr setgroups(Span); ErrorOr mount(int source_fd, StringView target, StringView fs_type, int flags); +ErrorOr umount(StringView mount_point); ErrorOr ptrace(int request, pid_t tid, void* address, void* data); ErrorOr disown(pid_t pid); #endif