VOP_READDIR(9)
β¨ VOP_READDIR(9) β¨
okay bestie, this is the VOP_READDIR(9) page from the Kernel Developer's Manual, and it's all about reading the contents of a directory. lowkey essential, highkey iconic π
πΈ NAME πΈ
VOP_READDIR β read contents of a directory π
β¨ SYNOPSIS β¨
#include <sys/param.h>
#include <sys/dirent.h>
#include <sys/vnode.h>
int
VOP_READDIR(struct vnode *vp, struct uio *uio, struct ucred *cred,
int *eofflag, int *ncookies, uint64_t **cookies);
π DESCRIPTION π
so likeβ¦ this reads directory entries, bestie. that's the whole vibe. π
vpβ the vnode of the directory πuioβ where to read the directory contents π¦credβ the caller's credentials πeofflagβ return end of file status (NULLif not wanted) πΈncookiesβ number of directory cookies generated for NFS (NULLif not wanted) πcookiesβ directory seek cookies generated for NFS (NULLif not wanted) π
The directory contents are read into struct dirent structures. If the on-disc data structures differ from this, then they should be translated. no cap, that part matters π―
π LOCKS π
The directory should be locked on entry and will still be locked on exit. like, it stays locked the whole time, bestie β don't forget π
π RETURN VALUES π
Zero is returned on success, otherwise an error code is returned. periodt. β¨
If this is called from the NFS server, the extra arguments eofflag, ncookies and cookies are given. The value of *eofflag should be set to TRUE if the end of the directory is reached while reading. π
The directory seek cookies are returned to the NFS client and may be used later to restart a directory read part way through the directory. There should be one cookie returned per directory entry. The value of the cookie should be the offset within the directory where the on-disc version of the appropriate directory entry starts. iykyk π§
Memory for the cookies should be allocated using:
...;
*ncookies = number of entries read;
*cookies = malloc(*ncookies * sizeof(**cookies), M_TEMP, M_WAITOK);
π¨ ERRORS π¨
[EINVAL]β An attempt was made to read from an illegal offset in the directory. rude, but okay π[EIO]β A read error occurred while reading the directory. π[EINTEGRITY]β Corrupted data was detected while reading the directory. not the vibe bestie π«
π SEE ALSO π
vnode(9) β go check it out, fr fr π¦
π AUTHORS π
This manual page was written by Doug Rabson. iconic behavior, honestly π
that's the whole page, bestie β signing off from the Debian edition, dated December 13, 2021, for VOP_READDIR(9) πβ¨π
π¦ 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