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

NAME

6       readahead - perform file readahead into page cache
7

SYNOPSIS

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

DESCRIPTION

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

RETURN VALUE

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

ERRORS

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

VERSIONS

38       The readahead() system call appeared in Linux 2.4.13; glibc support has
39       been provided since version 2.3.
40

CONFORMING TO

42       The readahead() system call is Linux-specific, and its  use  should  be
43       avoided in portable applications.
44

SEE ALSO

46       lseek(2), madvise(2), mmap(2), posix_fadvise(2), read(2)
47

COLOPHON

49       This  page  is  part of release 3.25 of the Linux man-pages project.  A
50       description of the project, and information about reporting  bugs,  can
51       be found at http://www.kernel.org/doc/man-pages/.
52
53
54
55Linux                             2007-07-26                      READAHEAD(2)
Impressum