VNFILEOPS(9)
π VNFILEOPS(9) π
okay so bestie, welcome to the VNFILEOPS(9) page from the Kernel Developer's Manual. This is the vnode-file-descriptor-ops lore drop, and it's lowkey iconic. We're gonna keep it cute and keep every detail, fr fr. π«Ά
πΈ NAME πΈ
vnfileops, vn_closefile, vn_fcntl, vn_ioctl, vn_read, vn_poll, vn_statfile, vn_write β vnode file descriptor operations. β¨
β¨ SYNOPSIS β¨
your include stack and prototypes, bestie:
#include <sys/param.h>
#include <sys/file.h>
#include <sys/vnode.h>
int
vn_closefile(file_t *fp);
int
vn_fcntl(file_t *fp, u_int com, void *data);
int
vn_ioctl(file_t *fp, u_long com, void *data);
int
vn_read(file_t *fp, off_t *offset, struct uio *uio, kauth_cred_t cred,
int flags);
int
vn_poll(file_t *fp, int events);
int
vn_statfile(file_t *fp, struct stat *sb);
int
vn_write(file_t *fp, off_t *offset, struct uio *uio, kauth_cred_t cred,
int flags);
π¦ DESCRIPTION π¦
The functions described in this page are the vnode-specific file descriptor operations. They should only be accessed through the opaque function pointers in the file entries (see file(9)). They are described here only for completeness. That's the vibe: do not summon them directly, bestie. periodt. π
π FUNCTIONS π
vn_closefile(fp, l)
Common code for a file table vnode close operation. The file is described by fp and l is the calling lwp. vn_closefile() simply calls vn_close(9) with the appropriate arguments. Close it out, slay. π
vn_fcntl(fp, com, data, l)
Common code for a file table vnode fcntl(2) operation. The file is specified by fp. The argument l is the calling lwp. vn_fcntl() simply locks the vnode and invokes the vnode operation VOP_FCNTL(9) with the command com and buffer data. The vnode is unlocked on return. If the operation is successful zero is returned, otherwise an appropriate error is returned. Lock, call, unlock β main character energy. π₯
vn_ioctl(fp, com, data, l)
Common code for a file table vnode ioctl operation. The file is specified by fp. The argument l is the calling lwp. vn_ioctl() simply locks the vnode and invokes the vnode operation VOP_IOCTL(9) with the command com and buffer data. The vnode is unlocked on return. If the operation is successful zero is returned, otherwise an appropriate error is returned. Same lock-and-dispatch vibe, ioctl edition. π
vn_read(fp, offset, uio, cred, flags)
Common code for a file table vnode read. The argument fp is the file structure. The argument offset is the offset into the file. The argument uio is the uio structure describing the memory to read into. The caller's credentials are specified in cred. The flags argument can define FOF_UPDATE_OFFSET to update the read position in the file. If the operation is successful zero is returned, otherwise an appropriate error is returned. Read into memory, but make it vnode. π
vn_poll(fp, events, l)
Common code for a file table vnode poll operation. vn_poll() simply calls VOP_POLL(9) with the events events and the calling lwp l. The function returns a bitmask of available events. Bitmask bestie, we love to see it. π¦
vn_statfile(fp, sb, l)
Common code for a stat operation. The file descriptor is specified by the argument fp and sb is the buffer to return the stat information. The argument l is the calling lwp. vn_statfile() basically calls the vnode operation VOP_GETATTR(9) and transfer the contents of a vattr structure into a struct stat. If the operation is successful zero is returned, otherwise an appropriate error code is returned. Stat info, but through the vnode pipeline. β
vn_write(fp, offset, uio, cred, flags)
Common code for a file table vnode write. The argument fp is the file structure. The argument offset is the offset into the file. The argument uio is the uio structure describing the memory to read from. The caller's credentials are specified in cred. The flags argument can define FOF_UPDATE_OFFSET to update the read position in the file. If the operation is successful zero is returned, otherwise an appropriate error is returned. Yes, it says read position for write too β we are reporting the lore exactly. π«Ά
π₯ CODE REFERENCES π₯
The high-level convenience functions are implemented within the file sys/kern/vfs_vnops.c. That's the code home, no cap. π§
π SEE ALSO π
file(9), intro(9), vnode(9), vnodeops(9), vnsubr(9)
Debian, dated February 16, 2023 β VNFILEOPS(9) signing off. π
π
π¦ where this page comes from
- nixpkgs unstable: netbsd-source 11.0
- Copyright (c) 2001, 2005, 2006 The NetBSD Foundation, Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms