summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--arch/i386/bits/syscall.h4
-rw-r--r--arch/x86_64/bits/syscall.h2
-rw-r--r--src/fcntl/posix_fadvise.c8
-rw-r--r--src/fcntl/posix_fallocate.c8
4 files changed, 22 insertions, 0 deletions
diff --git a/arch/i386/bits/syscall.h b/arch/i386/bits/syscall.h
index 274f205c..16565eee 100644
--- a/arch/i386/bits/syscall.h
+++ b/arch/i386/bits/syscall.h
@@ -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
diff --git a/arch/x86_64/bits/syscall.h b/arch/x86_64/bits/syscall.h
index 21d4c23a..2339d2e5 100644
--- a/arch/x86_64/bits/syscall.h
+++ b/arch/x86_64/bits/syscall.h
@@ -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
index 00000000..75edafaf
--- /dev/null
+++ b/src/fcntl/posix_fadvise.c
@@ -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
index 00000000..d6680c14
--- /dev/null
+++ b/src/fcntl/posix_fallocate.c
@@ -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));
+}