add syscall wrappers for posix_fadvise, posix_fallocate
authorRich Felker <dalias@aerifal.cx>
Wed, 20 Apr 2011 19:20:22 +0000 (15:20 -0400)
committerRich Felker <dalias@aerifal.cx>
Wed, 20 Apr 2011 19:20:22 +0000 (15:20 -0400)
arch/i386/bits/syscall.h
arch/x86_64/bits/syscall.h
src/fcntl/posix_fadvise.c [new file with mode: 0644]
src/fcntl/posix_fallocate.c [new file with mode: 0644]

index 274f205ccb81ef2c6b92edcf67be7e415b57397b..16565eee1e56a5cd0e90a68c10d12f20ae21e680 100644 (file)
@@ -527,6 +527,8 @@ static inline long __syscall6(long __n, long __a1, long __a2, long __a3, long __
 #define __NR_pread __NR_pread64
 #define __NR_pwrite __NR_pwrite64
 
+#define __NR_fadvise __NR_fadvise64_64
+
 #undef __NR_getrlimit
 #define __NR_getrlimit __NR_ugetrlimit
 
@@ -936,6 +938,8 @@ static inline long __syscall6(long __n, long __a1, long __a2, long __a3, long __
 #define SYS_pread SYS_pread64
 #define SYS_pwrite SYS_pwrite64
 
+#define SYS_fadvise SYS_fadvise64_64
+
 #undef SYS_getrlimit
 #define SYS_getrlimit SYS_ugetrlimit
 
index 21d4c23a7f4805967bd1bfc9d82e7436c61d9851..2339d2e5245fa7f9ad48615c0f77bf80a105582c 100644 (file)
@@ -375,6 +375,7 @@ static inline long __syscall6(long __n, long __a1, long __a2, long __a3, long __
 #define __NR_pread __NR_pread64
 #define __NR_pwrite __NR_pwrite64
 #define __NR_getdents __NR_getdents64
+#define __NR_fadvise __NR_fadvise64
 
 
 
@@ -692,5 +693,6 @@ static inline long __syscall6(long __n, long __a1, long __a2, long __a3, long __
 #define SYS_pread SYS_pread64
 #define SYS_pwrite SYS_pwrite64
 #define SYS_getdents SYS_getdents64
+#define SYS_fadvise SYS_fadvise64
 
 
diff --git a/src/fcntl/posix_fadvise.c b/src/fcntl/posix_fadvise.c
new file mode 100644 (file)
index 0000000..75edafa
--- /dev/null
@@ -0,0 +1,8 @@
+#include <fcntl.h>
+#include "syscall.h"
+
+int posix_fadvise(int fd, off_t base, off_t len, int advice)
+{
+       return -__syscall(SYS_fadvise, fd, __SYSCALL_LL(base),
+               __SYSCALL_LL(len), advice);
+}
diff --git a/src/fcntl/posix_fallocate.c b/src/fcntl/posix_fallocate.c
new file mode 100644 (file)
index 0000000..d6680c1
--- /dev/null
@@ -0,0 +1,8 @@
+#include <fcntl.h>
+#include "syscall.h"
+
+int posix_fallocate(int fd, off_t base, off_t len)
+{
+       return -__syscall(SYS_fallocate, fd, __SYSCALL_LL(base),
+               __SYSCALL_LL(len));
+}