VOP_CREATE(9)
π VOP_CREATE(9) β the kernel dev manual, bestie edition π
okay so the manual name is VOP_CREATE(9) and honestly? this whole page is about the four lil entry points that bring new things into existence. creation core. main character energy fr fr β¨
πΈ NAME πΈ
VOP_CREATE, VOP_MKNOD, VOP_MKDIR, VOP_SYMLINK β the squad that creates a file, socket, fifo, device, directory or symlink π
β¨ SYNOPSIS β¨
like, here's the exact vibe, no edits, copy-pasted straight from the source because we do NOT mess with code:
#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, const char *target);
note how VOP_SYMLINK gets an extra lil const char *target at the end β she's built different π (because symlinks need a place to point at, duh πββοΈ)
π¦ DESCRIPTION π¦
so these entry points create a brand-new file, socket, fifo, device, directory or symlink inside a given directory. that's it. that's the whole job. creating things. iconic behavior π
the arguments, one by one, because we're being thorough and also because you deserve to know:
dvpβ the locked vnode of the directory. she's locked and she's staying that way, iykyk πvppβ the address of a variable where the resulting locked vnode should be stored. think of it as the lil spot where the new baby vnode gets dropped off π«Άcnpβ the pathname component createdvapβ the attributes that the new object should be created withtargetβ the pathname of the target of the symlink π―
and like, timing matters here: these entry points get called after VOP_LOOKUP(9) when an object is being created. lookup first, then create. the order is the order, bestie π
π LOCKS π
okay this part is important, pay attention π€
the directory, dvp, will be locked on entry and must remain locked on return. no unlocking behind our backs, that's not the vibe.
and if the call is successful? the new object will be returned locked. so it comes into the world already locked. locked at birth. honestly relatable π
β RETURN VALUES β
if it works: the vnode for the new object is placed in *vpp and zero is returned. zero = success = slay π
otherwise? an appropriate error is returned. that's it, that's the deal π
π ERRORS π
[ENOSPC]β the file system is full. no room. she's at capacity. π[EDQUOT]β the user's file system space or inode quota would be exceeded. you've hit your limit bestie, the quota said no more π«
πΈ SEE ALSO πΈ
(the besties. the companions. read them too fr fr π«Ά)
π HISTORY π
the function VOP_CREATE appeared in 4.3BSD. old money. vintage. still serving π
π AUTHORS π
this manual page was written by Doug Rabson. thank you for your service king π«‘β¨
π and that's the whole page, no cap β every flag, every argument, every error, every name. go create something iconic. periodt. π
this gem was brought to you by the Debian crew, dated November 2, 2018 β yeah she's a little vintage but she still ate ππ§
π¦ 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