Pārlūkot izejas kodu

LibCore: Add Core::System::posix_fallocate()

Andreas Kling 2 gadi atpakaļ
vecāks
revīzija
c8ff2184bd

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

@@ -1400,4 +1400,14 @@ ErrorOr<String> readlink(StringView pathname)
 #endif
 #endif
 }
 }
 
 
+#ifdef AK_OS_SERENITY
+ErrorOr<void> posix_fallocate(int fd, off_t offset, off_t length)
+{
+    int rc = ::posix_fallocate(fd, offset, length);
+    if (rc != 0)
+        return Error::from_syscall("posix_fallocate"sv, -rc);
+    return {};
+}
+#endif
+
 }
 }

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

@@ -206,4 +206,8 @@ ErrorOr<void> unlockpt(int fildes);
 ErrorOr<void> access(StringView pathname, int mode);
 ErrorOr<void> access(StringView pathname, int mode);
 ErrorOr<String> readlink(StringView pathname);
 ErrorOr<String> readlink(StringView pathname);
 
 
+#ifdef AK_OS_SERENITY
+ErrorOr<void> posix_fallocate(int fd, off_t offset, off_t length);
+#endif
+
 }
 }