]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man2/readahead.2
Maintenance scripts
[thirdparty/man-pages.git] / man2 / readahead.2
CommitLineData
fea681da
MK
1.\" Hey Emacs! This file is -*- nroff -*- source.
2.\"
3.\" This manpage is Copyright (C) 2004, Michael Kerrisk
4.\"
5.\" Permission is granted to make and distribute verbatim copies of this
6.\" manual provided the copyright notice and this permission notice are
7.\" preserved on all copies.
8.\"
9.\" Permission is granted to copy and distribute modified versions of this
10.\" manual under the conditions for verbatim copying, provided that the
11.\" entire resulting derived work is distributed under the terms of a
12.\" permission notice identical to this one.
13.\"
14.\" Since the Linux kernel and libraries are constantly changing, this
15.\" manual page may be incorrect or out-of-date. The author(s) assume no
16.\" responsibility for errors or omissions, or for damages resulting from
17.\" the use of the information contained herein.
18.\"
19.\" Formatted or processed versions of this manual, if unaccompanied by
20.\" the source, must acknowledge the copyright and authors of this work.
21.\"
305a0578 22.\" 2004-05-40 Created by Michael Kerrisk <mtk-manpages@gmx.net>
fea681da
MK
23.\" 2004-10-05 aeb, minor correction
24.\"
25.TH READAHEAD 2 2004-10-05 "Linux 2.6.5" "Linux Programmer's Manual"
26.SH NAME
27readahead \- perform file readahead into page cache
28.SH SYNOPSIS
29.nf
30.B #include <fcntl.h>
31.sp
32.BI "ssize_t readahead(int " fd ", off64_t *" offset ", size_t " count );
33.fi
34.SH DESCRIPTION
35.B readahead()
36populates the page cache with data from a file so that subsequent
37reads from that file will not block on disk I/O.
38The
39.I fd
40argument is a file descriptor identifying the file which is
41to be read.
42The
43.I offset
44argument specifies the starting point from which data is to be read
45and
46.I count
47specifies the number of bytes to be read.
48I/O is performed in whole pages, so that
49.I offset
50is effectively rounded down to a page boundary
51and bytes are read up to the next page boundary greater than or
52equal to
53.IR "(offset+count)" .
54.B readahead()
55does not read beyond the end of the file.
56.B readahead()
57blocks until the specified data has been read.
58The current file offset of the open file referred to by
59.I fd
60is left unchanged.
61.SH "RETURN VALUE"
62On success,
63.B readahead()
64returns 0; on failure, \-1 is returned, with
65.I errno
66set to indicate the cause of the error.
67.SH ERRORS
68.TP
69.B EBADF
70.I fd
71is not a valid file descriptor or is not open for reading.
72.TP
73.B EINVAL
74.I fd
75does not refer to a file type to which
76.B readahead
77can be applied.
78.SH "CONFORMING TO"
79The
80.B readahead()
81system call is Linux specific, and its use should be avoided
82in portable applications.
83.SH NOTES
84The
85.B readahead()
86system call appeared in Linux 2.4.13.
87.SH "SEE ALSO"
88.BR fadvise (2),
89.BR lseek (2),
90.BR madvise (2),
91.BR mmap (2),
92.BR read (2)