* Check whether there is a blocking lock, and if so return its * details in '*fl'. */
| 1572 | * details in '*fl'. |
| 1573 | */ |
| 1574 | static int |
| 1575 | lf_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. |
no test coverage detected