VGET(9)

πŸ’– VGET πŸ’–

okay bestie, buckle up, we're talking about vget β€” the kernel dev manual's little icon for pulling a vnode off the free list. yes, that vget. the one in section 9. slay.


✨ NAME ✨

vget β€” get a vnode from the free list πŸ¦‹


🌸 SYNOPSIS 🌸

#include <sys/param.h>
#include <sys/vnode.h>

int
vget(struct vnode *vp, int lockflag, struct thread *td);

πŸ’… DESCRIPTION πŸ’…

so what it does is: it grabs a vnode off the free list and bumps its reference count up. that's it, that's the whole vibe. lowkey iconic.

  • vp β€” the vnode we're removing from the free list. that's your girl right there.
  • lockflag β€” if this is non-zero, the vnode gets locked too. like, locked locked. πŸ”’

when nobody's using them, vnodes just chill on a free list. and here's the tea: those vnodes still reference valid files, but they can be reused to point at a whole new file at literally any time. no warning, no heads up. so also, these vnodes are often held in caches around the system, like the name cache. iykyk.


when a vnode that's sitting on the free list gets used again β€” for example, if the vnode was found in the name cache as a result of a call to VOP_LOOKUP(9) β€” then the new user must call vget() to increment the reference count and remove it from the free list. not optional, bestie. it's giving mandatory. 🫢


πŸ‘‘ SEE ALSO πŸ‘‘


🌈 AUTHORS 🌈

this manual page was written by Doug Rabson. thank you king πŸ’œ


and that's the whole page, periodt. this gem came to you from the Debian edition, dated July 24, 1996 β€” yes it's older than us, and yes it still ate. mwah πŸ’‹βœ¨

πŸ“¦ where this page comes from