| VNFILEOPS(9) | Kernel Developer's Manual | VNFILEOPS(9) |
vnfileops,
vn_closefile, vn_fcntl,
vn_ioctl, vn_read,
vn_poll, vn_statfile,
vn_write — vnode file
descriptor operations
#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);
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.
vn_closefile(fp,
l)vn_closefile() simply calls
vn_close(9) with the
appropriate arguments.vn_fcntl(fp,
com, data,
l)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.vn_ioctl(fp,
com, data,
l)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.vn_read(fp,
offset, uio,
cred, flags)vn_poll(fp,
events, l)vn_poll() simply calls
VOP_POLL(9) with the
events events and the calling lwp
l. The function returns a bitmask of available
events.vn_statfile(fp,
sb, l)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.vn_write(fp,
offset, uio,
cred, flags)The high-level convenience functions are implemented within the file sys/kern/vfs_vnops.c.
| February 16, 2023 | NetBSD 11.0 |