LOG_DBG((LOG_MISC, 80, "%s: select reports %d", __func__, res));
event_debug(("%s: select reports %d", __func__, res));
select_dispatch(void *arg, struct timeval *tv){	int maxfd, res;	struct event *ev, *next;	struct selectop *sop = arg;	memset(sop->event_readset, 0, sop->event_fdsz);	memset(sop->event_writeset, 0, sop->event_fdsz);	TAILQ_FOREACH(ev, &eventqueue, ev_next) {		if (ev->ev_events & EV_WRITE)			FD_SET(ev->ev_fd, sop->event_writeset);		if (ev->ev_events & EV_READ)			FD_SET(ev->ev_fd, sop->event_readset);	}	if (evsignal_deliver(&sop->evsigmask) == -1)		return (-1);	res = select(sop->event_fds + 1, sop->event_readset, 	    sop->event_writeset, NULL, tv);	if (evsignal_recalc(&sop->evsigmask) == -1)		return (-1);	if (res == -1) {		if (errno != EINTR) {			log_error("select");			return (-1);		}		evsignal_process();		return (0);	} else if (evsignal_caught)		evsignal_process();	LOG_DBG((LOG_MISC, 80, "%s: select reports %d", __func__, res));	maxfd = 0;	for (ev = TAILQ_FIRST(&eventqueue); ev != NULL; ev = next) {		next = TAILQ_NEXT(ev, ev_next);		res = 0;		if (FD_ISSET(ev->ev_fd, sop->event_readset))			res |= EV_READ;		if (FD_ISSET(ev->ev_fd, sop->event_writeset))			res |= EV_WRITE;		res &= ev->ev_events;		if (res) {			if (!(ev->ev_events & EV_PERSIST))				event_del(ev);			event_active(ev, res, 1);		} else if (ev->ev_fd > maxfd)			maxfd = ev->ev_fd;	}	sop->event_fds = maxfd;	return (0);}