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             /* See feature_test_macros(7) */
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

NOTES

46       On  some  32-bit  architectures,  the calling signature for this system
47       call differs, for the reasons described in syscall(2).
48

SEE ALSO

50       lseek(2), madvise(2), mmap(2), posix_fadvise(2), read(2)
51

COLOPHON

53       This page is part of release 3.53 of the Linux  man-pages  project.   A
54       description  of  the project, and information about reporting bugs, can
55       be found at http://www.kernel.org/doc/man-pages/.
56
57
58
59Linux                             2013-04-01                      READAHEAD(2)
Impressum