FreeBSD/sys/kern/kern_sx.c
/*
 * Check to see if a thread that is blocked on a sleep queue is actually
 * blocked on an sx lock.  If so, output some details and return true.
 * If the lock has an exclusive owner, return that in *ownerp.
 */
Check to see if a thread that is blocked on a sleep queue is actually
blocked on an sx lock.  If so, output some details and return true.
If the lock has an exclusive owner, return that in *ownerp.
Check to see if a thread that is blocked on a sleep queue is actually blocked on an sx lock . If so output some details and return true . If the lock has an exclusive owner return that in * ownerp .
int
sx_chain(struct thread *td, struct thread **ownerp)
{
	struct sx *sx;
	sx = td->td_wchan;
	if (LOCK_CLASS(&sx->lock_object) != &lock_class_sx ||
	    sx->lock_object.lo_name != td->td_wmesg)
		return (0);
	db_printf("blocked on sx \"%s\" ", td->td_wmesg);
	*ownerp = sx_xholder(sx);
	if (sx->sx_lock & SX_LOCK_SHARED)
		db_printf("SLOCK (count %ju)\n",
		    (uintmax_t)SX_SHARERS(sx->sx_lock));
	else
		db_printf("XLOCK\n");
	return (1);
}
int sx_chain ( struct thread * td , struct thread * * ownerp ) { struct sx * sx ; sx = td -> td_wchan ; if ( LOCK_CLASS ( & sx -> lock_object ) != & lock_class_sx || sx -> lock_object . lo_name != td -> td_wmesg ) return ( 0 ) ; db_printf ( " \" \" " , td -> td_wmesg ) ; * ownerp = sx_xholder ( sx ) ; if ( sx -> sx_lock & SX_LOCK_SHARED ) db_printf ( " \n " , ( uintmax_t ) SX_SHARERS ( sx -> sx_lock ) ) ; else db_printf ( " \n " ) ; return ( 1 ) ; }
Check to see if a thread that is blocked on a sleep queue is actually
 blocked on an sx lock.
Check to see if a thread that is blocked on a sleep queue is actually blocked on an sx lock .
/*
	 * Check to see if this thread is blocked on an sx lock.
	 * First, we check the lock class.  If that is ok, then we
	 * compare the lock name against the wait message.
	 */ /* We think we have an sx lock, so output some details. */