Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 14 Jan 2014 22:05:33 +0000 (UTC)
From:      Jilles Tjoelker <jilles@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r260652 - in head/lib/libc: include resolv
Message-ID:  <201401142205.s0EM5XCL088142@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jilles
Date: Tue Jan 14 22:05:33 2014
New Revision: 260652
URL: http://svnweb.freebsd.org/changeset/base/260652

Log:
  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

Modified:
  head/lib/libc/include/port_before.h
  head/lib/libc/resolv/res_send.c

Modified: head/lib/libc/include/port_before.h
==============================================================================
--- head/lib/libc/include/port_before.h	Tue Jan 14 21:35:25 2014	(r260651)
+++ head/lib/libc/include/port_before.h	Tue Jan 14 22:05:33 2014	(r260652)
@@ -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) \

Modified: head/lib/libc/resolv/res_send.c
==============================================================================
--- head/lib/libc/resolv/res_send.c	Tue Jan 14 21:35:25 2014	(r260651)
+++ head/lib/libc/resolv/res_send.c	Tue Jan 14 22:05:33 2014	(r260652)
@@ -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) {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201401142205.s0EM5XCL088142>