From 50e481ceebce7936e773ced188d830659bdf9e40 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Mon, 29 Dec 2008 20:56:13 +0000 Subject: [PATCH] * nscd/nscd_gethst_r.c (nscd_gethst_r): Don't use nscd if LOCALDOMAIN is defined. * nscd/nscd_getai.c (__nscd_getai): Likewise. --- ChangeLog | 4 ++++ nscd/nscd_getai.c | 16 +++++++++++++++- nscd/nscd_gethst_r.c | 15 ++++++++++++++- sysdeps/x86_64/bits/select.h | 14 +++++++++++--- 4 files changed, 44 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9008d28..7696705 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2008-12-29 Ulrich Drepper + * nscd/nscd_gethst_r.c (nscd_gethst_r): Don't use nscd if + LOCALDOMAIN is defined. + * nscd/nscd_getai.c (__nscd_getai): Likewise. + * sysdeps/x86_64/bits/select.h: New file. * resolv/res_init.c (__res_vinit): Count all servers in statp->nscount. diff --git a/nscd/nscd_getai.c b/nscd/nscd_getai.c index 56f9637..674a5e7 100644 --- a/nscd/nscd_getai.c +++ b/nscd/nscd_getai.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2004, 2005, 2006, 2007 Free Software Foundation, Inc. +/* Copyright (C) 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 2004. @@ -36,10 +36,24 @@ extern int __nss_not_use_nscd_hosts; /* We use the mapping from nscd_gethst. */ libc_locked_map_ptr (extern, __hst_map_handle) attribute_hidden; +/* Defined in nscd_gethst_r.c. */ +extern int __nss_have_localdomain attribute_hidden; + int __nscd_getai (const char *key, struct nscd_ai_result **result, int *h_errnop) { + if (__builtin_expect (__nss_have_localdomain >= 0, 0)) + { + if (__nss_have_localdomain == 0) + __nss_have_localdomain = getenv ("LOCALDOMAIN") != NULL ? 1 : -1; + if (__nss_have_localdomain > 0) + { + __nss_not_use_nscd_hosts = 1; + return -1; + } + } + size_t keylen = strlen (key) + 1; int gc_cycle; int nretries = 0; diff --git a/nscd/nscd_gethst_r.c b/nscd/nscd_gethst_r.c index a211404..aea8288 100644 --- a/nscd/nscd_gethst_r.c +++ b/nscd/nscd_gethst_r.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1998-2005, 2006, 2007 Free Software Foundation, Inc. +/* Copyright (C) 1998-2005, 2006, 2007, 2008 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1998. @@ -97,12 +97,25 @@ libc_freeres_fn (hst_map_free) } +int __nss_have_localdomain attribute_hidden; + static int internal_function nscd_gethst_r (const char *key, size_t keylen, request_type type, struct hostent *resultbuf, char *buffer, size_t buflen, struct hostent **result, int *h_errnop) { + if (__builtin_expect (__nss_have_localdomain >= 0, 0)) + { + if (__nss_have_localdomain == 0) + __nss_have_localdomain = getenv ("LOCALDOMAIN") != NULL ? 1 : -1; + if (__nss_have_localdomain > 0) + { + __nss_not_use_nscd_hosts = 1; + return -1; + } + } + int gc_cycle; int nretries = 0; diff --git a/sysdeps/x86_64/bits/select.h b/sysdeps/x86_64/bits/select.h index c217c26..7f23cb5 100644 --- a/sysdeps/x86_64/bits/select.h +++ b/sysdeps/x86_64/bits/select.h @@ -20,13 +20,21 @@ # error "Never use directly; include instead." #endif +#include + #if defined __GNUC__ && __GNUC__ >= 2 # if __WORDSIZE == 64 # define __FD_ZERO_STOS "stosq" +# define __FD_SET_BTS "btsq" +# define __FD_CLR_BTR "btrq" +# define __FD_ISSET_BT "btq" # else # define __FD_ZERO_STOS "stosl" +# define __FD_SET_BTS "btsl" +# define __FD_CLR_BTR "btrl" +# define __FD_ISSET_BT "btl" # endif # define __FD_ZERO(fdsp) \ @@ -41,19 +49,19 @@ } while (0) # define __FD_SET(fd, fdsp) \ - __asm__ __volatile__ ("btsl %1,%0" \ + __asm__ __volatile__ (__FD_SET_BTS " %1,%0" \ : "=m" (__FDS_BITS (fdsp)[__FDELT (fd)]) \ : "r" (((int) (fd)) % __NFDBITS) \ : "cc","memory") # define __FD_CLR(fd, fdsp) \ - __asm__ __volatile__ ("btrl %1,%0" \ + __asm__ __volatile__ (__FD_CLR_BTR " %1,%0" \ : "=m" (__FDS_BITS (fdsp)[__FDELT (fd)]) \ : "r" (((int) (fd)) % __NFDBITS) \ : "cc","memory") # define __FD_ISSET(fd, fdsp) \ (__extension__ \ ({register char __result; \ - __asm__ __volatile__ ("btl %1,%2 ; setcb %b0" \ + __asm__ __volatile__ (__FD_ISSET_BT " %1,%2 ; setcb %b0" \ : "=q" (__result) \ : "r" (((int) (fd)) % __NFDBITS), \ "m" (__FDS_BITS (fdsp)[__FDELT (fd)]) \ -- 2.7.4