VOP_ADVISE(9)
π VOP_ADVISE β apply advice about use of file data
okay so bestie, welcome to VOP_ADVISE(9) from the Kernel Developer's Manual β yes the kernel one, this is real main-character vnode energy and we're gonna get through it together π«Ά
β¨ SYNOPSIS β¨
#include <sys/param.h>
#include <sys/vnode.h>
int
VOP_ADVISE(struct vnode *vp, off_t start, off_t end, int advice);
literally just one function, iconic, no notes π₯
πΈ DESCRIPTION πΈ
okay so this call applies advice for a range of a file's data β like you're dropping a little hint to the filesystem, no cap. fun fact: it's the thing that implements the posix_fadvise(2) system call. slay π
here's its arguments, one by one:
vpβ the vnode of the file. the whole main character of this function ngl πstartβ the start of the range of file data.endβ the end of the range of file data. and listen, a value ofOFF_MAXmeans the advice applies all the way to the end of the file. iykyk πadviceβ the type of operation to apply to the file data. possible values are:POSIX_FADV_WILLNEEDβ initiate an asynchronous read of the file data if it's not already resident. like, "bestie i'm gonna need this, get it ready" βPOSIX_FADV_DONTNEEDβ decrease the in-memory priority of clean file data, or just discard clean file data. yeah it said clean, read it again π§
also! if the start and end offsets are both zero, then the operation should be applied to the entire file π
π¨ okay this part matters: this call is advisory only. it may do the requested operation on a subset of the requested range β including not doing it at all β and still return success. so don't come for it, it warned you π it's giving "i'll try my best" energy.
π LOCKS π
the file should be unlocked on entry. unlock it before you call, bestie, fr fr π
β RETURN VALUES β
0 is returned if the call is successful π otherwise an appropriate error code comes back at you. that's the whole vibe check.
π ERRORS π
[EINVAL]β an invalid value was given foradvice. yeah. you gave it nonsense. it's not mad, it's just disappointed π
π SEE ALSO π
vnode(9)β go read it, it's the whole family π¦
and that's the page, bestie!! go forth and advise responsibly β¨
β written under the Debian banner, dated September 26, 2015, from the Kernel Developer's Manual β periodt π
π¦ where this page comes from
- freebsd 14.5: base 14.5
- freebsd 15.1: base 15.1
- nixpkgs unstable: source
- Copyright (c) 2013 Hudson River Trading LLC
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms