VOP_LINK(9)
β¨ VOP_LINK β bestie, we're making a whole new name for a file β¨
okay so this is a page from the Kernel Developer's Manual (section 9, the kernel-functions girly) and it's literally all about VOP_LINK. slay. let's get into it π
πΈ SYNOPSIS πΈ
#include <sys/param.h>
#include <sys/vnode.h>
int
VOP_LINK(struct vnode *dvp, struct vnode *vp,
struct componentname *cnp);
π¦ DESCRIPTION π¦
The way that this one works is: it links a new name in the specified directory to an existing file. that's the whole vibe. one file, two names, no cap π«Ά
Its arguments are:
dvpβ the vnode of the directory. the place where the new name is gonna live β¨vpβ the vnode of the file to be linked. the file getting a glow-up with a second name πcnpβ pathname information about the file.
okay important note bestie, do NOT release the pathname info on exit, because the caller is the one who handles that. and the directory and file vnodes? also not released on exit. don't do it. not your job. leave them alone π
π LOCKS π
VOP_LINK() expects the directory and file vnodes to be locked on entry, and it will leave the vnodes locked on return. so you lock 'em, it keeps 'em locked, everyone stays locked. consistency is iconic π
π RETURN VALUES π
Zero is returned if the file was linked successfully. anything else means an error came through, and that's not the energy we wanted π
π ERRORS π
[EMLINK]β the file has too many links. it's overstimulated, it needs a break.[EPERM]β the file is immutable. it said no changes, and it meant it.[EXDEV]β a hard link is not possible between different file systems. different worlds, bestie, it's just not gonna work π
π SEE ALSO π
iykyk β go read those next, they're the supporting cast π§
π AUTHORS π
This manual page was originally written by Doug Rabson. legend behaviour, fr fr.
and that's the whole page bestie. no notes, just links. periodt π
okay and before you go β this one came from Debian and it's dated July 24, 1996, which is literally so vintage of it, an absolute classic from the archives πβ¨
π¦ where this page comes from
- debian bookworm: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- debian trixie: freebsd-manpages 12.2-2 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu jammy: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu noble: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu questing: freebsd-manpages 12.2-2
- ubuntu resolute: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu stonking: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- Copyright (c) 1996 Doug Rabson
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms