VGET(9)
π VGET(9) β the Kernel Developer's Manual page you didn't know you needed
okay so bestie, real talk: this is vget from section 9 (that's the kernel-functions section, iykyk). It's short, it's sweet, and it's genuinely important if you're doing vnode shit. Let's get into it. π¦
β¨ NAME β¨
vget β get a vnode from the free list. that's it. that's the whole vibe. π
πΈ SYNOPSIS πΈ
#include <sys/param.h>
#include <sys/vnode.h>
int
vget(struct vnode *vp, int lockflag, struct thread *td);
literally just include those two headers and you're off to the races, bestie. π«Ά
π DESCRIPTION π
So the actual main character move here: get a vnode from the free list and increment its reference count. That's the whole job. Two-for-one. Ate. π₯
Here's what the arguments are giving:
vpβ the vnode you're pulling off the free list. this is the one, bestie.lockflagβ if this is non-zero, the vnode will also be locked. not zero = locked. that's the rule. π
Now the lore π β when vnodes aren't in use, they get parked on a free list. The important detail: those vnodes still reference valid files, but they may be reused to refer to a new file at any time. so like... they're valid but also not yours yet. respect the ambiguity. π
And usually these free-list vnodes are also chilling in caches around the system β the name cache being the classic example.
So here's the scenario: you've got a vnode that's on the free list, and you want to use it again. Like β say the vnode turned up in the name cache because of a call to VOP_LOOKUP(9). In that case the new user (that's you π) must call vget() to increment the reference count and remove it from the free list. Non-negotiable. Do it. periodt. π
π¦ SEE ALSO π¦
the whole vnode friend group, honestly. go read them. π§
π AUTHORS π
This manual page was written by Doug Rabson. iconic of him, honestly. π
π cute little sign-off: this page ships from Debian, dated July 24, 1996, and it lives at VGET(9) in the Kernel Developer's Manual. yes, 1996. vintage. slay. πβ¨
π¦ where this page comes from
- freebsd 14.5: base 14.5
- freebsd 15.1: base 15.1
- nixpkgs unstable: source
- Copyright (c) 1996 Doug Rabson
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms