MCPcopy Create free account
hub / github.com/F-Stack/f-stack / lf_getlock

Function lf_getlock

freebsd/kern/kern_lockf.c:1574–1598  ·  view source on GitHub ↗

* Check whether there is a blocking lock, and if so return its * details in '*fl'. */

Source from the content-addressed store, hash-verified

1572 * details in '*fl'.
1573 */
1574static int
1575lf_getlock(struct lockf *state, struct lockf_entry *lock, struct flock *fl)
1576{
1577 struct lockf_entry *block;
1578
1579#ifdef LOCKF_DEBUG
1580 if (lockf_debug & 1)
1581 lf_print("lf_getlock", lock);
1582#endif /* LOCKF_DEBUG */
1583
1584 if ((block = lf_getblock(state, lock))) {
1585 fl->l_type = block->lf_type;
1586 fl->l_whence = SEEK_SET;
1587 fl->l_start = block->lf_start;
1588 if (block->lf_end == OFF_MAX)
1589 fl->l_len = 0;
1590 else
1591 fl->l_len = block->lf_end - block->lf_start + 1;
1592 fl->l_pid = block->lf_owner->lo_pid;
1593 fl->l_sysid = block->lf_owner->lo_sysid;
1594 } else {
1595 fl->l_type = F_UNLCK;
1596 }
1597 return (0);
1598}
1599
1600/*
1601 * Cancel an async lock request.

Callers 1

lf_advlockasyncFunction · 0.85

Calls 2

lf_printFunction · 0.85
lf_getblockFunction · 0.85

Tested by

no test coverage detected