summaryrefslogtreecommitdiffstats
path: root/lib/libc
diff options
context:
space:
mode:
authorjilles <jilles@FreeBSD.org>2014-01-14 22:05:33 +0000
committerjilles <jilles@FreeBSD.org>2014-01-14 22:05:33 +0000
commitb8a27f5deec1c45541670c76d9792d523e1f321d (patch)
tree83b3c88ff66f10f23baf3d2e98383b8c767940f5 /lib/libc
parentf63cb2f402153eb98e1cd773f6207b1cf5d05cc2 (diff)
downloadFreeBSD-src-b8a27f5deec1c45541670c76d9792d523e1f321d.zip
FreeBSD-src-b8a27f5deec1c45541670c76d9792d523e1f321d.tar.gz
libc/resolv: Use poll() instead of kqueue().
The resolver in libc creates a kqueue for watching a single file descriptor. This can be done using poll() which should be lighter on the kernel and reduce possible problems with rlimits (file descriptors, kqueues). Reviewed by: jhb
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/include/port_before.h2
-rw-r--r--lib/libc/resolv/res_send.c4
2 files changed, 3 insertions, 3 deletions
diff --git a/lib/libc/include/port_before.h b/lib/libc/include/port_before.h
index 304dd66..9e7525b 100644
--- a/lib/libc/include/port_before.h
+++ b/lib/libc/include/port_before.h
@@ -5,7 +5,7 @@
#define _LIBC 1
#define DO_PTHREADS 1
-#define USE_KQUEUE 1
+#define USE_POLL 1
#define ISC_SOCKLEN_T socklen_t
#define ISC_FORMAT_PRINTF(fmt, args) \
diff --git a/lib/libc/resolv/res_send.c b/lib/libc/resolv/res_send.c
index 4896fe8..f7c38c5 100644
--- a/lib/libc/resolv/res_send.c
+++ b/lib/libc/resolv/res_send.c
@@ -77,7 +77,7 @@ __FBSDID("$FreeBSD$");
*/
#include "port_before.h"
-#ifndef USE_KQUEUE
+#if !defined(USE_KQUEUE) && !defined(USE_POLL)
#include "fd_setsize.h"
#endif
@@ -963,7 +963,7 @@ send_dg(res_state statp,
timeout.tv_nsec/1000000;
pollfd.fd = s;
pollfd.events = POLLRDNORM;
- n = poll(&pollfd, 1, polltimeout);
+ n = _poll(&pollfd, 1, polltimeout);
#endif /* USE_POLL */
if (n == 0) {
OpenPOWER on IntegriCloud