- Fixup backend2str for libev.

git-svn-id: file:///svn/unbound/trunk@3660 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
Wouter Wijngaards 2016-03-10 14:39:48 +00:00
parent 856c37012b
commit 6a6cf23179
4 changed files with 25 additions and 22 deletions

View File

@ -92,21 +92,6 @@
void* unbound_start_brk = 0;
#endif
#if !defined(HAVE_EVENT_BASE_GET_METHOD) && (defined(HAVE_EV_LOOP) || defined(HAVE_EV_DEFAULT_LOOP))
static const char* ev_backend2str(int b)
{
switch(b) {
case EVBACKEND_SELECT: return "select";
case EVBACKEND_POLL: return "poll";
case EVBACKEND_EPOLL: return "epoll";
case EVBACKEND_KQUEUE: return "kqueue";
case EVBACKEND_DEVPOLL: return "devpoll";
case EVBACKEND_PORT: return "evport";
}
return "unknown";
}
#endif
/** print usage. */
static void usage()
{

View File

@ -1,3 +1,6 @@
10 March 2016: Wouter
- Fixup backend2str for libev.
09 March 2016: Willem
- User defined pluggable event API for libunbound
- Fixup of compile fix for pluggable event API from P.Y. Adi

View File

@ -2162,7 +2162,7 @@ comm_timer_is_set(struct comm_timer* timer)
}
size_t
comm_timer_get_mem(struct comm_timer* timer)
comm_timer_get_mem(struct comm_timer* ATTR_UNUSED(timer))
{
return sizeof(struct internal_timer);
}

View File

@ -93,6 +93,21 @@ const char* ub_event_get_version()
return event_get_version();
}
#if defined(HAVE_EV_LOOP) || defined(HAVE_EV_DEFAULT_LOOP)
static const char* ev_backend2str(int b)
{
switch(b) {
case EVBACKEND_SELECT: return "select";
case EVBACKEND_POLL: return "poll";
case EVBACKEND_EPOLL: return "epoll";
case EVBACKEND_KQUEUE: return "kqueue";
case EVBACKEND_DEVPOLL: return "devpoll";
case EVBACKEND_PORT: return "evport";
}
return "unknown";
}
#endif
void
ub_get_event_sys(struct ub_event_base* base, const char** n, const char** s,
const char** m)
@ -110,16 +125,16 @@ ub_get_event_sys(struct ub_event_base* base, const char** n, const char** s,
#else
struct event_base* b = AS_EVENT_BASE(base);
*s = event_get_version();
# ifdef HAVE_EVENT_BASE_GET_METHOD
*n = "libevent";
if (!b)
b = event_base_new();
*m = event_base_get_method(b);
# elif defined(HAVE_EV_LOOP) || defined(HAVE_EV_DEFAULT_LOOP)
# if defined(HAVE_EV_LOOP) || defined(HAVE_EV_DEFAULT_LOOP)
*n = "libev";
if (!b)
b = (struct event_base*)ev_default_loop(EVFLAG_AUTO);
*m = ev_backend2str(ev_backend((struct ev_loop*)b));
# elif defined(HAVE_EVENT_BASE_GET_METHOD)
*n = "libevent";
if (!b)
b = event_base_new();
*m = event_base_get_method(b);
# else
*n = "unknown";
*m = "not obtainable";