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