ソースを参照

LibCore: Add syscall wrapper for munmap()

Andreas Kling 3 年 前
コミット
45842a5208

+ 7 - 0
Userland/Libraries/LibCore/System.cpp

@@ -85,4 +85,11 @@ ErrorOr<void*> mmap(void* address, size_t size, int protection, int flags, int f
 #endif
 }
 
+ErrorOr<void> munmap(void* address, size_t size)
+{
+    if (::munmap(address, size) < 0)
+        return Error::from_syscall("munmap"sv, -errno);
+    return {};
+}
+
 }

+ 1 - 0
Userland/Libraries/LibCore/System.h

@@ -21,5 +21,6 @@ ErrorOr<void> sigaction(int signal, struct sigaction const* action, struct sigac
 ErrorOr<struct stat> fstat(int fd);
 ErrorOr<int> fcntl(int fd, int command, ...);
 ErrorOr<void*> mmap(void* address, size_t, int protection, int flags, int fd, off_t, size_t alignment = 0, StringView name = {});
+ErrorOr<void> munmap(void* address, size_t);
 
 }