FreeBSD/usr.sbin/jail/state.c
/*
 * Find the next jail ready to do something.
 */
Find the next jail ready to do something.
Find the next jail ready to do something .
struct cfjail *
next_jail(void)
{
	struct cfjail *j;
	if (!(j = next_proc(!TAILQ_EMPTY(&ready))) &&
	    (j = TAILQ_FIRST(&ready)) && JF_DO_STOP(j->flags) &&
	    (j = TAILQ_LAST(&ready, cfjails)) && !JF_DO_STOP(j->flags)) {
		TAILQ_FOREACH_REVERSE(j, &ready, cfjails, tq)
			if (JF_DO_STOP(j->flags))
				break;
	}
	if (j != NULL)
		requeue(j, &cfjails);
	return j;
}
struct cfjail * next_jail ( void ) { struct cfjail * j ; if ( ! ( j = next_proc ( ! TAILQ_EMPTY ( & ready ) ) ) && ( j = TAILQ_FIRST ( & ready ) ) && JF_DO_STOP ( j -> flags ) && ( j = TAILQ_LAST ( & ready , cfjails ) ) && ! JF_DO_STOP ( j -> flags ) ) { TAILQ_FOREACH_REVERSE ( j , & ready , cfjails , tq ) if ( JF_DO_STOP ( j -> flags ) ) break ; } if ( j != NULL ) requeue ( j , & cfjails ) ; return j ; }
Find the next jail ready to do something.
Find the next jail ready to do something .