FreeBSD/sys/net/if_tap.c
/*
 * tap_kqfilter
 *
 * support for kevent() system call
 */
tap_kqfilter
support for kevent() system call
tap_kqfilter support for kevent () system call
static int
tapkqfilter(struct cdev *dev, struct knote *kn)
{
	struct tap_softc	*tp = dev->si_drv1;
	struct ifnet		*ifp = tp->tap_ifp;
	switch (kn->kn_filter) {
	case EVFILT_READ:
		TAPDEBUG("%s kqfilter: EVFILT_READ, minor = %#x\n",
			ifp->if_xname, dev2unit(dev));
		kn->kn_fop = &tap_read_filterops;
		break;
	case EVFILT_WRITE:
		TAPDEBUG("%s kqfilter: EVFILT_WRITE, minor = %#x\n",
			ifp->if_xname, dev2unit(dev));
		kn->kn_fop = &tap_write_filterops;
		break;
	default:
		TAPDEBUG("%s kqfilter: invalid filter, minor = %#x\n",
			ifp->if_xname, dev2unit(dev));
		return (EINVAL);
	}
	kn->kn_hook = tp;
	knlist_add(&tp->tap_rsel.si_note, kn, 0);
	return (0);
}
static int tapkqfilter ( struct cdev * dev , struct knote * kn ) { struct tap_softc * tp = dev -> si_drv1 ; struct ifnet * ifp = tp -> tap_ifp ; switch ( kn -> kn_filter ) { case EVFILT_READ : TAPDEBUG ( " \n " , ifp -> if_xname , dev2unit ( dev ) ) ; kn -> kn_fop = & tap_read_filterops ; break ; case EVFILT_WRITE : TAPDEBUG ( " \n " , ifp -> if_xname , dev2unit ( dev ) ) ; kn -> kn_fop = & tap_write_filterops ; break ; default : TAPDEBUG ( " \n " , ifp -> if_xname , dev2unit ( dev ) ) ; return ( EINVAL ) ; } kn -> kn_hook = tp ; knlist_add ( & tp -> tap_rsel . si_note , kn , 0 ) ; return ( 0 ) ; }
tap_kqfilter
 support for kevent() system call
tap_kqfilter support for kevent () system call
/* NOT REACHED */