United States-English |
|
|
HP-UX Reference > Pposix_fadvise(2)HP-UX 11i Version 3: February 2007 |
|
NAMEposix_fadvise(), posix_fadvise64() — file advisory information SYNOPSIS#include <sys/fcntl.h>
int posix_fadvise( int fd, off_t offset, off_t len, int advice );
int posix_fadvise64( int fd, off_t offset, off_t len, int advice ); DESCRIPTIONThe posix_fadvise() function is used to advise the system about the expected behavior of the application with respect to the data in the file associated with the open file descriptor, fd, starting at offset and continuing for len bytes. The specified range need not currently exist in the file. If len is zero, all data following offset is specified. It should be noted that the effect of all hints is cumulative for a given file object. All hints will be removed on processing the last close of the file object. The posix_fadvise64() function may be used for large file access by a 32-bit application built with _FILE_OFFSET_BITS set to 64. The advice parameter is used to convey the hint to be applied to the data and may be one of the following values:
These values will be defined in <sys/fcntl.h>. ERRORSIf the posix_fadvise() service fails, errno is set to one of the following values:
EXAMPLESint fd, ret; /* * 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); ret = posix_fadvise (fd, 0, 0, 0, FADV_SEQUENTIAL); if (ret == -1) { printf ("fadvise() failure errno %d\n", errno); exit; } ret = posix_fadvise (fd, 0, 0, 0, FADV_NOREUSE); if (ret == -1) printf ("fadvise() failure errno %d\n", errno); exit; } |
Printable version | ||
|