LOG_DBG((LOG_MISC, 55,
struct event_base *base = ev->ev_base; const struct eventop *evsel = base->evsel; void *evbase = base->evbase;  event_debug((
event_add(struct event *ev, struct timeval *tv){	LOG_DBG((LOG_MISC, 55,		 "event_add: event: %p, %s%s%scall %p",		 ev,		 ev->ev_events & EV_READ ? "EV_READ " : " ",		 ev->ev_events & EV_WRITE ? "EV_WRITE " : " ",		 tv ? "EV_TIMEOUT " : " ",		 ev->ev_callback));	assert(!(ev->ev_flags & ~EVLIST_ALL));	if (tv != NULL) {		struct timeval now;		if (ev->ev_flags & EVLIST_TIMEOUT)			event_queue_remove(ev, EVLIST_TIMEOUT);		/* Check if it is active due to a timeout.  Rescheduling		 * this timeout before the callback can be executed		 * removes it from the active list. */		if ((ev->ev_flags & EVLIST_ACTIVE) &&		    (ev->ev_res & EV_TIMEOUT)) {			/* See if we are just active executing this			 * event in a loop			 */			if (ev->ev_ncalls && ev->ev_pncalls) {				/* Abort loop */				*ev->ev_pncalls = 0;			}						event_queue_remove(ev, EVLIST_ACTIVE);		}		gettimeofday(&now, NULL);		timeradd(&now, tv, &ev->ev_timeout);		LOG_DBG((LOG_MISC, 55,			 "event_add: timeout in %d seconds, call %p",			 tv->tv_sec, ev->ev_callback));		event_queue_insert(ev, EVLIST_TIMEOUT);	}	if ((ev->ev_events & (EV_READ|EV_WRITE)) &&	    !(ev->ev_flags & (EVLIST_INSERTED|EVLIST_ACTIVE))) {		event_queue_insert(ev, EVLIST_INSERTED);		return (evsel->add(evbase, ev));	} else if ((ev->ev_events & EV_SIGNAL) &&	    !(ev->ev_flags & EVLIST_SIGNAL)) {		event_queue_insert(ev, EVLIST_SIGNAL);		return (evsel->add(evbase, ev));	}	return (0);}