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:
The
fad_parms
structure contains the following members:
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;
fadvise(fd, 0, 0, 0, &fad_extparms);
}
WARNINGS
For 32-bit applications,
_fad_res1
will be truncated to its least significant 32-bits for
file systems that use 64-bit values.
STANDARDS CONFORMANCE
<sys/fcntl.h>: POSIX.1