dnl Dug Song <dugsong@monkey.org>
AC_INIT(event.c)
-AM_INIT_AUTOMAKE(libevent,0.8)
+AM_INIT_AUTOMAKE(libevent,0.9)
AM_CONFIG_HEADER(config.h)
AM_MAINTAINER_MODE
dnl Checks for header files.
AC_HEADER_STDC
-AC_CHECK_HEADERS(stdarg.h inttypes.h stdint.h poll.h signal.h unistd.h sys/epoll.h sys/time.h sys/queue.h sys/event.h sys/ioctl.h)
+AC_CHECK_HEADERS(stdarg.h inttypes.h stdint.h poll.h signal.h unistd.h sys/epoll.h sys/time.h sys/queue.h sys/event.h sys/ioctl.h sys/devpoll.h)
if test "x$ac_cv_header_sys_queue_h" = "xyes"; then
AC_MSG_CHECKING(for TAILQ_FOREACH in sys/queue.h)
AC_EGREP_CPP(yes,
needsignal=yes
fi
+havedevpoll=no
+if test "x$ac_cv_header_sys_devpoll_h" = "xyes"; then
+ AC_DEFINE(HAVE_DEVPOLL, 1,
+ [Define if /dev/poll is available])
+ AC_LIBOBJ(devpoll)
+fi
+
havekqueue=no
if test "x$ac_cv_header_sys_event_h" = "xyes"; then
AC_CHECK_FUNCS(kqueue, [havekqueue=yes], )
len = read(fd, buf, sizeof(buf));
if (len) {
- if (!called)
- event_add(arg, NULL);
+ if (!called) {
+ if (event_add(arg, NULL) == -1)
+ exit(1);
+ }
} else if (called == 1)
test_ok = 1;
return;
}
- if (!usepersist)
- event_add(ev, NULL);
+ if (!usepersist) {
+ if (event_add(ev, NULL) == -1)
+ exit(1);
+ }
}
void
}
roff += len;
- if (!usepersist)
- event_add(ev, NULL);
+ if (!usepersist) {
+ if (event_add(ev, NULL) == -1)
+ exit(1);
+ }
}
void
return;
both->nread += len;
- event_add(&both->ev, NULL);
+ if (event_add(&both->ev, NULL) == -1)
+ exit(1);
}
void
}
both->nread -= len;
- event_add(&both->ev, NULL);
+ if (event_add(&both->ev, NULL) == -1)
+ exit(1);
}
/* Test infrastructure */
shutdown(pair[0], SHUT_WR);
event_set(&ev, pair[1], EV_READ, simple_read_cb, &ev);
- event_add(&ev, NULL);
+ if (event_add(&ev, NULL) == -1)
+ exit(1);
event_dispatch();
cleanup_test();
setup_test("Simple write: ");
event_set(&ev, pair[0], EV_WRITE, simple_write_cb, &ev);
- event_add(&ev, NULL);
+ if (event_add(&ev, NULL) == -1)
+ exit(1);
event_dispatch();
cleanup_test();
usepersist = 0;
event_set(&ev, pair[0], EV_WRITE, multiple_write_cb, &ev);
- event_add(&ev, NULL);
+ if (event_add(&ev, NULL) == -1)
+ exit(1);
event_set(&ev2, pair[1], EV_READ, multiple_read_cb, &ev2);
- event_add(&ev2, NULL);
+ if (event_add(&ev2, NULL) == -1)
+ exit(1);
event_dispatch();
if (roff == woff)
usepersist = 1;
event_set(&ev, pair[0], EV_WRITE|EV_PERSIST, multiple_write_cb, &ev);
- event_add(&ev, NULL);
+ if (event_add(&ev, NULL) == -1)
+ exit(1);
event_set(&ev2, pair[1], EV_READ|EV_PERSIST, multiple_read_cb, &ev2);
- event_add(&ev2, NULL);
+ if (event_add(&ev2, NULL) == -1)
+ exit(1);
event_dispatch();
if (roff == woff)
event_set(&w1.ev, pair[0], EV_WRITE, combined_write_cb, &w1);
event_set(&r2.ev, pair[1], EV_READ, combined_read_cb, &r2);
event_set(&w2.ev, pair[1], EV_WRITE, combined_write_cb, &w2);
- event_add(&r1.ev, NULL);
- event_add(&w1.ev, NULL);
- event_add(&r2.ev, NULL);
- event_add(&w2.ev, NULL);
+ if (event_add(&r1.ev, NULL) == -1)
+ exit(1);
+ if (event_add(&w1.ev, NULL))
+ exit(1);
+ if (event_add(&r2.ev, NULL))
+ exit(1);
+ if (event_add(&w2.ev, NULL))
+ exit(1);
event_dispatch();