FreeBSD/sys/kern/kern_lockf.c
/*
 * Check whether there is a blocking lock, and if so return its
 * details in '*fl'.
 */
Check whether there is a blocking lock, and if so return its
details in '*fl'.
Check whether there is a blocking lock and if so return its details in ' * fl ' .
static int
lf_getlock(struct lockf *state, struct lockf_entry *lock, struct flock *fl)
{
	struct lockf_entry *block;
#ifdef LOCKF_DEBUG
	if (lockf_debug & 1)
		lf_print("lf_getlock", lock);
#endif 
	if ((block = lf_getblock(state, lock))) {
		fl->l_type = block->lf_type;
		fl->l_whence = SEEK_SET;
		fl->l_start = block->lf_start;
		if (block->lf_end == OFF_MAX)
			fl->l_len = 0;
		else
			fl->l_len = block->lf_end - block->lf_start + 1;
		fl->l_pid = block->lf_owner->lo_pid;
		fl->l_sysid = block->lf_owner->lo_sysid;
	} else {
		fl->l_type = F_UNLCK;
	}
	return (0);
}
static int lf_getlock ( struct lockf * state , struct lockf_entry * lock , struct flock * fl ) { struct lockf_entry * block ; #ifdef LOCKF_DEBUG if ( lockf_debug & 1 ) lf_print ( " " , lock ) ; #endif if ( ( block = lf_getblock ( state , lock ) ) ) { fl -> l_type = block -> lf_type ; fl -> l_whence = SEEK_SET ; fl -> l_start = block -> lf_start ; if ( block -> lf_end == OFF_MAX ) fl -> l_len = 0 ; else fl -> l_len = block -> lf_end - block -> lf_start + 1 ; fl -> l_pid = block -> lf_owner -> lo_pid ; fl -> l_sysid = block -> lf_owner -> lo_sysid ; } else { fl -> l_type = F_UNLCK ; } return ( 0 ) ; }
Check whether there is a blocking lock, and if so return its
 details in '*fl'.
Check whether there is a blocking lock and if so return its details in ' * fl ' .
/* LOCKF_DEBUG */