Advise the kernel about file access patterns via posix_fadvise(2).
fadvise [options] filename
fadvise [options] -d file-descriptor
Calls posix_fadvise(2) to advise the kernel about expected access patterns
for a file. Most commonly used with dontneed to drop a file’s pages from
the page cache.
filename — file to advise on
-d fd — file descriptor number (for already-open files in scripts)
None (the syscall has no visible output).
Syscall Description
posix_fadvise(2)Declare access pattern for file data
Value Description
normalNo special access pattern (default kernel behavior)
sequentialData will be accessed sequentially
randomData will be accessed randomly
noreuseData will be accessed once
willneedData will be needed soon (prefetch)
dontneedData will not be needed soon (drop from cache) — default
Option Description
-a, --advice <advice>Advice to apply (default: dontneed)
-o, --offset <bytes>Beginning offset (default: 0)
-l, --length <bytes>Length of range (default: 0 = to end of file)
-d, --fd <N>Operate on file descriptor N instead of a filename
-h, --helpDisplay help
-V, --versionDisplay version
Code Meaning
0 Success
1 Failure