FreeBSD/sys/kern/kern_lockf.c
/*
 * Generate a hash value for a lock owner.
 */
Generate a hash value for a lock owner.
Generate a hash value for a lock owner .
static int
lf_hash_owner(caddr_t id, struct flock *fl, int flags)
{
	uint32_t h;
	if (flags & F_REMOTE) {
		h = HASHSTEP(0, fl->l_pid);
		h = HASHSTEP(h, fl->l_sysid);
	} else if (flags & F_FLOCK) {
		h = ((uintptr_t) id) >> 7;
	} else {
		struct proc *p = (struct proc *) id;
		h = HASHSTEP(0, p->p_pid);
		h = HASHSTEP(h, 0);
	}
	return (h % LOCK_OWNER_HASH_SIZE);
}
static int lf_hash_owner ( caddr_t id , struct flock * fl , int flags ) { uint32_t h ; if ( flags & F_REMOTE ) { h = HASHSTEP ( 0 , fl -> l_pid ) ; h = HASHSTEP ( h , fl -> l_sysid ) ; } else if ( flags & F_FLOCK ) { h = ( ( uintptr_t ) id ) >> 7 ; } else { struct proc * p = ( struct proc * ) id ; h = HASHSTEP ( 0 , p -> p_pid ) ; h = HASHSTEP ( h , 0 ) ; } return ( h % LOCK_OWNER_HASH_SIZE ) ; }
Generate a hash value for a lock owner.
Generate a hash value for a lock owner .