GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
VOP_OPEN(9) FreeBSD Kernel Developer's Manual VOP_OPEN(9)

VOP_OPEN, VOP_CLOSE
open or close a file

#include <sys/param.h>
#include <sys/vnode.h>

int
VOP_OPEN(struct vnode *vp, int mode, struct ucred *cred, struct thread *td, struct file *fp);

int
VOP_CLOSE(struct vnode *vp, int mode, struct ucred *cred, struct thread *td);

The VOP_OPEN() entry point is called before a file is accessed by a process and the VOP_CLOSE() entry point is called after a file is finished with by the process.

The arguments are:

vp
The vnode of the file.
mode
The access mode required by the calling process.
cred
The caller's credentials.
td
The thread which is accessing the file.
fp
The file being opened.

Pointer to the file fp is useful for file systems which require such information, e.g., fdescfs(5). Use ‘NULL’ as fp argument to VOP_OPEN() for in-kernel opens.

The access mode is a set of flags, including FREAD, FWRITE, O_NONBLOCK, O_APPEND.

VOP_OPEN() expects vp to be locked on entry and will leave it locked on return.

VOP_CLOSE() expects at least a reference to be associated with the vnode and does not care whether the vnode is locked or not. The lock and reference state is left unchanged on return. Note that vn_close expects an unlocked, referenced vnode and will dereference the vnode prior to returning.

Zero is returned on success, otherwise an error code is returned.

vnode(9), VOP_LOOKUP(9)

This manual page was written by Doug Rabson.
December 2, 2009 FreeBSD 13.1-RELEASE

Search for    or go to Top of page |  Section 9 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.