HP-UX Reference (11i v3 07/02) - 2 System Calls (vol 5)
f
fadvise(2) fadvise(2)
alias (see fadvise(5)). The page size specified in the fad_pgsize alias will be
rounded down to the supported large page size in the system. If no hint is
specified, then the page size specified in the tunable
vps_pagesize will
be used.
FADV_NOREUSE Specifies that the application will expect to access the specified range of
data once and then not reuse it thereafter.
FADV_NORMAL Specifies that the application has no advice to give on its behavior with
respect to the specified data. It is the default characteristic if no advice is
given for an open file.
FADV_RANDOM Specifies that the application will expect to access the specified specified
range of data in a random order.
FADV_SEQUENTIAL
Specifies that the application expects to access the specified range of data
sequentially from the lower offsets to higher offsets.
FADV_SYNC_NONE
No pages associated with given fd should be sync’d by VM.
FADV_SYNC_RDWR Sets paging policies used by the VM syncer for a fd when selecting pages
for page out. This policy indicates that pages associated with file i/o should
be sync’d in a time interval designated by the fad_synctime alias (see fad-
vise(5)). This is default behavior with time interval set by VM.
FADV_WILLNEED Specifies that the application will expect to access the specified range of
data in the near future.
These values will be defined in <sys/fadvise.h>
.
RETURN VALUE
0 Successful completion.
-1 Failure. errno is set to indicate the error.
ERRORS
If the fadvise() service fails, errno is set to one of the following values:
[EBADF] The fd argument is not a valid file descriptor.
[EINVAL] The value of fad_advice or one of the other input values has been found to be invalid.
[ENOSYS] A designated hint is not supported by the underlying file object.
[ENOTTY] The fadvise operation is not supported by the underlying file system.
[ESPIPE] The fd argument is associated with a pipe or FIFO.
If an error is detected while processing a given fad_advice hint, an error number will be returned indicating
the related error (see errno.h). The error number value, therefore, is independent of the error numbers
listed above.
EXAMPLES
int fd, ret;
struct fad_extparms *my_fad_extparms;
struct fad_parms *fad_plistp;
/*
* Advise the system that we’re sequentially accessing the
* 64KB range and will not be re-using the data.
*/
fd = open (argv[1], O_RDONLY|O_CREAT, 0777);
my_fad_extparms = calloc(1, sizeof(int) + 2 * sizeof(struct fad_parms));
my_fad_extparms->fad_count = 2;
/* Initialize the two fad_parms entries. */
fad_plistp = &my_fad_extparms->fad_plist[0];
/* Hint that we’re doing sequential access. */
HP-UX 11i Version 3: February 2007 − 2 − Hewlett-Packard Company 101