FreeBSD/sys/net/bpf.c
/*
 * Add d to the list of active bp filters.
 * Requires bpf_attachd() to be called before.
 */
Add d to the list of active bp filters.
Requires bpf_attachd() to be called before.
Add d to the list of active bp filters . Requires bpf_attachd () to be called before .
static void
bpf_upgraded(struct bpf_d *d)
{
	struct bpf_if *bp;
	BPF_LOCK_ASSERT();
	bp = d->bd_bif;
	if (bp == NULL) {
		BPFD_LOCK(d);
		d->bd_writer = 0;
		BPFD_UNLOCK(d);
		return;
	}
	BPFIF_WLOCK(bp);
	BPFD_LOCK(d);
	LIST_REMOVE(d, bd_next);
	LIST_INSERT_HEAD(&bp->bif_dlist, d, bd_next);
	d->bd_writer = 0;
	BPFD_UNLOCK(d);
	BPFIF_WUNLOCK(bp);
	CTR2(KTR_NET, "%s: upgrade required by pid %d", __func__, d->bd_pid);
	EVENTHANDLER_INVOKE(bpf_track, bp->bif_ifp, bp->bif_dlt, 1);
}
static void bpf_upgraded ( struct bpf_d * d ) { struct bpf_if * bp ; BPF_LOCK_ASSERT ( ) ; bp = d -> bd_bif ; if ( bp == NULL ) { BPFD_LOCK ( d ) ; d -> bd_writer = 0 ; BPFD_UNLOCK ( d ) ; return ; } BPFIF_WLOCK ( bp ) ; BPFD_LOCK ( d ) ; LIST_REMOVE ( d , bd_next ) ; LIST_INSERT_HEAD ( & bp -> bif_dlist , d , bd_next ) ; d -> bd_writer = 0 ; BPFD_UNLOCK ( d ) ; BPFIF_WUNLOCK ( bp ) ; CTR2 ( KTR_NET , " " , __func__ , d -> bd_pid ) ; EVENTHANDLER_INVOKE ( bpf_track , bp -> bif_ifp , bp -> bif_dlt , 1 ) ; }
Add d to the list of active bp filters.
Add d to the list of active bp filters .
/*
	 * Filter can be set several times without specifying interface.
	 * Mark d as reader and exit.
	 */ /* Remove from writers-only list */ /* Mark d as reader */