254 lines
5.2 KiB
HTML
254 lines
5.2 KiB
HTML
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<HTML><HEAD><TITLE>Man page of MINCORE</TITLE>
|
|
</HEAD><BODY>
|
|
<H1>MINCORE</H1>
|
|
Section: Linux Programmer's Manual (2)<BR>Updated: 2017-09-15<BR><A HREF="#index">Index</A>
|
|
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
|
|
|
<A NAME="lbAB"> </A>
|
|
<H2>NAME</H2>
|
|
|
|
mincore - determine whether pages are resident in memory
|
|
<A NAME="lbAC"> </A>
|
|
<H2>SYNOPSIS</H2>
|
|
|
|
<B>#include <<A HREF="file:///usr/include/unistd.h">unistd.h</A>></B>
|
|
|
|
<BR>
|
|
|
|
<B>#include <<A HREF="file:///usr/include/sys/mman.h">sys/mman.h</A>></B>
|
|
|
|
<P>
|
|
|
|
<B>int mincore(void *</B><I>addr</I><B>, size_t </B><I>length</I><B>, unsigned char *</B><I>vec</I><B>);</B>
|
|
|
|
<P>
|
|
|
|
|
|
Feature Test Macro Requirements for glibc (see
|
|
<B><A HREF="/cgi-bin/man/man2html?7+feature_test_macros">feature_test_macros</A></B>(7)):
|
|
|
|
|
|
<P>
|
|
|
|
<B>mincore</B>():
|
|
|
|
<BR> Since glibc 2.19:
|
|
<BR> _DEFAULT_SOURCE
|
|
<BR> Glibc 2.19 and earlier:
|
|
<BR> _BSD_SOURCE || _SVID_SOURCE
|
|
<A NAME="lbAD"> </A>
|
|
<H2>DESCRIPTION</H2>
|
|
|
|
<B>mincore</B>()
|
|
|
|
returns a vector that indicates whether pages
|
|
of the calling process's virtual memory are resident in core (RAM),
|
|
and so will not cause a disk access (page fault) if referenced.
|
|
The kernel returns residency information about the pages
|
|
starting at the address
|
|
<I>addr</I>,
|
|
|
|
and continuing for
|
|
<I>length</I>
|
|
|
|
bytes.
|
|
<P>
|
|
|
|
The
|
|
<I>addr</I>
|
|
|
|
argument must be a multiple of the system page size.
|
|
The
|
|
<I>length</I>
|
|
|
|
argument need not be a multiple of the page size,
|
|
but since residency information is returned for whole pages,
|
|
<I>length</I>
|
|
|
|
is effectively rounded up to the next multiple of the page size.
|
|
One may obtain the page size
|
|
(<B>PAGE_SIZE</B>)
|
|
|
|
using
|
|
<I>sysconf(_SC_PAGESIZE)</I>.
|
|
|
|
<P>
|
|
|
|
The
|
|
<I>vec</I>
|
|
|
|
argument must point to an array containing at least
|
|
<I>(length+PAGE_SIZE-1) / PAGE_SIZE</I>
|
|
|
|
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</I>
|
|
|
|
is only a snapshot: pages that are not
|
|
locked in memory can come and go at any moment, and the contents of
|
|
<I>vec</I>
|
|
|
|
may already be stale by the time this call returns.
|
|
<A NAME="lbAE"> </A>
|
|
<H2>RETURN VALUE</H2>
|
|
|
|
On success,
|
|
<B>mincore</B>()
|
|
|
|
returns zero.
|
|
On error, -1 is returned, and
|
|
<I>errno</I>
|
|
|
|
is set appropriately.
|
|
<A NAME="lbAF"> </A>
|
|
<H2>ERRORS</H2>
|
|
|
|
<B>EAGAIN</B>
|
|
|
|
kernel is temporarily out of resources.
|
|
<DL COMPACT>
|
|
<DT id="1"><B>EFAULT</B>
|
|
|
|
<DD>
|
|
<I>vec</I>
|
|
|
|
points to an invalid address.
|
|
<DT id="2"><B>EINVAL</B>
|
|
|
|
<DD>
|
|
<I>addr</I>
|
|
|
|
is not a multiple of the page size.
|
|
<DT id="3"><B>ENOMEM</B>
|
|
|
|
<DD>
|
|
<I>length</I>
|
|
|
|
is greater than
|
|
(<I>TASK_SIZE</I> - <I>addr</I>).
|
|
|
|
(This could occur if a negative value is specified for
|
|
<I>length</I>,
|
|
|
|
since that value will be interpreted as a large
|
|
unsigned integer.)
|
|
In Linux 2.6.11 and earlier, the error
|
|
<B>EINVAL</B>
|
|
|
|
was returned for this condition.
|
|
<DT id="4"><B>ENOMEM</B>
|
|
|
|
<DD>
|
|
<I>addr</I>
|
|
|
|
to
|
|
<I>addr</I>
|
|
|
|
+
|
|
<I>length</I>
|
|
|
|
contained unmapped memory.
|
|
</DL>
|
|
<A NAME="lbAG"> </A>
|
|
<H2>VERSIONS</H2>
|
|
|
|
Available since Linux 2.3.99pre1 and glibc 2.2.
|
|
<A NAME="lbAH"> </A>
|
|
<H2>CONFORMING TO</H2>
|
|
|
|
<B>mincore</B>()
|
|
|
|
is not specified in POSIX.1,
|
|
and it is not available on all UNIX implementations.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<A NAME="lbAI"> </A>
|
|
<H2>BUGS</H2>
|
|
|
|
Before kernel 2.6.21,
|
|
<B>mincore</B>()
|
|
|
|
did not return correct information for
|
|
<B>MAP_PRIVATE</B>
|
|
|
|
mappings, or for nonlinear mappings (established using
|
|
<B><A HREF="/cgi-bin/man/man2html?2+remap_file_pages">remap_file_pages</A></B>(2)).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<A NAME="lbAJ"> </A>
|
|
<H2>SEE ALSO</H2>
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?1+fincore">fincore</A></B>(1),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+madvise">madvise</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+mlock">mlock</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+mmap">mmap</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+posix_fadvise">posix_fadvise</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?3+posix_madvise">posix_madvise</A></B>(3)
|
|
|
|
<A NAME="lbAK"> </A>
|
|
<H2>COLOPHON</H2>
|
|
|
|
This page is part of release 5.05 of the Linux
|
|
<I>man-pages</I>
|
|
|
|
project.
|
|
A description of the project,
|
|
information about reporting bugs,
|
|
and the latest version of this page,
|
|
can be found at
|
|
<A HREF="https://www.kernel.org/doc/man-pages/.">https://www.kernel.org/doc/man-pages/.</A>
|
|
<P>
|
|
|
|
<HR>
|
|
<A NAME="index"> </A><H2>Index</H2>
|
|
<DL>
|
|
<DT id="5"><A HREF="#lbAB">NAME</A><DD>
|
|
<DT id="6"><A HREF="#lbAC">SYNOPSIS</A><DD>
|
|
<DT id="7"><A HREF="#lbAD">DESCRIPTION</A><DD>
|
|
<DT id="8"><A HREF="#lbAE">RETURN VALUE</A><DD>
|
|
<DT id="9"><A HREF="#lbAF">ERRORS</A><DD>
|
|
<DT id="10"><A HREF="#lbAG">VERSIONS</A><DD>
|
|
<DT id="11"><A HREF="#lbAH">CONFORMING TO</A><DD>
|
|
<DT id="12"><A HREF="#lbAI">BUGS</A><DD>
|
|
<DT id="13"><A HREF="#lbAJ">SEE ALSO</A><DD>
|
|
<DT id="14"><A HREF="#lbAK">COLOPHON</A><DD>
|
|
</DL>
|
|
<HR>
|
|
This document was created by
|
|
<A HREF="/cgi-bin/man/man2html">man2html</A>,
|
|
using the manual pages.<BR>
|
|
Time: 00:05:33 GMT, March 31, 2021
|
|
</BODY>
|
|
</HTML>
|