Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libc/resolv Don't do highestFD check with USE_POLL. It ...



details:   https://anonhg.NetBSD.org/src/rev/8a0586503605
branches:  trunk
changeset: 761847:8a0586503605
user:      pooka <pooka%NetBSD.org@localhost>
date:      Wed Feb 09 09:46:59 2011 +0000

description:
Don't do highestFD check with USE_POLL.  It provides no benefit
but causes a dependency between RLIMIT_NOFILE and rumphijack FDOFF.

christos ok

diffstat:

 lib/libc/resolv/res_send.c |  14 ++++++--------
 1 files changed, 6 insertions(+), 8 deletions(-)

diffs (64 lines):

diff -r c478e6204cfb -r 8a0586503605 lib/libc/resolv/res_send.c
--- a/lib/libc/resolv/res_send.c        Wed Feb 09 09:32:49 2011 +0000
+++ b/lib/libc/resolv/res_send.c        Wed Feb 09 09:46:59 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: res_send.c,v 1.20 2009/10/24 17:24:01 christos Exp $   */
+/*     $NetBSD: res_send.c,v 1.21 2011/02/09 09:46:59 pooka Exp $      */
 
 /*
  * Portions Copyright (C) 2004-2009  Internet Systems Consortium, Inc. ("ISC")
@@ -93,7 +93,7 @@
 static const char sccsid[] = "@(#)res_send.c   8.1 (Berkeley) 6/4/93";
 static const char rcsid[] = "Id: res_send.c,v 1.22 2009/01/22 23:49:23 tbox Exp";
 #else
-__RCSID("$NetBSD: res_send.c,v 1.20 2009/10/24 17:24:01 christos Exp $");
+__RCSID("$NetBSD: res_send.c,v 1.21 2011/02/09 09:46:59 pooka Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -157,8 +157,6 @@
 
 #ifndef USE_POLL
 static const int highestFD = FD_SETSIZE - 1;
-#else
-static int highestFD = 0;
 #endif
 
 /* Forward. */
@@ -333,10 +331,6 @@
        int gotsomewhere, terrno, tries, v_circuit, resplen, ns, n;
        char abuf[NI_MAXHOST];
 
-#ifdef USE_POLL
-       highestFD = sysconf(_SC_OPEN_MAX) - 1;
-#endif
-
        (void)res_check(statp, NULL);
 
        /* No name servers or res_init() failure */
@@ -669,10 +663,12 @@
                        res_nclose(statp);
 
                statp->_vcsock = socket(nsap->sa_family, SOCK_STREAM, 0);
+#ifndef USE_POLL
                if (statp->_vcsock > highestFD) {
                        res_nclose(statp);
                        errno = ENOTSOCK;
                }
+#endif
                if (statp->_vcsock < 0) {
                        switch (errno) {
                        case EPROTONOSUPPORT:
@@ -848,10 +844,12 @@
        nsaplen = get_salen(nsap);
        if (EXT(statp).nssocks[ns] == -1) {
                EXT(statp).nssocks[ns] = socket(nsap->sa_family, SOCK_DGRAM, 0);
+#ifndef USE_POLL
                if (EXT(statp).nssocks[ns] > highestFD) {
                        res_nclose(statp);
                        errno = ENOTSOCK;
                }
+#endif
                if (EXT(statp).nssocks[ns] < 0) {
                        switch (errno) {
                        case EPROTONOSUPPORT:



Home | Main Index | Thread Index | Old Index