DragonFly On-Line Manual Pages

Search: Section:  


VN_LOCK(9)            DragonFly Kernel Developer's Manual           VN_LOCK(9)

NAME

vn_lock, vn_unlock, vn_islocked -- serialize access to a vnode

SYNOPSIS

#include <sys/vnode.h> int vn_lock(struct vnode *vp, int flags); void vn_unlock(struct vnode *vp); int vn_islocked(struct vnode *vp);

DESCRIPTION

These calls are used to serialize access to the filesystem, 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: LK_RETRY Automatically retry on timeout LK_FAILRECLAIM Fail if the vnode is being reclaimed The vn_lock() function will require either LK_EXCLUSIVE or LK_SHARED to be or'ed with the request flags described above in order to specify the type of lock to be used. The vn_unlock() function uses LK_RELEASE internally to release a previously held lock. Please note all these functions rely on lockmgr(9) to perform their operations.

RETURN VALUES

The vn_lock() function returns zero on success and non-zero on failure. The vn_islocked() function has identical return values as lockstatus(9).

SEE ALSO

lockmgr(9), vnode(9)

AUTHORS

This man page was written by Doug Rabson. DragonFly 4.1 November 17, 2014 DragonFly 4.1

Search: Section: