Skip to content

Commit

Permalink
* nscd/nscd_gethst_r.c (nscd_gethst_r): Don't use nscd if
Browse files Browse the repository at this point in the history
	LOCALDOMAIN is defined.
	* nscd/nscd_getai.c (__nscd_getai): Likewise.
  • Loading branch information
Ulrich Drepper committed Dec 29, 2008
1 parent 217d45c commit 50e481c
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 5 deletions.
4 changes: 4 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
2008-12-29 Ulrich Drepper <drepper@redhat.com>

* 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.
Expand Down
16 changes: 15 additions & 1 deletion nscd/nscd_getai.c
Original file line number Diff line number Diff line change
@@ -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 <drepper@redhat.com>, 2004.
Expand Down Expand Up @@ -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;
Expand Down
15 changes: 14 additions & 1 deletion nscd/nscd_gethst_r.c
Original file line number Diff line number Diff line change
@@ -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 <drepper@cygnus.com>, 1998.
Expand Down Expand Up @@ -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;

Expand Down
14 changes: 11 additions & 3 deletions sysdeps/x86_64/bits/select.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,21 @@
# error "Never use <bits/select.h> directly; include <sys/select.h> instead."
#endif

#include <bits/wordsize.h>


#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) \
Expand All @@ -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)]) \
Expand Down

0 comments on commit 50e481c

Please sign in to comment.