FreeBSD/sys/kern/kern_lockf.c
static int
lf_add_incoming(struct lockf *state, struct lockf_entry *lock)
{
	struct lockf_entry *overlap;
	int error;

	LIST_FOREACH(overlap, &state->ls_pending, lf_link) {
		if (!lf_blocks(lock, overlap))
			continue;

		/*
		 * We've found a blocking lock. Add the corresponding
		 * edge to the graphs and see if it would cause a
		 * deadlock.
		 */
		error = lf_add_edge(overlap, lock);

		/*
		 * The only error that lf_add_edge returns is EDEADLK.
		 * Remove any edges we added and return the error.
		 */
		if (error) {
			lf_remove_incoming(lock);
			return (error);
		}
	}
	return (0);
}
/*
 * Walk the list of pending locks for the file and create an in-coming
 * edge from lock to each blocking lock.
 */
Walk the list of pending locks for the file and create an in-coming
edge from lock to each blocking lock.
Walk the list of pending locks for the file and create an in - coming edge from lock to each blocking lock .
static int
lf_add_incoming(struct lockf *state, struct lockf_entry *lock)
{
	struct lockf_entry *overlap;
	int error;
	LIST_FOREACH(overlap, &state->ls_pending, lf_link) {
		if (!lf_blocks(lock, overlap))
			continue;
		error = lf_add_edge(overlap, lock);
		if (error) {
			lf_remove_incoming(lock);
			return (error);
		}
	}
	return (0);
}
static int lf_add_incoming ( struct lockf * state , struct lockf_entry * lock ) { struct lockf_entry * overlap ; int error ; LIST_FOREACH ( overlap , & state -> ls_pending , lf_link ) { if ( ! lf_blocks ( lock , overlap ) ) continue ; error = lf_add_edge ( overlap , lock ) ; if ( error ) { lf_remove_incoming ( lock ) ; return ( error ) ; } } return ( 0 ) ; }
Walk the list of pending locks for the file and create an in-coming
 edge from lock to each blocking lock.
Walk the list of pending locks for the file and create an in - coming edge from lock to each blocking lock .
/*
		 * We've found a blocking lock. Add the corresponding
		 * edge to the graphs and see if it would cause a
		 * deadlock.
		 */ /*
		 * The only error that lf_add_edge returns is EDEADLK.
		 * Remove any edges we added and return the error.
		 */