From owner-svn-src-all@FreeBSD.ORG  Tue Jan 14 22:05:33 2014
Return-Path: <owner-svn-src-all@FreeBSD.ORG>
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115])
 (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id D599E25C;
 Tue, 14 Jan 2014 22:05:33 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (No client certificate requested)
 by mx1.freebsd.org (Postfix) with ESMTPS id C17FD1ECF;
 Tue, 14 Jan 2014 22:05:33 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s0EM5Xbp088144;
 Tue, 14 Jan 2014 22:05:33 GMT (envelope-from jilles@svn.freebsd.org)
Received: (from jilles@localhost)
 by svn.freebsd.org (8.14.7/8.14.7/Submit) id s0EM5XCL088142;
 Tue, 14 Jan 2014 22:05:33 GMT (envelope-from jilles@svn.freebsd.org)
Message-Id: <201401142205.s0EM5XCL088142@svn.freebsd.org>
From: Jilles Tjoelker <jilles@FreeBSD.org>
Date: Tue, 14 Jan 2014 22:05:33 +0000 (UTC)
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
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.17
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for &quot;
 user&quot; and &quot; projects&quot; \)" <svn-src-all.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/options/svn-src-all>,
 <mailto:svn-src-all-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-all/>
List-Post: <mailto:svn-src-all@freebsd.org>
List-Help: <mailto:svn-src-all-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-all>,
 <mailto:svn-src-all-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 14 Jan 2014 22:05:33 -0000

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) {