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_LOCK(9) FreeBSD Kernel Developer's Manual VOP_LOCK(9)

VOP_LOCK, VOP_UNLOCK, VOP_ISLOCKED, vn_lock
serialize access to a vnode

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

int
VOP_LOCK(struct vnode *vp, int flags);

int
VOP_UNLOCK(struct vnode *vp, int flags);

int
VOP_ISLOCKED(struct vnode *vp);

int
vn_lock(struct vnode *vp, int flags);

These calls are used to serialize access to the file system, such as to prevent two writes to the same file from happening at the same time.

The arguments are:

vp
The vnode being locked or unlocked.
flags
One of the lock request types:

Shared lock.
Exclusive lock.
Shared-to-exclusive upgrade.
Exclusive-to-shared downgrade.
Release any type of lock.
Wait for all lock activity to end.

The lock type may be or'ed with these lock flags:

Do not sleep to wait for lock.
Sleep, then return failure.
Allow recursive exclusive lock.
Instruct witness(4) to ignore this instance.

The lock type may be or'ed with these control flags:

Specify when the caller already has a simple lock (VOP_LOCK() will unlock the simple lock after getting the lock).
Retry until locked.

Kernel code should use vn_lock() to lock a vnode rather than calling VOP_LOCK() directly. vn_lock() also does not want a thread specified as argument but it assumes curthread to be used.

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

vnode(9)

This manual page was written by Doug Rabson.
February 25, 2008 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.