1 .\" Copyright (c) 1991, 1993
2 .\" The Regents of the University of California. All rights reserved.
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\" notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\" notice, this list of conditions and the following disclaimer in the
11 .\" documentation and/or other materials provided with the distribution.
12 .\" 3. Neither the name of the University nor the names of its contributors
13 .\" may be used to endorse or promote products derived from this software
14 .\" without specific prior written permission.
16 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
17 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
20 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 .Nd give advice about use of file data
39 .Fn posix_fadvise "int fd" "off_t offset" "off_t len" "int advice"
44 allows a process to describe to the system its data access behavior for an
47 The advice covers the data starting at offset
57 to the end of the file is covered.
59 The behavior is specified by the
61 parameter and may be one of:
62 .Bl -tag -width POSIX_FADV_SEQUENTIAL
63 .It Dv POSIX_FADV_NORMAL
64 Tells the system to revert to the default data access behavior.
65 .It Dv POSIX_FADV_RANDOM
66 Is a hint that file data will be accessed randomly,
67 and prefetching is likely not advantageous.
68 .It Dv POSIX_FADV_SEQUENTIAL
69 Tells the system that file data will be accessed sequentially.
70 This currently does nothing as the default behavior uses heuristics to
71 detect sequential behavior.
72 .It Dv POSIX_FADV_WILLNEED
73 Tells the system that the specified data will be accessed in the near future.
74 The system may initiate an asynchronous read of the data if it is not already
76 .It Dv POSIX_FADV_DONTNEED
77 Tells the system that the specified data will not be accessed in the near
79 The system may decrease the in-memory priority of clean data within the
80 specified range and future access to this data may require a read operation.
81 .It Dv POSIX_FADV_NOREUSE
82 Tells the system that the specified data will only be accessed once and
84 The system may decrease the in-memory priority of data once it has been
86 Future access to this data may require a read operation.
92 It returns an error on failure, without setting
95 Possible failure conditions:
100 argument is not a valid file descriptor.
104 argument is not valid.
110 arguments are negative,
115 is greater than the maximum file size.
119 argument does not refer to a regular file.
123 argument is associated with a pipe or FIFO.
125 An I/O error occurred while reading from or writing to a file system.
127 Corrupted data was detected while reading from the file system.
134 interface conforms to
139 system call first appeared in