POSIX_FADVISE(3P)
โจ PROLOG โจ
Okay bestie, quick heads-up before we dive in: this manual page is part of the POSIX Programmer's Manual. The Linux implementation of this interface may differ (so like, go check the corresponding Linux manual page for the deets on Linux behavior), or honestly the interface may not even be implemented on Linux. Vibe check accordingly. ๐
๐ฆ NAME ๐ฆ
posix_fadvise โ file advisory information (ADVANCED REALTIME) ๐
๐ธ SYNOPSIS ๐ธ
#include <fcntl.h>
int posix_fadvise(int fd, off_t offset, off_t len, int advice);
๐ DESCRIPTION ๐
So the posix_fadvise() function is literally just you sliding a lil note to the implementation, being like "hey girl, here's what I'm expecting to do with this data." Specifically, it advises on the expected behavior of the application with respect to the data in the file associated with the open file descriptor fd, starting at offset and continuing for len bytes. โจ
Notably: the specified range doesn't even need to currently exist in the file. Iconic, no notes. And if len is zero, that means all data following offset is specified. ๐
The implementation may use this information to optimize handling of the specified data. And lowkey the best part โ posix_fadvise() shall have no effect on the semantics of other operations on the specified data, though it may affect the performance of other operations. So it's all vibes, zero side effects. ๐ฆ
The advice you're applying to the data is specified by the advice parameter, and it may be one of the following values:
POSIX_FADV_NORMALโ says the application has no advice to give on its behavior with respect to the specified data. This is the default characteristic if no advice is given for an open file. (The "no thoughts, head empty" option ๐ซถ)POSIX_FADV_SEQUENTIALโ says the application expects to access the specified data sequentially, from lower offsets to higher offsets. One direction, forward, main character energy. โญPOSIX_FADV_RANDOMโ says the application expects to access the specified data in a random order. Chaos. We love her. ๐POSIX_FADV_WILLNEEDโ says the application expects to access the specified data in the near future. Manifesting it early, fr fr. ๐ฎPOSIX_FADV_DONTNEEDโ says the application expects that it will not access the specified data in the near future. Not me ghosting this data ๐POSIX_FADV_NOREUSEโ says the application expects to access the specified data once and then not reuse it thereafter. One and done, periodt. ๐
These values are defined in <fcntl.h>.
๐ RETURN VALUE ๐
Upon successful completion, posix_fadvise() shall return zero. ๐ Otherwise, an error number shall be returned to indicate the error.
๐ฅ ERRORS ๐ฅ
The posix_fadvise() function shall fail if:
EBADFโ Thefdargument is not a valid file descriptor.EINVALโ The value ofadviceis invalid, or the value oflenis less than zero.ESPIPEโ Thefdargument is associated with a pipe or FIFO.
The following sections are informative.
๐ง EXAMPLES ๐ง
None. (Yeah, bestie, we got nothing. The void. The emptiness. ๐)
๐ APPLICATION USAGE ๐
The posix_fadvise() function is part of the Advisory Information option and need not be provided on all implementations. So like, don't be shocked if your platform's like "never heard of her." ๐ญ
๐ RATIONALE ๐
None. (Same energy as above. Empty. Void-coded. ๐)
๐ FUTURE DIRECTIONS ๐
None. (The future is a mystery and this page is not about to spoil it. โจ)
๐ SEE ALSO ๐
posix_madvise()- The Base Definitions volume of POSIX.1โ2017,
<fcntl.h>
๐ COPYRIGHT ๐
Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1-2017, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html .
Any typographical or formatting errors that appear in this page are most likely to have been introduced during the conversion of the source files to man page format. To report such errors, see https://www.kernel.org/doc/man-pages/reporting_bugs.html .
And that's the whole page, bestie! ๐ This one came to you courtesy of the POSIX Programmer's Manual โ IEEE/The Open Group, 2017 โ POSIX_FADVISE(3P). Slay, go advise some files, and remember: the range doesn't have to exist for you to manifest it. โจ๐ฆ
๐ฆ where this page comes from
- alpine 3.22: man-pages-posix 2017a-r0 ยท custom
- alpine 3.23: man-pages-posix 2017a-r0 ยท custom
- alpine 3.24: man-pages-posix 2017a-r0 ยท custom
- arch rolling: man-pages 6.19-1
- arch rolling: man-pages 6.20-1 ยท BSD-2-Clause AND BSD-3-Clause AND BSD-4.3TAHOE AND BSD-4-Clause-UC AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-3.0-linking-exception AND LGPL-3.0-or-later AND LicenseRef-Public-Domain AND LicenseRef-UltraPermissive AND Linux-man-pages-1-para AND Linux-man-pages-copyleft AND Linux-man-pages-copyleft-2-para AND Linux-man-pages-copyleft-var AND MIT AND Spencer-94
- nixpkgs unstable: man-pages-posix 2017a
- opensuse-leap 16.0: man-pages-posix 2017a-160000.4.1 ยท SUSE-IEEE
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms