VOP_LINK(9)
πΈ VOP_LINK π
okay so bestie, welcome to the VOP_LINK era β this is a kernel developer's manual page from the 9 section, and it's literally all about giving a file a whole new name, no cap π
β¨ SYNOPSIS β¨
#include <sys/param.h>
#include <sys/vnode.h>
int
VOP_LINK(struct vnode *dvp, struct vnode *vp,
struct componentname *cnp);
π DESCRIPTION π
so what this does is it links a brand-new name inside the directory you specify to a file that already exists. it's giving "same file, new identity" energy fr fr π
its arguments are:
dvpβ the vnode of the directory (the folder it's all happening in)vpβ the vnode of the file that's getting linkedcnpβ pathname info about the file
bestie listen β the pathname info should not be released on exit, because the caller is the one doing that. and the directory and file vnodes should not be released on exit either. don't do it. not your job π
π LOCKS π
VOP_LINK() expects the directory and file vnodes to be locked on entry, and it will leave them locked on return. so you hand them over locked, you get them back locked β that's the deal, periodt π
π«Ά RETURN VALUES π«Ά
zero gets returned if the file was linked successfully (slay β¨), otherwise an error comes back at you π
π ERRORS π
[EMLINK]β the file has too many links (it's maxed out ngl)[EPERM]β the file is immutable (can't touch this π«)[EXDEV]β a hard link is not possible between different file systems (they're in different vibes entirely, no bridge)
π SEE ALSO π
π§ AUTHORS π§
this manual page was originally written by Doug Rabson β iconic behavior honestly π
okurrr that's the whole page bestie, you ate that π
and for the record this was the VOP_LINK kernel developer's manual page, debian flavored, dated July 24, 1996 β vintage but still serving looks π
π¦ 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