1READAHEAD(2)               Linux Programmer's Manual              READAHEAD(2)
2
3
4

NAME

6       readahead - perform file readahead into page cache
7

SYNOPSIS

9       #include <fcntl.h>
10
11       ssize_t readahead(int fd, off64_t *offset, size_t count);
12

DESCRIPTION

14       readahead() populates the page cache with data from a file so that sub‐
15       sequent reads from that file will not block on disk I/O.  The fd  argu‐
16       ment  is  a  file  descriptor identifying the file which is to be read.
17       The offset argument specifies the starting point from which data is  to
18       be  read  and  count  specifies the number of bytes to be read.  I/O is
19       performed in whole pages, so that offset is effectively rounded down to
20       a page boundary and bytes are read up to the next page boundary greater
21       than or equal to (offset+count).  readahead() does not read beyond  the
22       end  of the file.  readahead() blocks until the specified data has been
23       read.  The current file offset of the open file referred to  by  fd  is
24       left unchanged.
25

RETURN VALUE

27       On  success,  readahead()  returns  0; on failure, -1 is returned, with
28       errno set to indicate the cause of the error.
29

ERRORS

31       EBADF  fd is not a valid file descriptor or is not open for reading.
32
33       EINVAL fd does not refer to a file type to  which  readahead()  can  be
34              applied.
35

CONFORMING TO

37       The  readahead()  system  call is Linux specific, and its use should be
38       avoided in portable applications.
39

NOTES

41       The readahead() system call appeared in Linux 2.4.13.
42

SEE ALSO

44       fadvise(2), lseek(2), madvise(2), mmap(2), posix_fadvise(2), read(2)
45
46
47
48Linux 2.6.5                       2004-10-05                      READAHEAD(2)
Impressum