VOP_INOTIFY(9)

πŸ“¦ version 15.1, in freebsd 14.5, freebsd 15.1, nixpkgs unstable

πŸ’… VOP_INOTIFY(9) β€” kernel dev manual, but make it cute

okay bestie, welcome to VOP_INOTIFY(9) from the Kernel Developer's Manual ✨ this is your vnode inotify interface, and yes it's as niche as it sounds, but we're gonna get through it together 🫢


🌸 NAME 🌸

VOP_INOTIFY β€” vnode inotify interface. literally the whole vibe of this page, no cap πŸ’–


✨ SYNOPSIS ✨

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

int
VOP_INOTIFY(struct, vnode, *vp, struct, vnode, *dvp, struct,
    componentname, *cnp, int, event, uint32_t, cookie);

int
VOP_INOTIFY_ADD_WATCH(struct, vnode, *vp, struct, inotify_softc, *sc,
    uint32_t, mask, uint32_t, *wdp, struct, thread, *td);

like, copy these exactly, bestie, don't get creative with the parameter lists πŸ™ˆ


πŸ¦‹ DESCRIPTION πŸ¦‹

so the VOP_INOTIFY() operation is the one that goes and tells the inotify(2) subsystem that a file system event just happened on a vnode πŸ‘€ it's giving "hey girl, something went down over here."

the dvp and cnp arguments are optional β€” they're only there so the operation can grab a file name for the event πŸŽ€ if you leave them out, the inotify subsystem will fall back to the file name cache to find a name for the vnode, but heads up, that path is more expensive πŸ’Έ so if you can pass them, pass them, iykyk.

then there's VOP_INOTIFY_ADD_WATCH(), which is for internal use by the inotify subsystem to add a watch to a vnode 🧚 it's not really your main character, it's the sidekick doing the quiet work. respectfully.


πŸ‘‘ LOCKS πŸ‘‘

lock rules, everyone's favorite part πŸ’€ so:

  • VOP_INOTIFY() does not assume any particular vnode lock state. free spirit. no lock dress code ✨
  • VOP_INOTIFY_ADD_WATCH() should be called with the vnode locked πŸ”’ periodt.
bestie do NOT forget the lock on that second one, it is literally the one rule they wrote down for it 😭

🌈 RETURN VALUES 🌈

zero 0 is returned on success πŸŽ‰ (slay). otherwise, an error code is returned, and you get to go figure out what went wrong bestie, good luck 😭


πŸ’œ SEE ALSO πŸ’œ

go read those too, they're the lore πŸ’…


and that's the whole page, bestie 🌟 from the Kernel Developer's Manual, this one's from Debian, dated May 27, 2025 β€” so it's fresh-ish, and yes the footer says it's from the VOP_INOTIFY(9) page itself. now go add some watches, but lock that vnode first, mwah πŸ’–πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from