VOP_CREATE(9)
π VOP_CREATE β the Kernel Developer's Manual, bestie edition (section 9) π
okay so. welcome to the group chat where we make files. this is VOP_CREATE(9), and honestly? it's giving main character energy in the VFS world. let's go β¨
πΈ NAME πΈ
VOP_CREATE, VOP_MKNOD, VOP_MKDIR, VOP_SYMLINK β bestie, these are the entry points that create a file, socket, fifo, device, directory or symlink. the whole "new thing appears in your filesystem" vibe, no cap. π¦
β¨ SYNOPSIS β¨
#include <sys/param.h>
#include <sys/vnode.h>
#include <sys/namei.h>
int
VOP_CREATE(struct vnode *dvp, struct vnode **vpp,
struct componentname *cnp, struct vattr *vap);
int
VOP_MKNOD(struct vnode *dvp, struct vnode **vpp,
struct componentname *cnp, struct vattr *vap);
int
VOP_MKDIR(struct vnode *dvp, struct vnode **vpp,
struct componentname *cnp, struct vattr *vap);
int
VOP_SYMLINK(struct vnode *dvp, struct vnode **vpp,
struct componentname *cnp, struct vattr *vap, char *target);
π DESCRIPTION π
so these entry points create a brand new file, socket, fifo, device, directory or symlink inside a given directory. literally birthing an inode. iconic. π
the arguments, one by one, because we don't skip:
dvpβ the locked vnode of the directory. locked. do not forget. πvppβ the address of a variable where the resulting locked vnode should be stored. that's where your new baby goes. πΌcnpβ the pathname component being created.vapβ the attributes that the new object should be created with. its whole personality, basically. πtargetβ the pathname of the target of the symlink. (symlink-only behaviour, iykyk π)
and fr fr: these entry points get called after VOP_LOOKUP(9) when an object is being created. like, lookup goes first, then the creation happens. order matters, bestie. π«Ά
π LOCKS π
the directory, dvp, will be locked on entry and must remain locked on return. not optional. do not unlock it, do not pass go, do not collect $200. π
and if the call is successful? the new object will be returned locked. so it arrives locked, and it stays locked, and it's yours to deal with. π
π RETURN VALUES π
if it slayed: the vnode for the new object is placed in *vpp and zero is returned. β
otherwise: an appropriate error is returned. π
π ERRORS π
[ENOSPC]β The file system is full. no room. the disk said no. π«[EDQUOT]β The user's file system space or inode quota would be exceeded. bestie you hit your limit. π§
π¦ SEE ALSO π¦
go read those, they're relevant, I promise. π
β HISTORY β
The function VOP_CREATE appeared in 4.3BSD. vintage. a classic. we stan a legacy API. π°οΈ
π AUTHORS π
This manual page was written by Doug Rabson. thank you Doug, king behavior. π
and that's the whole page bestie!! it's from the Debian manual, dated July 24, 1996 β yes, 1996, ancient, retro, lowkey iconic β and it's the VOP_CREATE(9) kernel developer's page. mwah. πβ¨π
π¦ 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