fadvise (2) - Linux Manuals

fadvise: Give advice about file access

NAME

fadvise64,fadvise64_64 - Give advice about file access

SYNOPSIS

long fadvise64_64 (int fs, loff_t offset, loff_t len, int advice, int fs, loff_t offset, loff_t len, int advice);
long sys_fadvise64  (int fs, loff_t offset, loff_t len, int advice, int fs, loff_t offset, loff_t len, int advice);

DESCRIPTION

Allows an application to to tell the kernel how it expects to use a file handle, so that the kernel can choose appropriate read-ahead and caching techniques for access to the corresponding file. This is similar to the POSIX version of the madvise system call, but for file access instead of memory access. The sys_fadvise64() function is obsolete and corresponds to a broken glibc API, sys_fadvise64_64() is the fixed version. The following are the values for the advice parameter:

FADV_NORMAL
No special treatment.

FADV_RANDOM
Expect page references in random order.

FADV_SEQUENTIAL
Expect page references in sequential order.

FADV_WILLNEED
Expect access in the near future.

FADV_DONTNEED
Do not expect access in the near future. Subsequent access of pages in this range will succeed, but will result either in reloading of the memory contents from the underlying mapped file or zero-fill-in-demand pages for mappings without an underlying file.

FADV_NOREUSE
Access data only once.

ERRORS

-EBADF
An invalid file descriptor was specified. to modify the modules.

-EINVAL
An invalid f_mapping of file, len value smaller than 0 or advice value unknown.

AUTHOR

Niki Rahimi

SEE ALSO

madvise(2)