//po4a: entry man manual
////
Copyright 2017 Red Hat, Inc.

This file may be copied under the terms of the GNU General Public License.
////
ifdef::neverdefined[---]

= fincore(1)
:doctype: manpage
:man manual: User Commands
:man source: util-linux {release-version}
:page-layout: base
:command: fincore
:plus: +

== NAME

fincore - count pages of file contents in core

== SYNOPSIS

*fincore* [options] _file_...

== DESCRIPTION

*fincore* counts pages of file contents being resident in memory (in core), and reports the numbers. If an error occurs during counting, then an error message is printed to the stderr and *fincore* continues processing the rest of files listed in a command line.
*fincore* uses the *cachestat*(2) syscall to count resident pages. If the *cachestat* syscall is not available and *cachestat* usage is not forced with the *--cachestat* option, then *fincore* uses the *mincore*(2) syscall as a fallback.
The *cachestat* syscall is more efficient than *mincore* because it does not require a page table lock to walks page tables, and also reports more information than *mincore*, like the number of cached pages, dirty pages, pages marked for writeback, evicted pages, and recently evicted pages.
Another difference between the two syscalls is that if write permissions are not granted to the file, then *cachestat* returns an error, while *mincore* for security reasons, returns fake data as if all pages were resident in memory (c.f.r. link:https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=134fca9063ad4851de767d1768180e5dede9a881[kernel commit "make mincore() more conservative"]).

The default output is subject to change. So whenever possible, you should avoid using default outputs in your scripts. Always explicitly define expected columns by using *--output* _columns-list_ in environments where a stable output is required.

== OPTIONS

*-n*, *--noheadings*::
Do not print a header line in status output.

*-b*, *--bytes*::
include::man-common/in-bytes.adoc[]

*-c*, *--total*::
produce a grand total.

*-C*, *--cachestat*::
force usage of the cachestat() syscall instead of mincore(), and fail if it's not available.

*-o*, *--output* _list_::
Define output columns. See the *--help* output to get a list of the currently supported columns. The default list of columns may be extended if _list_ is specified in the format _{plus}list_.
//TRANSLATORS: Keep {plus} untranslated.

*--output-all*::
Output all available columns.

*-r*, *--raw*::
Produce output in raw format. All potentially unsafe characters are hex-escaped (\x<code>).

*-J*, *--json*::
Use JSON output format.

*-R*, *--recursive*::
Recursively check all files in directories.

include::man-common/help-version.adoc[]

== AUTHORS

mailto:yamato@redhat.com[Masatake YAMATO]

== SEE ALSO

*mincore*(2),
*getpagesize*(2),
*getconf*(1p)
*cachestat*(2)

include::man-common/bugreports.adoc[]

include::man-common/footer.adoc[]

ifdef::translation[]
include::man-common/translation.adoc[]
endif::[]
