1 .\" This manpage is Copyright (C) 2004, Michael Kerrisk
3 .\" %%%LICENSE_START(VERBATIM)
4 .\" Permission is granted to make and distribute verbatim copies of this
5 .\" manual provided the copyright notice and this permission notice are
6 .\" preserved on all copies.
8 .\" Permission is granted to copy and distribute modified versions of this
9 .\" manual under the conditions for verbatim copying, provided that the
10 .\" entire resulting derived work is distributed under the terms of a
11 .\" permission notice identical to this one.
13 .\" Since the Linux kernel and libraries are constantly changing, this
14 .\" manual page may be incorrect or out-of-date. The author(s) assume no
15 .\" responsibility for errors or omissions, or for damages resulting from
16 .\" the use of the information contained herein. The author(s) may not
17 .\" have taken the same level of care in the production of this manual,
18 .\" which is licensed free of charge, as they might when working
21 .\" Formatted or processed versions of this manual, if unaccompanied by
22 .\" the source, must acknowledge the copyright and authors of this work.
25 .\" 2004-05-40 Created by Michael Kerrisk <mtk.manpages@gmail.com>
26 .\" 2004-10-05 aeb, minor correction
28 .TH READAHEAD 2 2016-03-15 "Linux" "Linux Programmer's Manual"
30 readahead \- initiate file readahead into page cache
33 .BR "#define _GNU_SOURCE" " /* See feature_test_macros(7) */"
36 .BI "ssize_t readahead(int " fd ", off64_t " offset ", size_t " count );
40 initiates readahead on a file so that subsequent reads from that file will
41 be satisfied from the cache, and not block on disk I/O
42 (assuming the readahead was initiated early enough and that other activity
43 on the system did not in the meantime flush pages from the cache).
47 argument is a file descriptor identifying the file which is
51 argument specifies the starting point from which data is to be read
54 specifies the number of bytes to be read.
55 I/O is performed in whole pages, so that
57 is effectively rounded down to a page boundary
58 and bytes are read up to the next page boundary greater than or
60 .IR "(offset+count)" .
62 does not read beyond the end of the file.
63 The file offset of the open file description referred to by
69 returns 0; on failure, \-1 is returned, with
71 set to indicate the cause of the error.
76 is not a valid file descriptor or is not open for reading.
80 does not refer to a file type to which
86 system call appeared in Linux 2.4.13;
87 glibc support has been provided since version 2.3.
91 system call is Linux-specific, and its use should be avoided
92 in portable applications.
94 On some 32-bit architectures,
95 the calling signature for this system call differs,
96 for the reasons described in
100 attempts to schedule the reads in the background and return immediately.
101 However, it may block while it reads the filesystem metadata needed
102 to locate the requested blocks.
103 This occurs frequently with ext[234] on large files
104 using indirect blocks instead of extents,
105 giving the appearance that the call blocks until the requested data has
111 .BR posix_fadvise (2),