1posix_fadvise(3C) Standard C Library Functions posix_fadvise(3C)
2
3
4
6 posix_fadvise - file advisory information
7
9 #include <fcntl.h>
10
11 int posix_fadvise(int fd, off_t offset, off_t len, int advice);
12
13
15 The posix_fadvise() function advises the system on the expected behav‐
16 ior of the application with respect to the data in the file associated
17 with the open file descriptor, fd, starting at offset and continuing
18 for len bytes. The specified range need not currently exist in the
19 file. If len is zero, all data following offset is specified. The sys‐
20 tem may use this information to optimize handling of the specified
21 data. The posix_fadvise() function has no effect on the semantics of
22 other operations on the specified data, although it may affect the per‐
23 formance of other operations.
24
25
26 The advice to be applied to the data is specified by the advice parame‐
27 ter and may be one of the following values:
28
29 POSIX_FADV_NORMAL Specifies that the application has no advice
30 to give on its behavior with respect to the
31 specified data. It is the default characteris‐
32 tic if no advice is given for an open file.
33
34
35 POSIX_FADV_SEQUENTIAL Specifies that the application expects to
36 access the specified data sequentially from
37 lower offsets to higher offsets.
38
39
40 POSIX_FADV_RANDOM Specifies that the application expects to
41 access the specified data in a random order.
42
43
44 POSIX_FADV_WILLNEED Specifies that the application expects to
45 access the specified data in the near future.
46
47
48 POSIX_FADV_DONTNEED Specifies that the application expects that it
49 will not access the specified data in the near
50 future.
51
52
53 POSIX_FADV_NOREUSE Specifies that the application expects to
54 access the specified data once and then not
55 reuse it thereafter.
56
57
58
59 These values are defined in <fcntl.h>
60
62 Upon successful completion, posix_fadvise() returns zero. Otherwise, an
63 error number is returned to indicate the error.
64
66 The posix_fadvise() function will fail if:
67
68 EBADF The fd argument is not a valid file descriptor.
69
70
71 EINVAL The value of advice is invalid, or the value of len is less
72 than zero.
73
74
75 ESPIPE The fd argument is associated with a pipe or FIFO.
76
77
79 The posix_fadvise() function has a transitional interface for 64-bit
80 file offsets. See lf64(5).
81
83 See attributes(5) for descriptions of the following attributes:
84
85
86
87
88 ┌─────────────────────────────┬─────────────────────────────┐
89 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
90 ├─────────────────────────────┼─────────────────────────────┤
91 │Interface Stability │Committed │
92 ├─────────────────────────────┼─────────────────────────────┤
93 │MT-Level │MT-Safe │
94 ├─────────────────────────────┼─────────────────────────────┤
95 │Standard │See standards(5). │
96 └─────────────────────────────┴─────────────────────────────┘
97
99 posix_madvise(3C), attributes(5), standards(5)
100
101
102
103SunOS 5.11 14 Jul 2008 posix_fadvise(3C)