add linux readahead syscall
authorRich Felker <dalias@aerifal.cx>
Sat, 8 Sep 2012 04:40:37 +0000 (00:40 -0400)
committerRich Felker <dalias@aerifal.cx>
Sat, 8 Sep 2012 04:40:37 +0000 (00:40 -0400)
include/fcntl.h
src/linux/readahead.c [new file with mode: 0644]

index 68baf7a24e0bf6d40f33b6206d6e7517b22c63a9..b8d8702e6f982579f98524eb6d6dfa6f518a54a0 100644 (file)
@@ -123,6 +123,7 @@ struct f_owner_ex {
 #define SPLICE_F_MORE 4
 #define SPLICE_F_GIFT 8
 int fallocate(int, int, off_t, off_t);
+ssize_t readahead(int, off_t, size_t);
 ssize_t vmsplice(int, const struct iovec *, size_t, unsigned);
 ssize_t splice(int, off_t *, int, off_t *, size_t, unsigned);
 #define loff_t off_t
diff --git a/src/linux/readahead.c b/src/linux/readahead.c
new file mode 100644 (file)
index 0000000..5c70bfd
--- /dev/null
@@ -0,0 +1,8 @@
+#define _GNU_SOURCE
+#include <fcntl.h>
+#include "syscall.h"
+
+ssize_t readahead(int fd, off_t pos, size_t len)
+{
+       return syscall(SYS_readahead, fd, __SYSCALL_LL_O(pos), len);
+}