Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

readahead(2) [suse man page]

READAHEAD(2)						     Linux Programmer's Manual						      READAHEAD(2)

NAME
readahead - perform file readahead into page cache SYNOPSIS
#define _GNU_SOURCE #include <fcntl.h> ssize_t readahead(int fd, off64_t offset, size_t count); DESCRIPTION
readahead() populates the page cache with data from a file so that subsequent reads from that file will not block on disk I/O. The fd argument is a file descriptor identifying the file which is to be read. The offset argument specifies the starting point from which data is to be read and count specifies the number of bytes to be read. I/O is performed in whole pages, so that offset is effectively rounded down to a page boundary and bytes are read up to the next page boundary greater than or equal to (offset+count). readahead() does not read beyond the end of the file. readahead() blocks until the specified data has been read. The current file offset of the open file referred to by fd is left unchanged. RETURN VALUE
On success, readahead() returns 0; on failure, -1 is returned, with errno set to indicate the cause of the error. ERRORS
EBADF fd is not a valid file descriptor or is not open for reading. EINVAL fd does not refer to a file type to which readahead() can be applied. VERSIONS
The readahead() system call appeared in Linux 2.4.13; glibc support has been provided since version 2.3. CONFORMING TO
The readahead() system call is Linux-specific, and its use should be avoided in portable applications. SEE ALSO
lseek(2), madvise(2), mmap(2), posix_fadvise(2), read(2) COLOPHON
This page is part of release 3.25 of the Linux man-pages project. A description of the project, and information about reporting bugs, can be found at http://www.kernel.org/doc/man-pages/. Linux 2007-07-26 READAHEAD(2)

Check Out this Related Man Page

SD-READAHEAD(7)                                                    sd-readahead                                                    SD-READAHEAD(7)

NAME
sd-readahead - Reference implementation of APIs for controlling boot-time read-ahead SYNOPSIS
#include "sd-readahead.h" DESCRIPTION
sd-readahead.c and sd-readahead.h provide a reference implementation for APIs for controlling boot-time read-ahead, as implemented by the read-ahead subsystem of the systemd(1) init system. See sd_readahead(3) for more information about the function implemented. NOTES
This interface is provided by the reference implementation of APIs for controlling boot-time read-ahead and distributed with the systemd package. The algorithms it implements are simple, and can easily be reimplemented in daemons if it is important to support this interface without using the reference implementation. See the respective function man pages for details. In addition, for details about the algorithms check the liberally licensed reference implementation sources: http://cgit.freedesktop.org/systemd/systemd/plain/src/readahead/sd-readahead.c resp. http://cgit.freedesktop.org/systemd/systemd/plain/src/systemd/sd-readahead.h These APIs are implemented in the reference implementation's drop-in sd-readahead.c and sd-readahead.h files. It is recommended that applications consuming these APIs copy the implementation into their source tree, either verbatim or in excerpts. These interfaces are currently not available in a dynamic library. The functions provided by this interface become NOPs when -DDISABLE_SYSTEMD is set during compilation. In addition, if sd-readhead.c is compiled on non-Linux systems it becomes NOPs. SEE ALSO
systemd(1), sd_readahead(3), sd-daemon(7) AUTHOR
Lennart Poettering <lennart@poettering.net> Developer systemd 03/16/2012 SD-READAHEAD(7)
Man Page