From 024dfc00c4f8f6a422a73441f5bf1aa62303a402 Mon Sep 17 00:00:00 2001 From: Marko Kreen Date: Wed, 23 Mar 2011 18:04:02 +0200 Subject: [PATCH] adns: log active backend --- include/dnslookup.h | 2 ++ src/dnslookup.c | 23 +++++++++++++++++++++++ src/main.c | 3 ++- 3 files changed, 27 insertions(+), 1 deletion(-) diff --git a/include/dnslookup.h b/include/dnslookup.h index b497449..cf86fe0 100644 --- a/include/dnslookup.h +++ b/include/dnslookup.h @@ -29,3 +29,5 @@ struct DNSToken *adns_resolve(struct DNSContext *ctx, const char *name, adns_cal void adns_cancel(struct DNSContext *ctx, struct DNSToken *tk); +const char *adns_get_backend(void); + diff --git a/src/dnslookup.c b/src/dnslookup.c index a550ca6..2643fe5 100644 --- a/src/dnslookup.c +++ b/src/dnslookup.c @@ -86,6 +86,19 @@ static void got_result_gai(int result, struct addrinfo *res, void *arg); #ifdef USE_GETADDRINFO_A +const char *adns_get_backend(void) +{ +#ifdef HAVE_GETADDRINFO_A + return "libc" +#ifdef __GLIBC__ + "-" STR(__GLIBC__) "." STR(__GLIBC_MINOR__); +#endif + ; +#else + return "compat"; +#endif +} + /* * ADNS with glibc's getaddrinfo_a() */ @@ -187,6 +200,11 @@ static void impl_release(struct DNSContext *ctx) #ifdef USE_LIBEVENT2 +const char *adns_get_backend(void) +{ + return "evdns2"; +} + /* * ADNS with libevent2 */ @@ -220,6 +238,11 @@ static void impl_release(struct DNSContext *ctx) #ifdef USE_LIBEVENT1 +const char *adns_get_backend(void) +{ + return "evdns1"; +} + /* * ADNS with libevent 1.x */ diff --git a/src/main.c b/src/main.c index 7ea84e7..da0c121 100644 --- a/src/main.c +++ b/src/main.c @@ -762,7 +762,8 @@ int main(int argc, char *argv[]) write_pidfile(); - log_info("process up: %s, libevent %s (%s)", PACKAGE_STRING, event_get_version(), event_get_method()); + log_info("process up: %s, libevent %s (%s), adns: %s", PACKAGE_STRING, + event_get_version(), event_get_method(), adns_get_backend()); /* main loop */ while (cf_shutdown < 2) -- 2.40.0