.\" Hey Emacs! This file is -*- nroff -*- source. .\" .\" Copyright (C) 2001 Bert Hubert .\" and Copyright (C) 2007 Michael Kerrisk .\" and Copyright (C) 2010 Chris Frost , UC Regents .\" .\" Permission is granted to make and distribute verbatim copies of this .\" manual provided the copyright notice and this permission notice are .\" preserved on all copies. .\" .\" Permission is granted to copy and distribute modified versions of this .\" manual under the conditions for verbatim copying, provided that the .\" entire resulting derived work is distributed under the terms of a .\" permission notice identical to this one. .\" .\" Since the Linux kernel and libraries are constantly changing, this .\" manual page may be incorrect or out-of-date. The author(s) assume no .\" responsibility for errors or omissions, or for damages resulting from .\" the use of the information contained herein. The author(s) may not .\" have taken the same level of care in the production of this manual, .\" which is licensed free of charge, as they might when working .\" professionally. .\" .\" Formatted or processed versions of this manual, if unaccompanied by .\" the source, must acknowledge the copyright and authors of this work. .\" .\" Created Sun Jun 3 17:23:32 2001 by bert hubert .\" Slightly adapted, following comments by Hugh Dickins, aeb, 2001-06-04. .\" Modified, 20 May 2003, Michael Kerrisk .\" Modified, 30 Apr 2004, Michael Kerrisk .\" 2005-04-05 mtk, Fixed error descriptions .\" after message from .\" 2007-01-08 mtk, rewrote various parts .\" Adapted for fincore, 2010-02-13, Chris Frost .\" .TH FINCORE 2 2010-02-13 "Linux" "Linux Programmer's Manual" .SH NAME fincore \- determine whether buffer cache pages are resident in memory .SH SYNOPSIS .B #define _GNU_SOURCE .br .B #include .sp .BI "int fincore(int " fd ", loff_t " start ", loff_t " length ", unsigned char *" vec ); .SH DESCRIPTION .BR fincore () returns a vector that indicates whether pages for a file descriptor are resident in core (RAM), and so will not cause a disk access if read. The kernel returns residency information about the pages starting at the offset .IR start , and continuing for .I length bytes. The .I start argument must be a multiple of the system page size. The .I length argument need not be a multiple of the page size, but since residency information is returned for whole pages, .I length is effectively rounded up to the next multiple of the page size. One may obtain the page size .RB ( PAGE_SIZE ) using .IR sysconf(_SC_PAGESIZE) . The .I vec argument must point to an array containing at least .I "(length+PAGE_SIZE\-1) / PAGE_SIZE" bytes. On return, the least significant bit of each byte will be set if the corresponding page is currently resident in memory, and be clear otherwise. (The settings of the other bits in each byte are undefined; these bits are reserved for possible later use.) Of course the information returned in .I vec is only a snapshot: pages that are not locked in memory can come and go at any moment, and the contents of .I vec may already be stale by the time this call returns. .SH "RETURN VALUE" On success, .BR fincore () returns zero. On error, \-1 is returned, and .I errno is set appropriately. .SH ERRORS .B EAGAIN kernel is temporarily out of resources. .TP .B EBADF .I fd is an illegal file descriptor. .TP .B EFAULT .I vec points to an invalid address. .TP .B EINVAL .I start is not a multiple of the page size. .TP .B EINTR The call was interrupted by a signal. .SH VERSIONS Available since Linux 2.6.? and glibc 2.?. .SH "CONFORMING TO" .BR fincore () is not specified in POSIX.1-2001, and it is not available on all Unix implementations. .\" Does it exist on other systems? .SH "SEE ALSO" .BR mincore (2) .SH COLOPHON This page is part of release 3.23 of the Linux .I man-pages project. A description of the project, and information about reporting bugs, can be found at http://www.kernel.org/doc/man-pages/.