1POSIX_FADVISE(3P) POSIX Programmer's Manual POSIX_FADVISE(3P)
2
3
4
6 This manual page is part of the POSIX Programmer's Manual. The Linux
7 implementation of this interface may differ (consult the corresponding
8 Linux manual page for details of Linux behavior), or the interface may
9 not be implemented on Linux.
10
11
13 posix_fadvise — file advisory information (ADVANCED REALTIME)
14
16 #include <fcntl.h>
17
18 int posix_fadvise(int fd, off_t offset, off_t len, int advice);
19
21 The posix_fadvise() function shall advise the implementation on the
22 expected behavior of the application with respect to the data in the
23 file associated with the open file descriptor, fd, starting at offset
24 and continuing for len bytes. The specified range need not currently
25 exist in the file. If len is zero, all data following offset is speci‐
26 fied. The implementation may use this information to optimize handling
27 of the specified data. The posix_fadvise() function shall have no
28 effect on the semantics of other operations on the specified data,
29 although it may affect the performance of other operations.
30
31 The advice to be applied to the data is specified by the advice parame‐
32 ter and may be one of the following values:
33
34 POSIX_FADV_NORMAL
35 Specifies that the application has no advice to give on its
36 behavior with respect to the specified data. It is the default
37 characteristic if no advice is given for an open file.
38
39 POSIX_FADV_SEQUENTIAL
40 Specifies that the application expects to access the specified
41 data sequentially from lower offsets to higher offsets.
42
43 POSIX_FADV_RANDOM
44 Specifies that the application expects to access the specified
45 data in a random order.
46
47 POSIX_FADV_WILLNEED
48 Specifies that the application expects to access the specified
49 data in the near future.
50
51 POSIX_FADV_DONTNEED
52 Specifies that the application expects that it will not access
53 the specified data in the near future.
54
55 POSIX_FADV_NOREUSE
56 Specifies that the application expects to access the specified
57 data once and then not reuse it thereafter.
58
59 These values are defined in <fcntl.h>.
60
62 Upon successful completion, posix_fadvise() shall return zero; other‐
63 wise, an error number shall be returned to indicate the error.
64
66 The posix_fadvise() function shall fail if:
67
68 EBADF The fd argument is not a valid file descriptor.
69
70 EINVAL The value of advice is invalid, or the value of len is less than
71 zero.
72
73 ESPIPE The fd argument is associated with a pipe or FIFO.
74
75 The following sections are informative.
76
78 None.
79
81 The posix_fadvise() function is part of the Advisory Information option
82 and need not be provided on all implementations.
83
85 None.
86
88 None.
89
91 posix_madvise()
92
93 The Base Definitions volume of POSIX.1‐2008, <fcntl.h>
94
96 Portions of this text are reprinted and reproduced in electronic form
97 from IEEE Std 1003.1, 2013 Edition, Standard for Information Technology
98 -- Portable Operating System Interface (POSIX), The Open Group Base
99 Specifications Issue 7, Copyright (C) 2013 by the Institute of Electri‐
100 cal and Electronics Engineers, Inc and The Open Group. (This is
101 POSIX.1-2008 with the 2013 Technical Corrigendum 1 applied.) In the
102 event of any discrepancy between this version and the original IEEE and
103 The Open Group Standard, the original IEEE and The Open Group Standard
104 is the referee document. The original Standard can be obtained online
105 at http://www.unix.org/online.html .
106
107 Any typographical or formatting errors that appear in this page are
108 most likely to have been introduced during the conversion of the source
109 files to man page format. To report such errors, see https://www.ker‐
110 nel.org/doc/man-pages/reporting_bugs.html .
111
112
113
114IEEE/The Open Group 2013 POSIX_FADVISE(3P)