FreeBSD/sys/dev/netmap/netmap_freebsd.c
/*
 * callback from notifies (generated externally) and our
 * calls to kevent(). The former we just return 1 (ready)
 * since we do not know better.
 * In the latter we call netmap_poll and return 0/1 accordingly.
 */
callback from notifies (generated externally) and our
calls to kevent(). The former we just return 1 (ready)
since we do not know better.
In the latter we call netmap_poll and return 0/1 accordingly.
callback from notifies ( generated externally ) and our calls to kevent () . The former we just return 1 ( ready ) since we do not know better . In the latter we call netmap_poll and return 0 / 1 accordingly .
static int
netmap_knrw(struct knote *kn, long hint, int events)
{
	struct netmap_priv_d *priv;
	int revents;
	if (hint != 0) {
		ND(5, "call from notify");
		return 1; 
	}
	priv = kn->kn_hook;
	if (curthread != priv->np_td) { 
		RD(5, "curthread changed %p %p", curthread, priv->np_td);
		return 1;
	} else {
		revents = netmap_poll((void *)priv, events, curthread);
		return (events & revents) ? 1 : 0;
	}
}
static int netmap_knrw ( struct knote * kn , long hint , int events ) { struct netmap_priv_d * priv ; int revents ; if ( hint != 0 ) { ND ( 5 , " " ) ; return 1 ; } priv = kn -> kn_hook ; if ( curthread != priv -> np_td ) { RD ( 5 , " " , curthread , priv -> np_td ) ; return 1 ; } else { revents = netmap_poll ( ( void * ) priv , events , curthread ) ; return ( events & revents ) ? 1 : 0 ; } }
callback from notifies (generated externally) and our
 calls to kevent().
callback from notifies ( generated externally ) and our calls to kevent () .
/* assume we are ready */ /* the notification may come from an external thread,
	 * in which case we do not want to run the netmap_poll
	 * This should be filtered above, but check just in case.
	 */ /* should not happen */