struct timeval off;
LOG_DBG((LOG_MIST, 10,
"%s: time is running backwards, corrected",
- __FUNCTION__));
+ __func__));
timersub(&event_tv, &tv, &off);
timeout_correct(&off);
event_queue_remove(struct event *ev, int queue)
{
if (!(ev->ev_flags & queue))
- errx(1, "%s: %p(fd %d) not on queue %x", __FUNCTION__,
+ errx(1, "%s: %p(fd %d) not on queue %x", __func__,
ev, ev->ev_fd, queue);
ev->ev_flags &= ~queue;
TAILQ_REMOVE(&eventqueue, ev, ev_next);
break;
default:
- errx(1, "%s: unknown queue %x", __FUNCTION__, queue);
+ errx(1, "%s: unknown queue %x", __func__, queue);
}
}
event_queue_insert(struct event *ev, int queue)
{
if (ev->ev_flags & queue)
- errx(1, "%s: %p(fd %d) already on queue %x", __FUNCTION__,
+ errx(1, "%s: %p(fd %d) already on queue %x", __func__,
ev, ev->ev_fd, queue);
ev->ev_flags |= queue;
TAILQ_INSERT_TAIL(&eventqueue, ev, ev_next);
break;
default:
- errx(1, "%s: unknown queue %x", __FUNCTION__, queue);
+ errx(1, "%s: unknown queue %x", __func__, queue);
}
}
#include <string.h>
#include <unistd.h>
#include <errno.h>
+#include <err.h>
#ifdef USE_LOG
#include "log.h"
#else
#define LOG_DBG(x)
-#define log_error(x) perror(x)
+#define log_error warn
#endif
#include "event.h"
newchange = realloc(kqop->changes,
nevents * sizeof(struct kevent));
if (newchange == NULL) {
- log_error(__FUNCTION__": malloc");
+ log_error("%s: malloc", __func__);
return (-1);
}
kqop->changes = newchange;
* the next realloc will pick it up.
*/
if (newresult == NULL) {
- log_error(__FUNCTION__": malloc");
+ log_error("%s: malloc", __func__);
return (-1);
}
kqop->events = newchange;
memcpy(&kqop->changes[kqop->nchanges++], kev, sizeof(struct kevent));
- LOG_DBG((LOG_MISC, 70, __FUNCTION__": fd %d %s%s",
- kev->ident,
+ LOG_DBG((LOG_MISC, 70, "%s: fd %d %s%s",
+ __func__, kev->ident,
kev->filter == EVFILT_READ ? "EVFILT_READ" : "EVFILT_WRITE",
kev->flags == EV_DELETE ? " (del)" : ""));
return (0);
}
- LOG_DBG((LOG_MISC, 80, __FUNCTION__": kevent reports %d", res));
+ LOG_DBG((LOG_MISC, 80, "%s: kevent reports %d", __func__, res));
for (i = 0; i < res; i++) {
int which = 0;
return (-1);
}
- ev = events[i].udata;
+ ev = (struct event *)events[i].udata;
if (events[i].filter == EVFILT_READ) {
which |= EV_READ;
if (events[i].flags & EV_ERROR || events[i].filter == NULL)
continue;
- ev = events[i].udata;
+ ev = (struct event *)events[i].udata;
if (ev->ev_events & EV_PERSIST)
continue;
poll_dispatch(void *arg, struct timeval *tv)
{
int res, i, count, sec, nfds;
- struct event *ev, *next;
+ struct event *ev;
struct pollop *pop = arg;
count = pop->event_count;
} else if (evsignal_caught)
evsignal_process();
- LOG_DBG((LOG_MISC, 80, __FUNCTION__": poll reports %d",
- res));
+ LOG_DBG((LOG_MISC, 80, "%s: poll reports %d", __func__, res));
if (res == 0)
return (0);
{
struct pollop *pop = arg;
- int signal;
-
if (!(ev->ev_events & EV_SIGNAL))
return (0);
} else if (evsignal_caught)
evsignal_process();
- LOG_DBG((LOG_MISC, 80, __FUNCTION__": select reports %d",
- res));
+ LOG_DBG((LOG_MISC, 80, "%s: select reports %d", __func__, res));
maxfd = 0;
for (ev = TAILQ_FIRST(&eventqueue); ev != NULL; ev = next) {