1POSIX_FADVISE(P) POSIX Programmer's Manual POSIX_FADVISE(P)
2
3
4
6 posix_fadvise - file advisory information (ADVANCED REALTIME)
7
9 #include <fcntl.h>
10
11 int posix_fadvise(int fd, off_t offset, size_t len, int advice);
12
13
15 The posix_fadvise() function shall advise the implementation on the
16 expected behavior of the application with respect to the data in the
17 file associated with the open file descriptor, fd, starting at offset
18 and continuing for len bytes. The specified range need not currently
19 exist in the file. If len is zero, all data following offset is speci‐
20 fied. The implementation may use this information to optimize handling
21 of the specified data. The posix_fadvise() function shall have no
22 effect on the semantics of other operations on the specified data,
23 although it may affect the performance of other operations.
24
25 The advice to be applied to the data is specified by the advice parame‐
26 ter and may be one of the following values:
27
28 POSIX_FADV_NORMAL
29
30 Specifies that the application has no advice to give on its
31 behavior with respect to the specified data. It is the default
32 characteristic if no advice is given for an open file.
33
34 POSIX_FADV_SEQUENTIAL
35
36 Specifies that the application expects to access the specified
37 data sequentially from lower offsets to higher offsets.
38
39 POSIX_FADV_RANDOM
40
41 Specifies that the application expects to access the specified
42 data in a random order.
43
44 POSIX_FADV_WILLNEED
45
46 Specifies that the application expects to access the specified
47 data in the near future.
48
49 POSIX_FADV_DONTNEED
50
51 Specifies that the application expects that it will not access
52 the specified data in the near future.
53
54 POSIX_FADV_NOREUSE
55
56 Specifies that the application expects to access the specified
57 data once and then not reuse it thereafter.
58
59
60 These values are defined in <fcntl.h>.
61
63 Upon successful completion, posix_fadvise() shall return zero; other‐
64 wise, an error number shall be returned to indicate the error.
65
67 The posix_fadvise() function shall fail if:
68
69 EBADF The fd argument is not a valid file descriptor.
70
71 EINVAL The value of advice is invalid.
72
73 ESPIPE The fd argument is associated with a pipe or FIFO.
74
75
76 The following sections are informative.
77
79 None.
80
82 The posix_fadvise() function is part of the Advisory Information option
83 and need not be provided on all implementations.
84
86 None.
87
89 None.
90
92 posix_madvise() , the Base Definitions volume of IEEE Std 1003.1-2001,
93 <fcntl.h>
94
96 Portions of this text are reprinted and reproduced in electronic form
97 from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
98 -- Portable Operating System Interface (POSIX), The Open Group Base
99 Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
100 Electrical and Electronics Engineers, Inc and The Open Group. In the
101 event of any discrepancy between this version and the original IEEE and
102 The Open Group Standard, the original IEEE and The Open Group Standard
103 is the referee document. The original Standard can be obtained online
104 at http://www.opengroup.org/unix/online.html .
105
106
107
108IEEE/The Open Group 2003 POSIX_FADVISE(P)