#include <sys/lockf.h>

sys/lockf.h

2 structs

structlocklist

The lockf structure is a kernel structure which contains the information associated with a byte range lock. The lockf structures are linked into the vnode structure. Locks are sorted by the starting byte of the lock for efficiency after they have been committed; uncommitted locks are on the list head so they may quickly be accessed, and are both short lived and transient.
size 16, align 8
struct lockf *tqh_firstfirst element
struct lockf **tqh_lastaddr of last next element

structlockf

size 96, align 8
shortlf_flagsSemantics: F_POSIX, F_FLOCK, F_WAIT
shortlf_typeLock type: F_RDLCK, F_WRLCK
off_tlf_startByte # of the start of the lock
off_tlf_endByte # of the end of the lock (-1=EOF)
caddr_tlf_idId of the resource holding the lock
struct lockf **lf_headBack pointer to the head of the lockf list
struct vnode *lf_vnodeBack pointer to the inode
struct lockf *lf_nextPointer to the next lock on this inode
struct locklistlf_blkhdList of requests blocked on this lock
unnamed struct at sys/lockf.h:100:2lf_block
struct lockf *tqe_nextA request waiting for a lock
struct lockf **tqe_prev
struct proc *lf_ownerThe proc that did the SETLK, if known