VINVALBUF(9)
okay so bestie, welcome to VINVALBUF(9) from the Kernel Developer's Manual β the page that flushes and invalidates buffers like itβs cleaning out a group chat π β¨
πΈ NAME πΈ
vinvalbuf β flushes and invalidates all buffers associated with a vnode. literally all the buffers tied to that vnode, bestie. π«Ά
β¨ SYNOPSIS β¨
Include these first, no skipping:
#include <sys/param.h>
#include <sys/vnode.h>
int
vinvalbuf(struct vnode *vp, int flags, struct ucred *cred, int slpflag,
int slptimeo);
π DESCRIPTION π
The vinvalbuf() function invalidates all of the buffers associated with the given vnode. This includes buffers on the clean list and the dirty list. If the V_SAVE flag is specified, then the buffers on the dirty list are synced prior to being released. If there is a VM Object associated with the vnode, it is removed. ππ₯
Its arguments are:
vpβ a pointer to the vnode whose buffers will be invalidated.flagsβ the only supported flag isV_SAVE, and it indicates that dirty buffers should be synced with the disk.credβ the user credentials that are used toVOP_FSYNC(9)buffers ifV_SAVEis set.slpflagβ theslpflag that will be used in the priority of any sleeps in the function.slptimeoβ the timeout for any sleeps in the function.
π LOCKS π
The vnode is assumed to be locked prior to the call and remains locked upon return. yep, it stays locked, no cap. π
Giant must be held before the call and remains locked upon return. so yeah, get that lock sorted first, bestie. π§
π RETURN VALUES π
A 0 value is returned on success. thatβs the whole vibe: 0 means slay. β¨
π¦ PSEUDOCODE π¦
vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY);
error = vinvalbuf(devvp, V_SAVE, cred, 0, 0);
VOP_UNLOCK(devvp, 0);
if (error)
return (error);
π ERRORS π
[ENOSPC]β the file system is full. (WithV_SAVE)[EDQUOT]β disc quota exceeded. (WithV_SAVE)[EWOULDBLOCK]β sleep operation timed out. (Seeslptimeo)[ERESTART]β a signal needs to be delivered and the system call should be restarted. (WithPCATCHset inslpflag)[EINTR]β the system has been interrupted by a signal. (WithPCATCHset inslpflag)
π SEE ALSO π
go read tsleep(9) and VOP_FSYNC(9) too, iykyk ππ
π AUTHORS π
This manual page was written by Chad David <davidc@acns.ab.ca>. iconic. π
β π xoxo, Debian β October 20, 2008 π
π¦ where this page comes from
- freebsd 14.5: base 14.5
- freebsd 15.1: base 15.1
- nixpkgs unstable: source
- Copyright (C) 2001 Chad David <davidc@acns.ab.ca>. All rights reserved
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms