FreeBSD/sys/net/if_tap.c
/*
 * tap_kqread
 * 
 * Return true if there is data in the interface queue
 */


Return true if there is data in the interface queue
Return true if there is data in the interface queue
static int
tapkqread(struct knote *kn, long hint)
{
	int			 ret;
	struct tap_softc	*tp = kn->kn_hook;
	struct cdev		*dev = tp->tap_dev;
	struct ifnet		*ifp = tp->tap_ifp;
	if ((kn->kn_data = ifp->if_snd.ifq_len) > 0) {
		TAPDEBUG("%s have data in queue. len = %d, minor = %#x\n",
			ifp->if_xname, ifp->if_snd.ifq_len, dev2unit(dev));
		ret = 1;
	} else {
		TAPDEBUG("%s waiting for data, minor = %#x\n",
			ifp->if_xname, dev2unit(dev));
		ret = 0;
	}
	return (ret);
}
static int tapkqread ( struct knote * kn , long hint ) { int ret ; struct tap_softc * tp = kn -> kn_hook ; struct cdev * dev = tp -> tap_dev ; struct ifnet * ifp = tp -> tap_ifp ; if ( ( kn -> kn_data = ifp -> if_snd . ifq_len ) > 0 ) { TAPDEBUG ( " \n " , ifp -> if_xname , ifp -> if_snd . ifq_len , dev2unit ( dev ) ) ; ret = 1 ; } else { TAPDEBUG ( " \n " , ifp -> if_xname , dev2unit ( dev ) ) ; ret = 0 ; } return ( ret ) ; }
tap_kqread
tap_kqread