mirror of https://github.com/mkerrisk/man-pages
posix_fadvise.2: Reorganize some text
Details for various flags were hidden under NOTES. Move them to DESCRIPTION, to make the details more obvious. Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
parent
dfbb4842f9
commit
a6b80261c8
|
@ -78,12 +78,47 @@ The specified data will be accessed in random order.
|
|||
.TP
|
||||
.B POSIX_FADV_NOREUSE
|
||||
The specified data will be accessed only once.
|
||||
|
||||
In kernels before 2.6.18, \fBPOSIX_FADV_NOREUSE\fP had the
|
||||
same semantics as \fBPOSIX_FADV_WILLNEED\fP.
|
||||
This was probably a bug; since kernel 2.6.18, this flag is a no-op.
|
||||
.TP
|
||||
.B POSIX_FADV_WILLNEED
|
||||
The specified data will be accessed in the near future.
|
||||
|
||||
\fBPOSIX_FADV_WILLNEED\fP initiates a
|
||||
nonblocking read of the specified region into the page cache.
|
||||
The amount of data read may be decreased by the kernel depending
|
||||
on virtual memory load.
|
||||
(A few megabytes will usually be fully satisfied,
|
||||
and more is rarely useful.)
|
||||
.TP
|
||||
.B POSIX_FADV_DONTNEED
|
||||
The specified data will not be accessed in the near future.
|
||||
|
||||
\fBPOSIX_FADV_DONTNEED\fP attempts to free cached pages associated with
|
||||
the specified region.
|
||||
This is useful, for example, while streaming large
|
||||
files.
|
||||
A program may periodically request the kernel to free cached data
|
||||
that has already been used, so that more useful cached pages are not
|
||||
discarded instead.
|
||||
|
||||
Requests to discard partial pages are ignored.
|
||||
It is preferable to preserve needed data than discard unneeded data.
|
||||
If the application requires that data be considered for discarding, then
|
||||
.I offset
|
||||
and
|
||||
.I len
|
||||
must be page-aligned.
|
||||
|
||||
Pages that have not yet been written out will be unaffected, so if the
|
||||
application wishes to guarantee that pages will be released, it should
|
||||
call
|
||||
.BR fsync (2)
|
||||
or
|
||||
.BR fdatasync (2)
|
||||
first.
|
||||
.SH RETURN VALUE
|
||||
On success, zero is returned.
|
||||
On error, an error number is returned.
|
||||
|
@ -134,41 +169,6 @@ default size for the backing device; \fBPOSIX_FADV_SEQUENTIAL\fP doubles
|
|||
this size, and \fBPOSIX_FADV_RANDOM\fP disables file readahead entirely.
|
||||
These changes affect the entire file, not just the specified region
|
||||
(but other open file handles to the same file are unaffected).
|
||||
|
||||
\fBPOSIX_FADV_WILLNEED\fP initiates a
|
||||
nonblocking read of the specified region into the page cache.
|
||||
The amount of data read may be decreased by the kernel depending
|
||||
on virtual memory load.
|
||||
(A few megabytes will usually be fully satisfied,
|
||||
and more is rarely useful.)
|
||||
|
||||
In kernels before 2.6.18, \fBPOSIX_FADV_NOREUSE\fP had the
|
||||
same semantics as \fBPOSIX_FADV_WILLNEED\fP.
|
||||
This was probably a bug; since kernel 2.6.18, this flag is a no-op.
|
||||
|
||||
\fBPOSIX_FADV_DONTNEED\fP attempts to free cached pages associated with
|
||||
the specified region.
|
||||
This is useful, for example, while streaming large
|
||||
files.
|
||||
A program may periodically request the kernel to free cached data
|
||||
that has already been used, so that more useful cached pages are not
|
||||
discarded instead.
|
||||
|
||||
Requests to discard partial pages are ignored.
|
||||
It is preferable to preserve needed data than discard unneeded data.
|
||||
If the application requires that data be considered for discarding, then
|
||||
.I offset
|
||||
and
|
||||
.I len
|
||||
must be page-aligned.
|
||||
|
||||
Pages that have not yet been written out will be unaffected, so if the
|
||||
application wishes to guarantee that pages will be released, it should
|
||||
call
|
||||
.BR fsync (2)
|
||||
or
|
||||
.BR fdatasync (2)
|
||||
first.
|
||||
.SS C library/kernel differences
|
||||
The name of the wrapper function in the C library is
|
||||
.BR posix_fadvise ().
|
||||
|
|
Loading…
Reference in New Issue