浏览代码

add linux readahead syscall

Rich Felker 12 年之前
父节点
当前提交
90f770523f
共有 2 个文件被更改,包括 9 次插入0 次删除
  1. 1 0
      include/fcntl.h
  2. 8 0
      src/linux/readahead.c

+ 1 - 0
include/fcntl.h

@@ -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

+ 8 - 0
src/linux/readahead.c

@@ -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);
+}