fadvise.5 (2010 09)
f
fadvise(5) fadvise(5)
NAME
fadvise: fadvise.h - structures needed when using the fadvise() function
SYNOPSIS
#include <sys/fcntl.h>
#include <sys/fadvise.h>
DESCRIPTION
The <sys/fadvise.h>
header defines the structures fad_extparms and
fad_parms and other
literals needed when using the
fadvise() function (see fadvise (2)).
The
fad_extparms structure contains the following members:
int fad_count number of entries in fad_plist[]
struct fad_parms fad_plist[1] array of struct fad_parms
The
fad_parms structure contains the following members:
hint applying to parameter tuple.enum fadv_hints fad_advice
may be one of the following: byte offset of range in file;
memory allocation policy for cc-numa systems.
off_t _fad_res1
may be one of the following: byte size of range in file;
memory locality to be used when allocating memory on cc-
numa systems; the duration after which a dirty page is to
be written to the file system.
size_t _fad_res2
APPLICATION USAGE
The following macros and aliases have been defined to align with the ISO POSIX-1 standard.
#ifdef _APP32_64BIT_OFF_T
#define posix_fadvise(FD, OFF, LEN, CMD) fadvise64(FD, OFF, LEN, CMD, NULL)
#else
#define posix_fadvise(FD, OFF, LEN, CMD) fadvise(FD, OFF, LEN, CMD, NULL)
#endif
#define POSIX_FADV_NORMAL FADV_NORMAL
#define POSIX_FADV_SEQUENTIAL FADV_SEQUENTIAL
#define POSIX_FADV_RANDOM FADV_RANDOM
#define POSIX_FADV_WILLNEED FADV_WILLNEED
#define POSIX_FADV_DONTNEED FADV_DONTNEED
#define POSIX_FADV_NOREUSE FADV_NOREUSE
The following aliases can be used with the FADV_CCNUMA hint.
#define FAD_POLICY _fad_res1 /* allocation policy */
The following aliases can be used with the FADV_LARGEPAGE_HINT
hint.
#define FAD_PGSIZE _fad_res2 /* preferred large page size */
The following aliases can be used with the FADV_SYNC_RDWR hint.
#define FAD_SYNC_TIME _fad_res2 /* pageout interval in secs. */
EXAMPLES
#include <sys/fcntl.h>
#include <sys/fadvise.h>
fad_extparms_t fad_extparms;
main(int argc, char *argv[])
{
int fd;
fd = open(argv[1], O_RDONLY);
/* To setup a CCNuma policy of MEM_FIRST_TOUCH */
bzero(&fad_extparms, sizeof(fad_extparms_t));
fad_extparms.fad_count = 1;
fad_extparms.fad_plist[0].fad_advice = FADV_CCNUMA;
fad_extparms.fad_plist[0].FAD_POLICY = FADV_VM_MEM_FIRST_TOUCH;
HP-UX 11i Version 3: September 2010 − 1 − Hewlett-Packard Company 1