Provide advisory information about the expected use of a file
#include <fcntl.h> int posix_fadvise( int fd, off_t offset, size_t len, int advice ); int posix_fadvise64( int fd, off64_t offset, size_t len, int advice );
- An open file descriptor.
- The offset of the data about which you want to provide advice.
- The length of the data.
- The advice you want to give; one of:
- POSIX_FADV_NORMAL — the application has no advice to give on its behavior with respect to the specified data. This is the default characteristic if no advice is given for an open file.
- POSIX_FADV_SEQUENTIAL — the application expects to access the specified data sequentially from lower offsets to higher offsets.
- POSIX_FADV_RANDOM — the application expects to access the specified data in a random order.
- POSIX_FADV_WILLNEED — the application expects to access the specified data in the near future.
- POSIX_FADV_DONTNEED — the application expects that it will not access the specified data in the near future.
- POSIX_FADV_NOREUSE — the application expects to access the specified data once and then not reuse it thereafter.
Use the -l c option to qcc to link against this library. This library is usually included automatically.
The posix_fadvise() and posix_fadvise64() functions advise the filesystem how the application expects to use the data in the file associated with the open file descriptor, fd, starting at offset and continuing for len bytes. The posix_fadvise64() is a large-file version of posix_fadvise().
The specified range need not currently exist in the file. If len is zero, all data following offset is specified. The filesystem may use this information to optimize handling of the specified data. The posix_fadvise() function has no effect on the semantics of other operations on the specified data, although it may affect the performance of other operations.
- The fd argument isn't a valid file descriptor.
- The value of advice is invalid.
- The fd argument is associated with a pipe or FIFO.
Last modified: 2013-09-30