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

[Commits] r20296 - in /fsf/trunk/libc: ./ csu/ grp/ gshadow/ inet/ nscd/ nss/ nss/nss_db/ nss/nss_files/ ports/ ports/sysdeps/unix/sys...



Author: eglibc
Date: Thu Aug 23 00:02:12 2012
New Revision: 20296

Log:
Import glibc-mainline for 2012-08-23

Added:
    fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/mips/mips64/fxstat64.c
    fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/mips/mips64/lxstat64.c
    fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/mips/mips64/xstat64.c
    fsf/trunk/libc/string/bug-strcasestr1.c
    fsf/trunk/libc/sysdeps/powerpc/powerpc32/power6/wcschr.c
    fsf/trunk/libc/sysdeps/powerpc/powerpc32/power6/wcscpy.c
    fsf/trunk/libc/sysdeps/powerpc/powerpc32/power6/wcsrchr.c
    fsf/trunk/libc/sysdeps/powerpc/powerpc64/power6/wcschr.c
    fsf/trunk/libc/sysdeps/powerpc/powerpc64/power6/wcscpy.c
    fsf/trunk/libc/sysdeps/powerpc/powerpc64/power6/wcsrchr.c
Modified:
    fsf/trunk/libc/ChangeLog
    fsf/trunk/libc/Makerules
    fsf/trunk/libc/NEWS
    fsf/trunk/libc/config.h.in
    fsf/trunk/libc/config.make.in
    fsf/trunk/libc/configure
    fsf/trunk/libc/configure.in
    fsf/trunk/libc/csu/libc-start.c
    fsf/trunk/libc/grp/Makefile
    fsf/trunk/libc/gshadow/getsgent.c
    fsf/trunk/libc/gshadow/getsgent_r.c
    fsf/trunk/libc/gshadow/getsgnam.c
    fsf/trunk/libc/gshadow/getsgnam_r.c
    fsf/trunk/libc/inet/Makefile
    fsf/trunk/libc/inet/getaliasent.c
    fsf/trunk/libc/inet/getaliasent_r.c
    fsf/trunk/libc/inet/getaliasname.c
    fsf/trunk/libc/inet/getaliasname_r.c
    fsf/trunk/libc/inet/getnetbyad.c
    fsf/trunk/libc/inet/getnetbyad_r.c
    fsf/trunk/libc/inet/getnetbynm.c
    fsf/trunk/libc/inet/getnetbynm_r.c
    fsf/trunk/libc/inet/getnetent.c
    fsf/trunk/libc/inet/getnetent_r.c
    fsf/trunk/libc/inet/getnetgrent_r.c
    fsf/trunk/libc/inet/getproto.c
    fsf/trunk/libc/inet/getproto_r.c
    fsf/trunk/libc/inet/getprtent.c
    fsf/trunk/libc/inet/getprtent_r.c
    fsf/trunk/libc/inet/getprtname.c
    fsf/trunk/libc/inet/getprtname_r.c
    fsf/trunk/libc/inet/getrpcbyname.c
    fsf/trunk/libc/inet/getrpcbyname_r.c
    fsf/trunk/libc/inet/getrpcbynumber.c
    fsf/trunk/libc/inet/getrpcbynumber_r.c
    fsf/trunk/libc/inet/getrpcent.c
    fsf/trunk/libc/inet/getrpcent_r.c
    fsf/trunk/libc/nscd/Makefile
    fsf/trunk/libc/nscd/gai.c
    fsf/trunk/libc/nscd/getgrgid_r.c
    fsf/trunk/libc/nscd/getgrnam_r.c
    fsf/trunk/libc/nscd/gethstbyad_r.c
    fsf/trunk/libc/nscd/gethstbynm3_r.c
    fsf/trunk/libc/nscd/getpwnam_r.c
    fsf/trunk/libc/nscd/getpwuid_r.c
    fsf/trunk/libc/nscd/getsrvbynm_r.c
    fsf/trunk/libc/nscd/getsrvbypt_r.c
    fsf/trunk/libc/nscd/nscd.c
    fsf/trunk/libc/nss/nss_db/db-init.c
    fsf/trunk/libc/nss/nss_files/files-init.c
    fsf/trunk/libc/nss/nsswitch.c
    fsf/trunk/libc/ports/ChangeLog.mips
    fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/mips/kernel-features.h
    fsf/trunk/libc/posix/Makefile
    fsf/trunk/libc/pwd/Makefile
    fsf/trunk/libc/shadow/getspent.c
    fsf/trunk/libc/shadow/getspent_r.c
    fsf/trunk/libc/shadow/getspnam.c
    fsf/trunk/libc/shadow/getspnam_r.c
    fsf/trunk/libc/string/Makefile
    fsf/trunk/libc/string/str-two-way.h
    fsf/trunk/libc/string/strcasestr.c
    fsf/trunk/libc/string/strstr.c
    fsf/trunk/libc/sysdeps/posix/getaddrinfo.c
    fsf/trunk/libc/sysdeps/unix/sysv/linux/check_pf.c

Modified: fsf/trunk/libc/ChangeLog
==============================================================================
--- fsf/trunk/libc/ChangeLog (original)
+++ fsf/trunk/libc/ChangeLog Thu Aug 23 00:02:12 2012
@@ -1,3 +1,149 @@
+2012-08-22  Roland McGrath  <roland@xxxxxxxxxxxxx>
+
+	* shadow/getspent.c: #undef USE_NSCD before #include that gets the code.
+	* shadow/getspent_r.c: Likewise.
+	* shadow/getspnam.c: Likewise.
+	* shadow/getspnam_r.c: Likewise.
+	* gshadow/getsgent.c: Likewise.
+	* gshadow/getsgent_r.c: Likewise.
+	* gshadow/getsgnam.c: Likewise.
+	* gshadow/getsgnam_r.c: Likewise.
+	* inet/getnetbyad.c: Likewise.
+	* inet/getnetbyad_r.c: Likewise.
+	* inet/getnetbynm.c: Likewise.
+	* inet/getnetbynm_r.c: Likewise.
+	* inet/getnetent.c: Likewise.
+	* inet/getnetent_r.c: Likewise.
+	* inet/getproto.c: Likewise.
+	* inet/getproto_r.c: Likewise.
+	* inet/getprtent.c: Likewise.
+	* inet/getprtent_r.c: Likewise.
+	* inet/getprtname.c: Likewise.
+	* inet/getprtname_r.c: Likewise.
+	* inet/getrpcbyname.c: Likewise.
+	* inet/getrpcbyname_r.c: Likewise.
+	* inet/getrpcbynumber.c: Likewise.
+	* inet/getrpcbynumber_r.c: Likewise.
+	* inet/getrpcent.c: Likewise.
+	* inet/getrpcent_r.c: Likewise.
+	* inet/getaliasent.c: Likewise.
+	* inet/getaliasent_r.c: Likewise.
+	* inet/getaliasname.c: Likewise.
+	* inet/getaliasname_r.c: Likewise.
+	* nscd/getgrgid_r.c: Likewise.
+	* nscd/getgrnam_r.c: Likewise.
+	* nscd/gethstbyad_r.c: Likewise.
+	* nscd/gethstbynm3_r.c: Likewise.
+	* nscd/getpwnam_r.c: Likewise.
+	* nscd/getpwuid_r.c: Likewise.
+	* nscd/getsrvbynm_r.c: Likewise.
+	* nscd/getsrvbypt_r.c: Likewise.
+	* nscd/gai.c: Likewise.
+
+	* configure.in (build_nscd): New substituted variable, set
+	by --disable-build-nscd and defaults to $use_nscd.
+	* configure: Regenerated.
+	* config.make.in (build-nscd): New substituted variable.
+	* nscd/Makefile (others, others-pie, install-sbin, extra-objs):
+	Change conditional to require [$(build-nscd) = yes] as well.
+	* NEWS: Mention --disable-build-nscd in the --disable-nscd item.
+
+	[BZ# 13696]
+	* configure.in (use_nscd): New substituted variable, set by
+	--disable-nscd.  If enabled, define USE_NSCD.
+	* configure: Regenerated.
+	* config.h.in: Add USE_NSCD.
+	* config.make.in (use-nscd): New substituted variable.
+	* inet/Makefile (CFLAGS-gethstbyad_r.c): Likewise.
+	(CFLAGS-gethstbynm_r.c, CFLAGS-gethstbynm2_r.c): Likewise.
+	(CFLAGS-getsrvbynm_r.c, CFLAGS-getsrvbypt_r.c): Variables removed.
+	* grp/Makefile (CFLAGS-getgrgid_r.c): Remove -DUSE_NSCD.
+	(CFLAGS-getgrnam_r.c): Likewise.
+	(CFLAGS-initgroups.c): Likewise.
+	* posix/Makefile (CFLAGS-getaddrinfo.c): Remove -DUSE_NSCD.
+	* pwd/Makefile (CFLAGS-getpwuid_r.c, CFLAGS-getpwnam_r.c):
+	Variables removed.
+	* inet/getnetgrent_r.c
+	(nscd_setnetgrent): New function, broken out of ...
+	(setnetgrent): ... here.  Call it.
+	(innetgr): Conditionalize nscd bits on [USE_NSCD].
+	(nscd_getnetgrent): Conditionalize on [USE_NSCD].
+	(__internal_getnetgrent_r): Conditionalize its use on [USE_NSCD].
+	* nscd/Makefile (routines, aux): Move definitions after include of
+	Makeconfig.  Conditionalize on [$(use-nscd) != no].
+	* nss/nsswitch.c (nss_load_all_libraries, __nss_disable_nscd):
+	Conditionalize on [USE_NSCD].
+	(is_nscd, nscd_init_cb): Likewise.
+	(nss_load_library): Conditionalize init callback on [USE_NSCD].
+	* nss/nss_files/files-init.c: Conditionalize body on [USE_NSCD].
+	* nss/nss_db/db-init.c: Likewise.
+	* nscd/nscd.c (main): Conditionalize __nss_disable_nscd call on
+	[USE_NSCD].
+	* sysdeps/unix/sysv/linux/check_pf.c (get_nl_timestamp): New function.
+	(make_request): Use it.
+	(cache_valid_p): New function.
+	(__check_pf): Use it.
+	* NEWS: Add item for --disable-nscd.
+
+2012-08-22  Dmitry V. Levin  <ldv@xxxxxxxxxxxx>
+
+	* configure.in (SED): Update AC_CHECK_PROG_VER's version extract regexp
+	to support sed >= 4.2.1-20-ga9bf076.
+	* configure: Regenerated.
+
+2012-08-22  Roland McGrath  <roland@xxxxxxxxxxxxx>
+
+	* csu/libc-start.c (apply_irel): Move extern declarations inside here.
+	Conditionalize whole body on [IREL].
+
+2012-08-22  Jeff Law <law@xxxxxxxxxx>
+
+	[BZ #14505]
+	* sysdeps/posix/getaddrinfo.c (gaih_inet): Only use gethostbyname4_r
+	if the family is PF_UNSPEC.
+
+2012-08-22  Mike Frysinger  <vapier@xxxxxxxxxx>
+
+	* Makerules (lib-version): Rename from V.
+	(install-lib-nosubdir): Change V to lib-version.
+
+2012-08-22  Will Schmidt  <will_schmidt@xxxxxxxxxxxx>
+
+	[BZ #14252]
+	* powerpc32/power6/wcschr.c: New file.
+	* powerpc32/power6/wcscpy.c: New file.
+	* powerpc32/power6/wcsrchr.c: New file.
+	* powerpc64/power6/wcschr.c: New file.
+	* powerpc64/power6/wcscpy.c: New file.
+	* powerpc64/power6/wcsrchr.c: New file.
+
+2012-08-21  Maxim Kuvyrkov  <maxim@xxxxxxxxxxxxxxxx>
+
+	* string/str-two-way.h (AVAILABLE1_USES_J): New macro, define default.
+	(two_way_short_needle): Use it.
+	* string/strstr.c (AVAILABLE1_USES_J): Define.
+	* string/strcasestr.c: Likewise.
+
+	* string/str-two-way.h (two_way_short_needle): Use pointers instead of
+	array references.
+	* string/strcasestr.c (TOLOWER): Make side-effect safe.
+
+	[BZ #11607]
+	* NEWS: Add an entry.
+	* string/str-two-way.h (AVAILABLE1, AVAILABLE2, RET0_IF_0): New macros,
+	define their defaults.
+	(two_way_short_needle): Detect end-of-string on-the-fly.
+	* string/strcasestr.c, string/strstr.c (AVAILABLE): Update.
+	(AVAILABLE1, AVAILABLE2, RET0_IF_0, AVAILABLE_USES_J): Define.
+	* string/bug-strcasestr1.c: New test.
+	* string/Makefile: Run it.
+
+2012-08-21  Maxim Kuvyrkov  <maxim@xxxxxxxxxxxxxxxx>
+
+	[BZ #11607]
+	* string/str-two-way.h (two_way_short_needle): Optimize matching of
+	the first character.
+
 2012-08-21  Roland McGrath  <roland@xxxxxxxxxxxxx>
 
 	* csu/elf-init.c (__libc_csu_irel): Function removed.
@@ -332,8 +478,8 @@
 2012-08-15  Liubov Dmitrieva  <liubov.dmitrieva@xxxxxxxxx>
 
 	[BZ #14195]
-        * sysdeps/i386/i686/multiarch/strcmp-sssse3.S: Fix
-        segmentation fault for a case of two empty input strings.
+	* sysdeps/i386/i686/multiarch/strcmp-sssse3.S: Fix
+	segmentation fault for a case of two empty input strings.
 	* string/test-strncasecmp.c (check1): Renamed to...
 	(bz12205): ...this.
 	(bz14195): Add new testcase for two empty input strings and N > 0.

Modified: fsf/trunk/libc/Makerules
==============================================================================
--- fsf/trunk/libc/Makerules (original)
+++ fsf/trunk/libc/Makerules Thu Aug 23 00:02:12 2012
@@ -841,11 +841,11 @@
 #	$(inst_libdir)/libfoo.so	-- for linking, symlink or ld script
 #	$(inst_slibdir)/libfoo.so.NN	-- for loading by SONAME, symlink
 #	$(inst_slibdir)/libfoo-X.Y.Z.so -- the real shared object file
-V := $(firstword $($(subdir)-version) $(version))
+lib-version := $(firstword $($(subdir)-version) $(version))
 install-lib-nosubdir: $(install-lib.so-unversioned:%=$(inst_slibdir)/%) \
 		      $(foreach L,$(install-lib.so-versioned),\
 				$(inst_libdir)/$L \
-				$(inst_slibdir)/$(L:.so=)-$V.so \
+				$(inst_slibdir)/$(L:.so=)-$(lib-version).so \
 				$(inst_slibdir)/$L$($L-version))
 
 # Install all the unversioned shared libraries.

Modified: fsf/trunk/libc/NEWS
==============================================================================
--- fsf/trunk/libc/NEWS (original)
+++ fsf/trunk/libc/NEWS Thu Aug 23 00:02:12 2012
@@ -9,9 +9,9 @@
 
 * The following bugs are resolved with this release:
 
-  6778, 6808, 9685, 13717, 13939, 14042, 14090, 14166, 14150, 14151, 14154,
-  14157, 14166, 14173, 14195, 14283, 14298, 14303, 14307, 14328, 14331,
-  14336, 14337, 14347, 14349
+  6778, 6808, 9685, 11607, 13717, 13696, 13939, 14042, 14090, 14166, 14150,
+  14151, 14154, 14157, 14166, 14173, 14195, 14252, 14283, 14298, 14303,
+  14307, 14328, 14331, 14336, 14337, 14347, 14349, 14505
 
 * Support for STT_GNU_IFUNC symbols added for s390 and s390x.
   Optimized versions of memcpy, memset, and memcmp added for System z10 and
@@ -25,8 +25,19 @@
 * SystemTap static probes have been added into the dynamic linker.
   Implemented by Gary Benson.
 
+* Optimizations of string functions strstr, strcasestr and memmem.
+  Implemented by Maxim Kuvyrkov.
+
 * The minimum Linux kernel version that this version of the GNU C Library
   can be used with is 2.6.16.
+
+* Optimizations of string functions memchr, wcschr, wcscpy, and wcsrchr for
+  powerpc POWER7.  Implemented by Will Schmidt.
+
+* New configure option --disable-nscd builds the C library such that it
+  never attempts to contact the Name Service Caching Daemon (nscd).
+  New configure option --disable-build-nscd avoids building nscd itself;
+  this is the default if --disable-nscd is used.
 
 
 Version 2.16

Modified: fsf/trunk/libc/config.h.in
==============================================================================
--- fsf/trunk/libc/config.h.in (original)
+++ fsf/trunk/libc/config.h.in Thu Aug 23 00:02:12 2012
@@ -173,6 +173,9 @@
 
 /* Define if Systemtap <sys/sdt.h> probes should be defined.  */
 #undef USE_STAP_PROBE
+
+/* Define if library functions should try to contact the nscd daemon.  */
+#undef USE_NSCD
 
 /*
  */

Modified: fsf/trunk/libc/config.make.in
==============================================================================
--- fsf/trunk/libc/config.make.in (original)
+++ fsf/trunk/libc/config.make.in Thu Aug 23 00:02:12 2012
@@ -100,6 +100,8 @@
 cross-compiling = @cross_compiling@
 force-install = @force_install@
 link-obsolete-rpc = @link_obsolete_rpc@
+build-nscd = @build_nscd@
+use-nscd = @use_nscd@
 
 # Build tools.
 CC = @CC@

Modified: fsf/trunk/libc/configure
==============================================================================
--- fsf/trunk/libc/configure (original)
+++ fsf/trunk/libc/configure Thu Aug 23 00:02:12 2012
@@ -597,6 +597,7 @@
 libc_cv_localedir
 libc_cv_slibdir
 old_glibc_headers
+use_nscd
 libc_cv_gcc_unwind_find_fde
 libc_extra_cflags
 CPPUNDEFS
@@ -654,6 +655,7 @@
 base_machine
 add_on_subdirs
 add_ons
+build_nscd
 link_obsolete_rpc
 libc_cv_nss_crypt
 all_warnings
@@ -750,6 +752,8 @@
 enable_nss_crypt
 enable_obsolete_rpc
 enable_systemtap
+enable_build_nscd
+enable_nscd
 with_cpu
 '
       ac_precious_vars='build_alias
@@ -1408,6 +1412,8 @@
   --enable-obsolete-rpc   build and install the obsolete RPC code for
                           link-time usage
   --enable-systemtap      enable systemtap static probe points [default=no]
+  --disable-build-nscd    disable building and installing the nscd daemon
+  --disable-nscd          library functions will not contact the nscd daemon
 
 Optional Packages:
   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
@@ -3752,6 +3758,24 @@
 See \`config.log' for more details" "$LINENO" 5; }
   fi
 fi
+
+# Check whether --enable-build-nscd was given.
+if test "${enable_build_nscd+set}" = set; then :
+  enableval=$enable_build_nscd; build_nscd=$enableval
+else
+  build_nscd=default
+fi
+
+
+
+# Note the use of $use_nscd is near the bottom of the file.
+# Check whether --enable-nscd was given.
+if test "${enable_nscd+set}" = set; then :
+  enableval=$enable_nscd; use_nscd=$enableval
+else
+  use_nscd=yes
+fi
+
 
 # The way shlib-versions is used to generate soversions.mk uses a
 # fairly simplistic model for name recognition that can't distinguish
@@ -4963,7 +4987,7 @@
   # Found it, now check the version.
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking version of $SED" >&5
 $as_echo_n "checking version of $SED... " >&6; }
-  ac_prog_version=`$SED --version 2>&1 | sed -n 's/^.*GNU sed version \([0-9]*\.[0-9.]*\).*$/\1/p'`
+  ac_prog_version=`$SED --version 2>&1 | sed -n 's/^.*GNU sed[^0-9]* \([0-9]*\.[0-9.]*\).*$/\1/p'`
   case $ac_prog_version in
     '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
     3.0[2-9]*|3.[1-9]*|[4-9]*)
@@ -7403,6 +7427,17 @@
 
 fi
 
+
+# This is far from the AC_ARG_ENABLE that sets it so that a sysdeps
+# configure fragment can override the value to prevent this AC_DEFINE.
+
+if test "x$use_nscd" != xno; then
+  $as_echo "#define USE_NSCD 1" >>confdefs.h
+
+fi
+if test "x$build_nscd" = xdefault; then
+  build_nscd=$use_nscd
+fi
 
 # Test for old glibc 2.0.x headers so that they can be removed properly
 # Search only in includedir.

Modified: fsf/trunk/libc/configure.in
==============================================================================
--- fsf/trunk/libc/configure.in (original)
+++ fsf/trunk/libc/configure.in Thu Aug 23 00:02:12 2012
@@ -292,6 +292,20 @@
     AC_MSG_FAILURE([systemtap support needs sys/sdt.h with asm support])
   fi
 fi
+
+AC_ARG_ENABLE([build-nscd],
+	      [AS_HELP_STRING([--disable-build-nscd],
+	       [disable building and installing the nscd daemon])],
+	      [build_nscd=$enableval],
+	      [build_nscd=default])
+AC_SUBST(build_nscd)
+
+# Note the use of $use_nscd is near the bottom of the file.
+AC_ARG_ENABLE([nscd],
+	      [AS_HELP_STRING([--disable-nscd],
+	       [library functions will not contact the nscd daemon])],
+	      [use_nscd=$enableval],
+	      [use_nscd=yes])
 
 # The way shlib-versions is used to generate soversions.mk uses a
 # fairly simplistic model for name recognition that can't distinguish
@@ -909,7 +923,7 @@
   [4.[5-9]*|4.[1-9][0-9]*|[5-9].*],
   MAKEINFO=: aux_missing="$aux_missing makeinfo")
 AC_CHECK_PROG_VER(SED, sed, --version,
-  [GNU sed version \([0-9]*\.[0-9.]*\)],
+  [GNU sed[^0-9]* \([0-9]*\.[0-9.]*\)],
   [3.0[2-9]*|3.[1-9]*|[4-9]*],
   SED=: aux_missing="$aux_missing sed")
 
@@ -2099,6 +2113,16 @@
 fi
 AC_SUBST(libc_cv_gcc_unwind_find_fde)
 
+# This is far from the AC_ARG_ENABLE that sets it so that a sysdeps
+# configure fragment can override the value to prevent this AC_DEFINE.
+AC_SUBST(use_nscd)
+if test "x$use_nscd" != xno; then
+  AC_DEFINE([USE_NSCD])
+fi
+if test "x$build_nscd" = xdefault; then
+  build_nscd=$use_nscd
+fi
+
 # Test for old glibc 2.0.x headers so that they can be removed properly
 # Search only in includedir.
 AC_MSG_CHECKING(for old glibc 2.0.x headers)

Modified: fsf/trunk/libc/csu/libc-start.c
==============================================================================
--- fsf/trunk/libc/csu/libc-start.c (original)
+++ fsf/trunk/libc/csu/libc-start.c Thu Aug 23 00:02:12 2012
@@ -62,18 +62,19 @@
 #  define IREL		elf_irel
 # endif
 
-/* We use weak references for these so that we'll still work with a linker
-   that doesn't define them.  Such a linker doesn't support IFUNC at all
-   and so uses won't work, but a statically-linked program that doesn't
-   use any IFUNC symbols won't have a problem.  */
-extern const IREL_T IPLT_START[] __attribute__ ((weak));
-extern const IREL_T IPLT_END[] __attribute__ ((weak));
-
 static void
 apply_irel (void)
 {
+# ifdef IREL
+  /* We use weak references for these so that we'll still work with a linker
+     that doesn't define them.  Such a linker doesn't support IFUNC at all
+     and so uses won't work, but a statically-linked program that doesn't
+     use any IFUNC symbols won't have a problem.  */
+  extern const IREL_T IPLT_START[] __attribute__ ((weak));
+  extern const IREL_T IPLT_END[] __attribute__ ((weak));
   for (const IREL_T *ipltent = IPLT_START; ipltent < IPLT_END; ++ipltent)
     IREL (ipltent);
+# endif
 }
 #endif
 

Modified: fsf/trunk/libc/grp/Makefile
==============================================================================
--- fsf/trunk/libc/grp/Makefile (original)
+++ fsf/trunk/libc/grp/Makefile Thu Aug 23 00:02:12 2012
@@ -38,14 +38,14 @@
 
 ifeq ($(have-thread-library),yes)
 
-CFLAGS-getgrgid_r.c = -DUSE_NSCD=1 -fexceptions
-CFLAGS-getgrnam_r.c = -DUSE_NSCD=1 -fexceptions
+CFLAGS-getgrgid_r.c = -fexceptions
+CFLAGS-getgrnam_r.c = -fexceptions
 CFLAGS-getgrent_r.c = -fexceptions
 CFLAGS-getgrent.c = -fexceptions
 CFLAGS-fgetgrent.c = -fexceptions
 CFLAGS-fgetgrent_r.c = -fexceptions $(libio-mtsafe)
 CFLAGS-putgrent.c = -fexceptions $(libio-mtsafe)
-CFLAGS-initgroups.c = -DUSE_NSCD=1 -fexceptions
+CFLAGS-initgroups.c = -fexceptions
 CFLAGS-getgrgid.c = -fexceptions
 
 endif

Modified: fsf/trunk/libc/gshadow/getsgent.c
==============================================================================
--- fsf/trunk/libc/gshadow/getsgent.c (original)
+++ fsf/trunk/libc/gshadow/getsgent.c Thu Aug 23 00:02:12 2012
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009 Free Software Foundation, Inc.
+/* Copyright (C) 2009-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 2009.
 
@@ -26,4 +26,7 @@
 #define DATABASE_NAME	gshadow
 #define BUFLEN		1024
 
+/* There is no nscd support for the shadow file.  */
+#undef	USE_NSCD
+
 #include "../nss/getXXent.c"

Modified: fsf/trunk/libc/gshadow/getsgent_r.c
==============================================================================
--- fsf/trunk/libc/gshadow/getsgent_r.c (original)
+++ fsf/trunk/libc/gshadow/getsgent_r.c Thu Aug 23 00:02:12 2012
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009 Free Software Foundation, Inc.
+/* Copyright (C) 2009-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 2009.
 
@@ -27,4 +27,7 @@
 #define BUFLEN			1024
 #define NO_COMPAT_NEEDED	1
 
+/* There is no nscd support for the shadow file.  */
+#undef	USE_NSCD
+
 #include "../nss/getXXent_r.c"

Modified: fsf/trunk/libc/gshadow/getsgnam.c
==============================================================================
--- fsf/trunk/libc/gshadow/getsgnam.c (original)
+++ fsf/trunk/libc/gshadow/getsgnam.c Thu Aug 23 00:02:12 2012
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009 Free Software Foundation, Inc.
+/* Copyright (C) 2009-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 2009.
 
@@ -26,4 +26,7 @@
 #define ADD_VARIABLES	name
 #define BUFLEN		1024
 
+/* There is no nscd support for the shadow file.  */
+#undef	USE_NSCD
+
 #include "../nss/getXXbyYY.c"

Modified: fsf/trunk/libc/gshadow/getsgnam_r.c
==============================================================================
--- fsf/trunk/libc/gshadow/getsgnam_r.c (original)
+++ fsf/trunk/libc/gshadow/getsgnam_r.c Thu Aug 23 00:02:12 2012
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009 Free Software Foundation, Inc.
+/* Copyright (C) 2009-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 2009.
 
@@ -27,4 +27,7 @@
 #define BUFLEN			1024
 #define NO_COMPAT_NEEDED	1
 
+/* There is no nscd support for the shadow file.  */
+#undef	USE_NSCD
+
 #include "../nss/getXXbyYY_r.c"

Modified: fsf/trunk/libc/inet/Makefile
==============================================================================
--- fsf/trunk/libc/inet/Makefile (original)
+++ fsf/trunk/libc/inet/Makefile Thu Aug 23 00:02:12 2012
@@ -56,11 +56,11 @@
 
 ifeq ($(have-thread-library),yes)
 
-CFLAGS-gethstbyad_r.c = -DUSE_NSCD=1 -fexceptions
+CFLAGS-gethstbyad_r.c = -fexceptions
 CFLAGS-gethstbyad.c = -fexceptions
-CFLAGS-gethstbynm_r.c = -DUSE_NSCD=1 -fexceptions
+CFLAGS-gethstbynm_r.c = -fexceptions
 CFLAGS-gethstbynm.c = -fexceptions
-CFLAGS-gethstbynm2_r.c = -DUSE_NSCD=1 -fexceptions
+CFLAGS-gethstbynm2_r.c = -fexceptions
 CFLAGS-gethstbynm2.c = -fexceptions
 CFLAGS-gethstent_r.c = -fexceptions
 CFLAGS-gethstent.c = -fexceptions
@@ -77,8 +77,6 @@
 CFLAGS-getrpcent.c = -fexceptions
 CFLAGS-getservent_r.c = -fexceptions
 CFLAGS-getservent.c = -fexceptions
-CFLAGS-getsrvbynm_r.c = -DUSE_NSCD=1
-CFLAGS-getsrvbypt_r.c = -DUSE_NSCD=1
 CFLAGS-getprtent_r.c = -fexceptions
 CFLAGS-getprtent.c = -fexceptions
 CFLAGS-either_ntoh.c = -fexceptions

Modified: fsf/trunk/libc/inet/getaliasent.c
==============================================================================
--- fsf/trunk/libc/inet/getaliasent.c (original)
+++ fsf/trunk/libc/inet/getaliasent.c Thu Aug 23 00:02:12 2012
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -22,4 +22,7 @@
 #define	GETFUNC_NAME	getaliasent
 #define BUFLEN		1024
 
+/* There is no nscd support for the aliases file.  */
+#undef	USE_NSCD
+
 #include "../nss/getXXent.c"

Modified: fsf/trunk/libc/inet/getaliasent_r.c
==============================================================================
--- fsf/trunk/libc/inet/getaliasent_r.c (original)
+++ fsf/trunk/libc/inet/getaliasent_r.c Thu Aug 23 00:02:12 2012
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 2002 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 1996.
 
@@ -25,4 +25,7 @@
 #define	ENDFUNC_NAME		endaliasent
 #define DATABASE_NAME		aliases
 
+/* There is no nscd support for the aliases file.  */
+#undef	USE_NSCD
+
 #include "../nss/getXXent_r.c"

Modified: fsf/trunk/libc/inet/getaliasname.c
==============================================================================
--- fsf/trunk/libc/inet/getaliasname.c (original)
+++ fsf/trunk/libc/inet/getaliasname.c Thu Aug 23 00:02:12 2012
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 1996.
 
@@ -26,4 +26,7 @@
 #define ADD_VARIABLES	name
 #define BUFLEN		1024
 
+/* There is no nscd support for the aliases file.  */
+#undef	USE_NSCD
+
 #include "../nss/getXXbyYY.c"

Modified: fsf/trunk/libc/inet/getaliasname_r.c
==============================================================================
--- fsf/trunk/libc/inet/getaliasname_r.c (original)
+++ fsf/trunk/libc/inet/getaliasname_r.c Thu Aug 23 00:02:12 2012
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 2002 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 1996.
 
@@ -25,4 +25,7 @@
 #define ADD_PARAMS		const char *name
 #define ADD_VARIABLES		name
 
+/* There is no nscd support for the aliases file.  */
+#undef	USE_NSCD
+
 #include "../nss/getXXbyYY_r.c"

Modified: fsf/trunk/libc/inet/getnetbyad.c
==============================================================================
--- fsf/trunk/libc/inet/getnetbyad.c (original)
+++ fsf/trunk/libc/inet/getnetbyad.c Thu Aug 23 00:02:12 2012
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 1997, 2000 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 1996.
 
@@ -28,4 +28,7 @@
 #define BUFLEN		1024
 #define NEED_H_ERRNO	1
 
+/* There is no nscd support for the networks file.  */
+#undef	USE_NSCD
+
 #include "../nss/getXXbyYY.c"

Modified: fsf/trunk/libc/inet/getnetbyad_r.c
==============================================================================
--- fsf/trunk/libc/inet/getnetbyad_r.c (original)
+++ fsf/trunk/libc/inet/getnetbyad_r.c Thu Aug 23 00:02:12 2012
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 1997, 2000, 2002 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 1996.
 
@@ -28,4 +28,7 @@
 #define NEED__RES		1
 #define NEED_H_ERRNO		1
 
+/* There is no nscd support for the networks file.  */
+#undef	USE_NSCD
+
 #include "../nss/getXXbyYY_r.c"

Modified: fsf/trunk/libc/inet/getnetbynm.c
==============================================================================
--- fsf/trunk/libc/inet/getnetbynm.c (original)
+++ fsf/trunk/libc/inet/getnetbynm.c Thu Aug 23 00:02:12 2012
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 1996.
 
@@ -27,4 +27,7 @@
 #define BUFLEN		1024
 #define NEED_H_ERRNO	1
 
+/* There is no nscd support for the networks file.  */
+#undef	USE_NSCD
+
 #include "../nss/getXXbyYY.c"

Modified: fsf/trunk/libc/inet/getnetbynm_r.c
==============================================================================
--- fsf/trunk/libc/inet/getnetbynm_r.c (original)
+++ fsf/trunk/libc/inet/getnetbynm_r.c Thu Aug 23 00:02:12 2012
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 1997, 2002 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 1996.
 
@@ -27,4 +27,7 @@
 #define NEED__RES		1
 #define NEED_H_ERRNO		1
 
+/* There is no nscd support for the networks file.  */
+#undef	USE_NSCD
+
 #include "../nss/getXXbyYY_r.c"

Modified: fsf/trunk/libc/inet/getnetent.c
==============================================================================
--- fsf/trunk/libc/inet/getnetent.c (original)
+++ fsf/trunk/libc/inet/getnetent.c Thu Aug 23 00:02:12 2012
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -23,4 +23,7 @@
 #define BUFLEN		1024
 #define NEED_H_ERRNO	1
 
+/* There is no nscd support for the networks file.  */
+#undef	USE_NSCD
+
 #include "../nss/getXXent.c"

Modified: fsf/trunk/libc/inet/getnetent_r.c
==============================================================================
--- fsf/trunk/libc/inet/getnetent_r.c (original)
+++ fsf/trunk/libc/inet/getnetent_r.c Thu Aug 23 00:02:12 2012
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 1997, 2002 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -28,4 +28,7 @@
 #define NEED__RES		1
 #define NEED_H_ERRNO		1
 
+/* There is no nscd support for the networks file.  */
+#undef	USE_NSCD
+
 #include "../nss/getXXent_r.c"

Modified: fsf/trunk/libc/inet/getnetgrent_r.c
==============================================================================
--- fsf/trunk/libc/inet/getnetgrent_r.c (original)
+++ fsf/trunk/libc/inet/getnetgrent_r.c Thu Aug 23 00:02:12 2012
@@ -182,28 +182,32 @@
 }
 libc_hidden_def (__internal_setnetgrent)
 
-int
-setnetgrent (const char *group)
-{
-  int result;
-
-  __libc_lock_lock (lock);
-
+static int
+nscd_setnetgrent (const char *group)
+{
+#ifdef USE_NSCD
   if (__nss_not_use_nscd_netgroup > 0
       && ++__nss_not_use_nscd_netgroup > NSS_NSCD_RETRY)
     __nss_not_use_nscd_netgroup = 0;
 
   if (!__nss_not_use_nscd_netgroup
       && !__nss_database_custom[NSS_DBSIDX_netgroup])
-    {
-      result = __nscd_setnetgrent (group, &dataset);
-      if (result >= 0)
-	goto out;
-    }
-
-  result = __internal_setnetgrent (group, &dataset);
-
- out:
+    return __nscd_setnetgrent (group, &dataset);
+#endif
+  return -1;
+}
+
+int
+setnetgrent (const char *group)
+{
+  int result;
+
+  __libc_lock_lock (lock);
+
+  result = nscd_setnetgrent (group);
+  if (result < 0)
+    result = __internal_setnetgrent (group, &dataset);
+
   __libc_lock_unlock (lock);
 
   return result;
@@ -230,7 +234,7 @@
   __libc_lock_unlock (lock);
 }
 
-
+#ifdef USE_NSCD
 static enum nss_status
 nscd_getnetgrent (struct __netgrent *datap, char *buffer, size_t buflen,
 		  int *errnop)
@@ -248,7 +252,7 @@
 
   return NSS_STATUS_SUCCESS;
 }
-
+#endif
 
 int
 internal_function
@@ -267,9 +271,14 @@
   int no_more = datap->nip == NULL;
   if (! no_more)
     {
+#ifdef USE_NSCD
+      /* This bogus function pointer is a special marker left by
+         __nscd_setnetgrent to tell us to use the data it left
+         before considering any modules.  */
       if (datap->nip == (service_user *) -1l)
 	fct = nscd_getnetgrent;
       else
+#endif
 	{
 	  fct = __nss_lookup_function (datap->nip, "getnetgrent_r");
 	  no_more = fct == NULL;
@@ -375,6 +384,7 @@
 innetgr (const char *netgroup, const char *host, const char *user,
 	 const char *domain)
 {
+#ifdef USE_NSCD
   if (__nss_not_use_nscd_netgroup > 0
       && ++__nss_not_use_nscd_netgroup > NSS_NSCD_RETRY)
     __nss_not_use_nscd_netgroup = 0;
@@ -386,6 +396,7 @@
       if (result >= 0)
 	return result;
     }
+#endif
 
   union
   {

Modified: fsf/trunk/libc/inet/getproto.c
==============================================================================
--- fsf/trunk/libc/inet/getproto.c (original)
+++ fsf/trunk/libc/inet/getproto.c Thu Aug 23 00:02:12 2012
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 1996.
 
@@ -26,4 +26,7 @@
 #define ADD_VARIABLES	proto
 #define BUFLEN		1024
 
+/* There is no nscd support for the protocols file.  */
+#undef	USE_NSCD
+
 #include "../nss/getXXbyYY.c"

Modified: fsf/trunk/libc/inet/getproto_r.c
==============================================================================
--- fsf/trunk/libc/inet/getproto_r.c (original)
+++ fsf/trunk/libc/inet/getproto_r.c Thu Aug 23 00:02:12 2012
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 1997, 2002 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 1996.
 
@@ -25,4 +25,7 @@
 #define ADD_PARAMS		int proto
 #define ADD_VARIABLES		proto
 
+/* There is no nscd support for the protocols file.  */
+#undef	USE_NSCD
+
 #include "../nss/getXXbyYY_r.c"

Modified: fsf/trunk/libc/inet/getprtent.c
==============================================================================
--- fsf/trunk/libc/inet/getprtent.c (original)
+++ fsf/trunk/libc/inet/getprtent.c Thu Aug 23 00:02:12 2012
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -22,4 +22,7 @@
 #define	GETFUNC_NAME	getprotoent
 #define BUFLEN		1024
 
+/* There is no nscd support for the protocols file.  */
+#undef	USE_NSCD
+
 #include "../nss/getXXent.c"

Modified: fsf/trunk/libc/inet/getprtent_r.c
==============================================================================
--- fsf/trunk/libc/inet/getprtent_r.c (original)
+++ fsf/trunk/libc/inet/getprtent_r.c Thu Aug 23 00:02:12 2012
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 1997, 2002 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -26,4 +26,7 @@
 #define STAYOPEN		int stayopen
 #define STAYOPEN_VAR		stayopen
 
+/* There is no nscd support for the protocols file.  */
+#undef	USE_NSCD
+
 #include "../nss/getXXent_r.c"

Modified: fsf/trunk/libc/inet/getprtname.c
==============================================================================
--- fsf/trunk/libc/inet/getprtname.c (original)
+++ fsf/trunk/libc/inet/getprtname.c Thu Aug 23 00:02:12 2012
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 1996.
 
@@ -26,4 +26,7 @@
 #define ADD_VARIABLES	name
 #define BUFLEN		1024
 
+/* There is no nscd support for the protocols file.  */
+#undef	USE_NSCD
+
 #include "../nss/getXXbyYY.c"

Modified: fsf/trunk/libc/inet/getprtname_r.c
==============================================================================
--- fsf/trunk/libc/inet/getprtname_r.c (original)
+++ fsf/trunk/libc/inet/getprtname_r.c Thu Aug 23 00:02:12 2012
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 2002 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 1996.
 
@@ -25,4 +25,7 @@
 #define ADD_PARAMS		const char *name
 #define ADD_VARIABLES		name
 
+/* There is no nscd support for the protocols file.  */
+#undef	USE_NSCD
+
 #include "../nss/getXXbyYY_r.c"

Modified: fsf/trunk/libc/inet/getrpcbyname.c
==============================================================================
--- fsf/trunk/libc/inet/getrpcbyname.c (original)
+++ fsf/trunk/libc/inet/getrpcbyname.c Thu Aug 23 00:02:12 2012
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 1996.
 
@@ -26,4 +26,7 @@
 #define ADD_VARIABLES	name
 #define BUFLEN		1024
 
+/* There is no nscd support for the rpc file.  */
+#undef	USE_NSCD
+
 #include "../nss/getXXbyYY.c"

Modified: fsf/trunk/libc/inet/getrpcbyname_r.c
==============================================================================
--- fsf/trunk/libc/inet/getrpcbyname_r.c (original)
+++ fsf/trunk/libc/inet/getrpcbyname_r.c Thu Aug 23 00:02:12 2012
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 1997, 2002 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 1996.
 
@@ -25,4 +25,7 @@
 #define ADD_PARAMS		const char *name
 #define ADD_VARIABLES		name
 
+/* There is no nscd support for the rpc file.  */
+#undef	USE_NSCD
+
 #include "../nss/getXXbyYY_r.c"

Modified: fsf/trunk/libc/inet/getrpcbynumber.c
==============================================================================
--- fsf/trunk/libc/inet/getrpcbynumber.c (original)
+++ fsf/trunk/libc/inet/getrpcbynumber.c Thu Aug 23 00:02:12 2012
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 1996.
 
@@ -26,4 +26,7 @@
 #define ADD_VARIABLES	number
 #define BUFLEN		1024
 
+/* There is no nscd support for the rpc file.  */
+#undef	USE_NSCD
+
 #include "../nss/getXXbyYY.c"

Modified: fsf/trunk/libc/inet/getrpcbynumber_r.c
==============================================================================
--- fsf/trunk/libc/inet/getrpcbynumber_r.c (original)
+++ fsf/trunk/libc/inet/getrpcbynumber_r.c Thu Aug 23 00:02:12 2012
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 1997, 2002 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 1996.
 
@@ -25,4 +25,7 @@
 #define ADD_PARAMS		int number
 #define ADD_VARIABLES		number
 
+/* There is no nscd support for the rpc file.  */
+#undef	USE_NSCD
+
 #include "../nss/getXXbyYY_r.c"

Modified: fsf/trunk/libc/inet/getrpcent.c
==============================================================================
--- fsf/trunk/libc/inet/getrpcent.c (original)
+++ fsf/trunk/libc/inet/getrpcent.c Thu Aug 23 00:02:12 2012
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -22,4 +22,7 @@
 #define	GETFUNC_NAME	getrpcent
 #define BUFLEN		1024
 
+/* There is no nscd support for the rpc file.  */
+#undef	USE_NSCD
+
 #include "../nss/getXXent.c"

Modified: fsf/trunk/libc/inet/getrpcent_r.c
==============================================================================
--- fsf/trunk/libc/inet/getrpcent_r.c (original)
+++ fsf/trunk/libc/inet/getrpcent_r.c Thu Aug 23 00:02:12 2012
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 1997, 2002 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -26,4 +26,7 @@
 #define STAYOPEN		int stayopen
 #define STAYOPEN_VAR		stayopen
 
+/* There is no nscd support for the rpc file.  */
+#undef	USE_NSCD
+
 #include "../nss/getXXent_r.c"

Modified: fsf/trunk/libc/nscd/Makefile
==============================================================================
--- fsf/trunk/libc/nscd/Makefile (original)
+++ fsf/trunk/libc/nscd/Makefile Thu Aug 23 00:02:12 2012
@@ -20,11 +20,13 @@
 #
 subdir	:= nscd
 
+include ../Makeconfig
+
+ifneq ($(use-nscd),no)
 routines := nscd_getpw_r nscd_getgr_r nscd_gethst_r nscd_getai \
 	    nscd_initgroups nscd_getserv_r nscd_netgroup
 aux	:= nscd_helper
-
-include ../Makeconfig
+endif
 
 # To find xmalloc.c
 vpath %.c ../locale/programs
@@ -36,7 +38,7 @@
 		xmalloc xstrdup aicache initgrcache gai res_hconf \
 		netgroupcache
 
-ifeq ($(have-thread-library),yes)
+ifeq ($(build-nscd)$(have-thread-library),yesyes)
 
 others += nscd
 others-pie += nscd

Modified: fsf/trunk/libc/nscd/gai.c
==============================================================================
--- fsf/trunk/libc/nscd/gai.c (original)
+++ fsf/trunk/libc/nscd/gai.c Thu Aug 23 00:02:12 2012
@@ -32,6 +32,9 @@
 /* nscd uses 1MB or 2MB thread stacks.  */
 #define __libc_use_alloca(size) (size <= __MAX_ALLOCA_CUTOFF)
 
+/* We are nscd, so we don't want to be talking to ourselves.  */
+#undef  USE_NSCD
+
 #include <getaddrinfo.c>
 
 /* Support code.  */

Modified: fsf/trunk/libc/nscd/getgrgid_r.c
==============================================================================
--- fsf/trunk/libc/nscd/getgrgid_r.c (original)
+++ fsf/trunk/libc/nscd/getgrgid_r.c Thu Aug 23 00:02:12 2012
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 1997, 1998, 2005 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 1996.
 
@@ -25,4 +25,7 @@
 #define ADD_VARIABLES	gid
 #define BUFLEN		NSS_BUFLEN_GROUP
 
+/* We are nscd, so we don't want to be talking to ourselves.  */
+#undef	USE_NSCD
+
 #include <nss/getXXbyYY_r.c>

Modified: fsf/trunk/libc/nscd/getgrnam_r.c
==============================================================================
--- fsf/trunk/libc/nscd/getgrnam_r.c (original)
+++ fsf/trunk/libc/nscd/getgrnam_r.c Thu Aug 23 00:02:12 2012
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 1997, 1998, 2005 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 1996.
 
@@ -24,4 +24,7 @@
 #define ADD_PARAMS	const char *name
 #define ADD_VARIABLES	name
 
+/* We are nscd, so we don't want to be talking to ourselves.  */
+#undef	USE_NSCD
+
 #include <nss/getXXbyYY_r.c>

Modified: fsf/trunk/libc/nscd/gethstbyad_r.c
==============================================================================
--- fsf/trunk/libc/nscd/gethstbyad_r.c (original)
+++ fsf/trunk/libc/nscd/gethstbyad_r.c Thu Aug 23 00:02:12 2012
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2000, 2005, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 1996.
 
@@ -30,6 +30,9 @@
 #define NEED__RES	1
 #define NEED__RES_HCONF 1
 
+/* We are nscd, so we don't want to be talking to ourselves.  */
+#undef	USE_NSCD
+
 #include "../nss/getXXbyYY_r.c"
 
 

Modified: fsf/trunk/libc/nscd/gethstbynm3_r.c
==============================================================================
--- fsf/trunk/libc/nscd/gethstbynm3_r.c (original)
+++ fsf/trunk/libc/nscd/gethstbynm3_r.c Thu Aug 23 00:02:12 2012
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-1998, 2000, 2005, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 1996.
 
@@ -40,6 +40,9 @@
 
 #define __inet_aton inet_aton
 
+/* We are nscd, so we don't want to be talking to ourselves.  */
+#undef	USE_NSCD
+
 #include "../nss/getXXbyYY_r.c"
 
 

Modified: fsf/trunk/libc/nscd/getpwnam_r.c
==============================================================================
--- fsf/trunk/libc/nscd/getpwnam_r.c (original)
+++ fsf/trunk/libc/nscd/getpwnam_r.c Thu Aug 23 00:02:12 2012
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 1997, 1998, 2005 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 1996.
 
@@ -25,4 +25,7 @@
 #define ADD_VARIABLES	name
 #define BUFLEN		NSS_BUFLEN_PASSWD
 
+/* We are nscd, so we don't want to be talking to ourselves.  */
+#undef	USE_NSCD
+
 #include <nss/getXXbyYY_r.c>

Modified: fsf/trunk/libc/nscd/getpwuid_r.c
==============================================================================
--- fsf/trunk/libc/nscd/getpwuid_r.c (original)
+++ fsf/trunk/libc/nscd/getpwuid_r.c Thu Aug 23 00:02:12 2012
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 1997, 1998, 2005 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 1996.
 
@@ -25,4 +25,7 @@
 #define ADD_VARIABLES	uid
 #define BUFLEN		NSS_BUFLEN_PASSWD
 
+/* We are nscd, so we don't want to be talking to ourselves.  */
+#undef	USE_NSCD
+
 #include <nss/getXXbyYY_r.c>

Modified: fsf/trunk/libc/nscd/getsrvbynm_r.c
==============================================================================
--- fsf/trunk/libc/nscd/getsrvbynm_r.c (original)
+++ fsf/trunk/libc/nscd/getsrvbynm_r.c Thu Aug 23 00:02:12 2012
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 1997, 2002, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 1996.
 
@@ -24,4 +24,7 @@
 #define ADD_PARAMS		const char *name, const char *proto
 #define ADD_VARIABLES		name, proto
 
+/* We are nscd, so we don't want to be talking to ourselves.  */
+#undef	USE_NSCD
+
 #include "../nss/getXXbyYY_r.c"

Modified: fsf/trunk/libc/nscd/getsrvbypt_r.c
==============================================================================
--- fsf/trunk/libc/nscd/getsrvbypt_r.c (original)
+++ fsf/trunk/libc/nscd/getsrvbypt_r.c Thu Aug 23 00:02:12 2012
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 1997, 2002, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 1996.
 
@@ -24,4 +24,7 @@
 #define ADD_PARAMS		int port, const char *proto
 #define ADD_VARIABLES		port, proto
 
+/* We are nscd, so we don't want to be talking to ourselves.  */
+#undef	USE_NSCD
+
 #include "../nss/getXXbyYY_r.c"

Modified: fsf/trunk/libc/nscd/nscd.c
==============================================================================
--- fsf/trunk/libc/nscd/nscd.c (original)
+++ fsf/trunk/libc/nscd/nscd.c Thu Aug 23 00:02:12 2012
@@ -305,8 +305,10 @@
 # endif
 #endif
 
+#ifdef USE_NSCD
   /* Make sure we do not get recursive calls.  */
   __nss_disable_nscd (register_traced_file);
+#endif
 
   /* Init databases.  */
   nscd_init ();

Modified: fsf/trunk/libc/nss/nss_db/db-init.c
==============================================================================
--- fsf/trunk/libc/nss/nss_db/db-init.c (original)
+++ fsf/trunk/libc/nss/nss_db/db-init.c Thu Aug 23 00:02:12 2012
@@ -15,6 +15,8 @@
    You should have received a copy of the GNU Lesser General Public
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
+
+#ifdef USE_NSCD
 
 #include <paths.h>
 #include <nscd/nscd.h>
@@ -51,3 +53,5 @@
   strcpy (serv_traced_file.file.fname, _PATH_VARDB "services.db");
   cb (servdb, &serv_traced_file.file);
 }
+
+#endif

Modified: fsf/trunk/libc/nss/nss_files/files-init.c
==============================================================================
--- fsf/trunk/libc/nss/nss_files/files-init.c (original)
+++ fsf/trunk/libc/nss/nss_files/files-init.c Thu Aug 23 00:02:12 2012
@@ -1,5 +1,5 @@
 /* Initialization in nss_files module.
-   Copyright (C) 2011 Free Software Foundation, Inc.
+   Copyright (C) 2011-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -15,6 +15,8 @@
    You should have received a copy of the GNU Lesser General Public
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
+
+#ifdef USE_NSCD
 
 #include <nscd/nscd.h>
 
@@ -55,3 +57,5 @@
 
   cb (netgrdb, &netgr_traced_file.file);
 }
+
+#endif

Modified: fsf/trunk/libc/nss/nsswitch.c
==============================================================================
--- fsf/trunk/libc/nss/nsswitch.c (original)
+++ fsf/trunk/libc/nss/nsswitch.c Thu Aug 23 00:02:12 2012
@@ -92,10 +92,12 @@
 static name_database_entry *defconfig_entries;
 
 
+#ifdef USE_NSCD
 /* Nonzero if this is the nscd process.  */
 static bool is_nscd;
 /* The callback passed to the init functions when nscd is used.  */
 static void (*nscd_init_cb) (size_t, struct traced_file *);
+#endif
 
 
 /* -1 == database not found
@@ -358,6 +360,7 @@
 	  ni->library->lib_handle = (void *) -1l;
 	  __set_errno (saved_errno);
 	}
+# ifdef USE_NSCD
       else if (is_nscd)
 	{
 	  /* Call the init function when nscd is used.  */
@@ -377,12 +380,13 @@
 	  if (ifct != NULL)
 	    {
 	      void (*cb) (size_t, struct traced_file *) = nscd_init_cb;
-# ifdef PTR_DEMANGLE
+#  ifdef PTR_DEMANGLE
 	      PTR_DEMANGLE (cb);
-# endif
+#  endif
 	      ifct (cb);
 	    }
 	}
+# endif
     }
 
   return 0;
@@ -808,7 +812,7 @@
 }
 
 
-#ifdef SHARED
+#if defined SHARED && defined USE_NSCD
 /* Load all libraries for the service.  */
 static void
 nss_load_all_libraries (const char *service, const char *def)

Modified: fsf/trunk/libc/ports/ChangeLog.mips
==============================================================================
--- fsf/trunk/libc/ports/ChangeLog.mips (original)
+++ fsf/trunk/libc/ports/ChangeLog.mips Thu Aug 23 00:02:12 2012
@@ -1,3 +1,12 @@
+2012-08-22  Joseph Myers  <joseph@xxxxxxxxxxxxxxxx>
+
+	* sysdeps/unix/sysv/linux/mips/kernel-features.h [_MIPS_SIM ==
+	_ABIO32] (__ASSUME_STAT64_SYSCALL): Define.
+	* sysdeps/unix/sysv/linux/mips/mips64/fxstat64.c: New file.  Based
+	on version from ../sysdeps/unix/sysv/linux/.
+	* sysdeps/unix/sysv/linux/mips/mips64/lxstat64.c: Likewise.
+	* sysdeps/unix/sysv/linux/mips/mips64/xstat64.c: Likewise.
+
 2012-08-16  Carlos O'Donell  <carlos_odonell@xxxxxxxxxx>
 
 	* sysdeps/mips/ldsodefs.h (ARCH_PLTENTER_MEMBERS)

Modified: fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/mips/kernel-features.h
==============================================================================
--- fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/mips/kernel-features.h (original)
+++ fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/mips/kernel-features.h Thu Aug 23 00:02:12 2012
@@ -25,6 +25,12 @@
 /* MIPS had the utimes syscall by 2.6.0.  */
 #define __ASSUME_UTIMES		1
 
+/* MIPS o32 had the stat64 syscalls by 2.6.0, but for n32 and n64 the
+   plain stat syscalls are 64-bit.  */
+#if _MIPS_SIM == _ABIO32
+# define __ASSUME_STAT64_SYSCALL	1
+#endif
+
 /* Support for the eventfd2 and signalfd4 syscalls was added in 2.6.27.  */
 #if __LINUX_KERNEL_VERSION >= 0x02061c
 # define __ASSUME_EVENTFD2	1

Added: fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/mips/mips64/fxstat64.c
==============================================================================
--- fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/mips/mips64/fxstat64.c (added)
+++ fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/mips/mips64/fxstat64.c Thu Aug 23 00:02:12 2012
@@ -1,0 +1,45 @@
+/* fxstat64 using 64-bit MIPS fstat system call.
+   Copyright (C) 1997-2012 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <errno.h>
+#include <stddef.h>
+#include <sys/stat.h>
+#include <kernel_stat.h>
+
+#include <sysdep.h>
+#include <sys/syscall.h>
+#include <bp-checks.h>
+
+#include <xstatconv.h>
+
+/* Get information about the file FD in BUF.  */
+
+int
+__fxstat64 (int vers, int fd, struct stat64 *buf)
+{
+  int result;
+  struct kernel_stat kbuf;
+
+  result = INLINE_SYSCALL (fstat, 2, fd, __ptrvalue (&kbuf));
+  if (result == 0)
+    result = __xstat64_conv (vers, &kbuf, buf);
+
+  return result;
+}
+
+hidden_def (__fxstat64)

Added: fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/mips/mips64/lxstat64.c
==============================================================================
--- fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/mips/mips64/lxstat64.c (added)
+++ fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/mips/mips64/lxstat64.c Thu Aug 23 00:02:12 2012
@@ -1,0 +1,44 @@
+/* lxstat64 using 64-bit MIPS lstat system call.
+   Copyright (C) 1997-2012 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <errno.h>
+#include <stddef.h>
+#include <sys/stat.h>
+#include <kernel_stat.h>
+
+#include <sysdep.h>
+#include <sys/syscall.h>
+#include <bp-checks.h>
+
+#include <xstatconv.h>
+
+/* Get information about the file NAME in BUF.  */
+int
+__lxstat64 (int vers, const char *name, struct stat64 *buf)
+{
+  int result;
+  struct kernel_stat kbuf;
+
+  result = INLINE_SYSCALL (lstat, 2, CHECK_STRING (name), __ptrvalue (&kbuf));
+  if (result == 0)
+    result = __xstat64_conv (vers, &kbuf, buf);
+
+  return result;
+}
+
+hidden_def (__lxstat64)

Added: fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/mips/mips64/xstat64.c
==============================================================================
--- fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/mips/mips64/xstat64.c (added)
+++ fsf/trunk/libc/ports/sysdeps/unix/sysv/linux/mips/mips64/xstat64.c Thu Aug 23 00:02:12 2012
@@ -1,0 +1,45 @@
+/* xstat64 using 64-bit MIPS stat system call.
+   Copyright (C) 1991-2012 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <errno.h>
+#include <stddef.h>
+#include <sys/stat.h>
+#include <kernel_stat.h>
+
+#include <sysdep.h>
+#include <sys/syscall.h>
+#include <bp-checks.h>
+
+#include <xstatconv.h>
+
+/* Get information about the file NAME in BUF.  */
+
+int
+__xstat64 (int vers, const char *name, struct stat64 *buf)
+{
+  int result;
+  struct kernel_stat kbuf;
+
+  result = INLINE_SYSCALL (stat, 2, CHECK_STRING (name), __ptrvalue (&kbuf));
+  if (result == 0)
+    result = __xstat64_conv (vers, &kbuf, buf);
+
+  return result;
+}
+
+hidden_def (__xstat64)

Modified: fsf/trunk/libc/posix/Makefile
==============================================================================
--- fsf/trunk/libc/posix/Makefile (original)
+++ fsf/trunk/libc/posix/Makefile Thu Aug 23 00:02:12 2012
@@ -134,7 +134,7 @@
 	mv -f $@.new $@
 
 CFLAGS-regex.c = -Wno-strict-prototypes
-CFLAGS-getaddrinfo.c = -DRESOLVER -fexceptions -DUSE_NSCD
+CFLAGS-getaddrinfo.c = -DRESOLVER -fexceptions
 CFLAGS-pread.c = -fexceptions -fasynchronous-unwind-tables
 CFLAGS-pread64.c = -fexceptions -fasynchronous-unwind-tables
 CFLAGS-pwrite.c = -fexceptions -fasynchronous-unwind-tables

Modified: fsf/trunk/libc/pwd/Makefile
==============================================================================
--- fsf/trunk/libc/pwd/Makefile (original)
+++ fsf/trunk/libc/pwd/Makefile Thu Aug 23 00:02:12 2012
@@ -31,8 +31,6 @@
 
 ifeq ($(have-thread-library),yes)
 
-CFLAGS-getpwuid_r.c = -DUSE_NSCD=1
-CFLAGS-getpwnam_r.c = -DUSE_NSCD=1
 CFLAGS-getpwent_r.c = -fexceptions
 CFLAGS-getpwent.c = -fexceptions
 CFLAGS-getpw.c = -fexceptions

Modified: fsf/trunk/libc/shadow/getspent.c
==============================================================================
--- fsf/trunk/libc/shadow/getspent.c (original)
+++ fsf/trunk/libc/shadow/getspent.c Thu Aug 23 00:02:12 2012
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 1996.
 
@@ -26,4 +26,7 @@
 #define DATABASE_NAME	shadow
 #define BUFLEN		1024
 
+/* There is no nscd support for the shadow file.  */
+#undef	USE_NSCD
+
 #include "../nss/getXXent.c"

Modified: fsf/trunk/libc/shadow/getspent_r.c
==============================================================================
--- fsf/trunk/libc/shadow/getspent_r.c (original)
+++ fsf/trunk/libc/shadow/getspent_r.c Thu Aug 23 00:02:12 2012
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 1997, 2002 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 1996.
 
@@ -26,4 +26,7 @@
 #define DATABASE_NAME		shadow
 #define BUFLEN			1024
 
+/* There is no nscd support for the shadow file.  */
+#undef	USE_NSCD
+
 #include "../nss/getXXent_r.c"

Modified: fsf/trunk/libc/shadow/getspnam.c
==============================================================================
--- fsf/trunk/libc/shadow/getspnam.c (original)
+++ fsf/trunk/libc/shadow/getspnam.c Thu Aug 23 00:02:12 2012
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 1996.
 
@@ -26,4 +26,7 @@
 #define ADD_VARIABLES	name
 #define BUFLEN		1024
 
+/* There is no nscd support for the shadow file.  */
+#undef	USE_NSCD
+
 #include "../nss/getXXbyYY.c"

Modified: fsf/trunk/libc/shadow/getspnam_r.c
==============================================================================
--- fsf/trunk/libc/shadow/getspnam_r.c (original)
+++ fsf/trunk/libc/shadow/getspnam_r.c Thu Aug 23 00:02:12 2012
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 1997, 2002 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 1996.
 
@@ -26,4 +26,7 @@
 #define ADD_VARIABLES		name
 #define BUFLEN			1024
 
+/* There is no nscd support for the shadow file.  */
+#undef	USE_NSCD
+
 #include "../nss/getXXbyYY_r.c"

Modified: fsf/trunk/libc/string/Makefile
==============================================================================
--- fsf/trunk/libc/string/Makefile (original)
+++ fsf/trunk/libc/string/Makefile Thu Aug 23 00:02:12 2012
@@ -56,7 +56,7 @@
 		   tst-strtok tst-strxfrm bug-strcoll1 tst-strfry	\
 		   bug-strtok1 $(addprefix test-,$(strop-tests))	\
 		   bug-envz1 tst-strxfrm2 tst-endian tst-svc2		\
-		   bug-strstr1 bug-strchr1 tst-strtok_r
+		   bug-strstr1 bug-strcasestr1 bug-strchr1 tst-strtok_r
 
 
 include ../Rules
@@ -74,6 +74,7 @@
 CFLAGS-test-ffs.c = -fno-builtin
 CFLAGS-tst-inlcall.c = -fno-builtin
 CFLAGS-bug-strstr1.c = -fno-builtin
+CFLAGS-bug-strcasestr1.c = -fno-builtin
 
 ifeq ($(cross-compiling),no)
 tests: $(objpfx)tst-svc.out

Added: fsf/trunk/libc/string/bug-strcasestr1.c
==============================================================================
--- fsf/trunk/libc/string/bug-strcasestr1.c (added)
+++ fsf/trunk/libc/string/bug-strcasestr1.c Thu Aug 23 00:02:12 2012
@@ -1,0 +1,39 @@
+/* Test for non-submitted strcasestr bug.
+   Copyright (C) 2012 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <stdio.h>
+#include <string.h>
+
+#define TEST_FUNCTION do_test ()
+static int
+do_test (void)
+{
+  const char haystack[] = "AOKB";
+  const char needle[] = "OK";
+  const char *sub = strcasestr (haystack, needle);
+
+  if (sub == NULL)
+    {
+      fprintf (stderr, "BUG: didn't find \"%s\" in \"%s\"\n", needle, haystack);
+      return 1;
+    }
+
+  return 0;
+}
+
+#include "../test-skeleton.c"

Modified: fsf/trunk/libc/string/str-two-way.h
==============================================================================
--- fsf/trunk/libc/string/str-two-way.h (original)
+++ fsf/trunk/libc/string/str-two-way.h Thu Aug 23 00:02:12 2012
@@ -73,6 +73,19 @@
 #endif
 #ifndef CMP_FUNC
 # define CMP_FUNC memcmp
+#endif
+
+#ifndef AVAILABLE1
+# define AVAILABLE1(h, h_l, j, n_l) AVAILABLE (h, h_l, j, n_l)
+#endif
+#ifndef AVAILABLE2
+# define AVAILABLE2(h, h_l, j, n_l) (1)
+#endif
+#ifndef RET0_IF_0
+# define RET0_IF_0(a) /* nothing */
+#endif
+#ifndef AVAILABLE1_USES_J
+# define AVAILABLE1_USES_J (1)
 #endif
 
 /* Perform a critical factorization of NEEDLE, of length NEEDLE_LEN.
@@ -230,17 +243,24 @@
       j = 0;
       while (AVAILABLE (haystack, haystack_len, j, needle_len))
 	{
+	  const unsigned char *pneedle;
+	  const unsigned char *phaystack;
+
 	  /* Scan for matches in right half.  */
 	  i = MAX (suffix, memory);
-	  while (i < needle_len && (CANON_ELEMENT (needle[i])
-				    == CANON_ELEMENT (haystack[i + j])))
+	  pneedle = &needle[i];
+	  phaystack = &haystack[i + j];
+	  while (i < needle_len && (CANON_ELEMENT (*pneedle++)
+				    == CANON_ELEMENT (*phaystack++)))
 	    ++i;
 	  if (needle_len <= i)
 	    {
 	      /* Scan for matches in left half.  */
 	      i = suffix - 1;
-	      while (memory < i + 1 && (CANON_ELEMENT (needle[i])
-					== CANON_ELEMENT (haystack[i + j])))
+	      pneedle = &needle[i];
+	      phaystack = &haystack[i + j];
+	      while (memory < i + 1 && (CANON_ELEMENT (*pneedle--)
+					== CANON_ELEMENT (*phaystack--)))
 		--i;
 	      if (i + 1 < memory + 1)
 		return (RETURN_TYPE) (haystack + j);
@@ -258,32 +278,81 @@
     }
   else
     {
+      const unsigned char *phaystack = &haystack[suffix];
+      /* The comparison always starts from needle[suffix], so cache it
+	 and use an optimized first-character loop.  */
+      unsigned char needle_suffix = CANON_ELEMENT (needle[suffix]);
+
       /* The two halves of needle are distinct; no extra memory is
 	 required, and any mismatch results in a maximal shift.  */
       period = MAX (suffix, needle_len - suffix) + 1;
       j = 0;
-      while (AVAILABLE (haystack, haystack_len, j, needle_len))
-	{
+      while (AVAILABLE1 (haystack, haystack_len, j, needle_len))
+	{
+	  unsigned char haystack_char;
+	  const unsigned char *pneedle;
+
+	  /* TODO: The first-character loop can be sped up by adapting
+	     longword-at-a-time implementation of memchr/strchr.  */
+	  if (needle_suffix
+	      != (haystack_char = CANON_ELEMENT (*phaystack++)))
+	    {
+	      RET0_IF_0 (haystack_char);
+#if AVAILABLE1_USES_J
+	      ++j;
+#endif
+	      continue;
+	    }
+
+#if !AVAILABLE1_USES_J
+	  /* Calculate J if it wasn't kept up-to-date in the first-character
+	     loop.  */
+	  j = phaystack - &haystack[suffix] - 1;
+#endif
+
 	  /* Scan for matches in right half.  */
-	  i = suffix;
-	  while (i < needle_len && (CANON_ELEMENT (needle[i])
-				    == CANON_ELEMENT (haystack[i + j])))
-	    ++i;
+	  i = suffix + 1;
+	  pneedle = &needle[i];
+	  while (i < needle_len)
+	    {
+	      if (CANON_ELEMENT (*pneedle++)
+		  != (haystack_char = CANON_ELEMENT (*phaystack++)))
+		{
+		  RET0_IF_0 (haystack_char);
+		  break;
+		}
+	      ++i;
+	    }
 	  if (needle_len <= i)
 	    {
 	      /* Scan for matches in left half.  */
 	      i = suffix - 1;
-	      while (i != SIZE_MAX && (CANON_ELEMENT (needle[i])
-				       == CANON_ELEMENT (haystack[i + j])))
-		--i;
+	      pneedle = &needle[i];
+	      phaystack = &haystack[i + j];
+	      while (i != SIZE_MAX)
+		{
+		  if (CANON_ELEMENT (*pneedle--)
+		      != (haystack_char = CANON_ELEMENT (*phaystack--)))
+		    {
+		      RET0_IF_0 (haystack_char);
+		      break;
+		    }
+		  --i;
+		}
 	      if (i == SIZE_MAX)
 		return (RETURN_TYPE) (haystack + j);
 	      j += period;
 	    }
 	  else
 	    j += i - suffix + 1;
+
+	  if (!AVAILABLE2 (haystack, haystack_len, j, needle_len))
+	    break;
+
+	  phaystack = &haystack[suffix + j];
 	}
     }
+ ret0: __attribute__ ((unused))
   return NULL;
 }
 
@@ -335,6 +404,9 @@
       j = 0;
       while (AVAILABLE (haystack, haystack_len, j, needle_len))
 	{
+	  const unsigned char *pneedle;
+	  const unsigned char *phaystack;
+
 	  /* Check the last byte first; if it does not match, then
 	     shift to the next possible match location.  */
 	  shift = shift_table[CANON_ELEMENT (haystack[j + needle_len - 1])];
@@ -354,15 +426,19 @@
 	  /* Scan for matches in right half.  The last byte has
 	     already been matched, by virtue of the shift table.  */
 	  i = MAX (suffix, memory);
-	  while (i < needle_len - 1 && (CANON_ELEMENT (needle[i])
-					== CANON_ELEMENT (haystack[i + j])))
+	  pneedle = &needle[i];
+	  phaystack = &haystack[i + j];
+	  while (i < needle_len - 1 && (CANON_ELEMENT (*pneedle++)
+					== CANON_ELEMENT (*phaystack++)))
 	    ++i;
 	  if (needle_len - 1 <= i)
 	    {
 	      /* Scan for matches in left half.  */
 	      i = suffix - 1;
-	      while (memory < i + 1 && (CANON_ELEMENT (needle[i])
-					== CANON_ELEMENT (haystack[i + j])))
+	      pneedle = &needle[i];
+	      phaystack = &haystack[i + j];
+	      while (memory < i + 1 && (CANON_ELEMENT (*pneedle--)
+					== CANON_ELEMENT (*phaystack--)))
 		--i;
 	      if (i + 1 < memory + 1)
 		return (RETURN_TYPE) (haystack + j);
@@ -387,6 +463,9 @@
       j = 0;
       while (AVAILABLE (haystack, haystack_len, j, needle_len))
 	{
+	  const unsigned char *pneedle;
+	  const unsigned char *phaystack;
+
 	  /* Check the last byte first; if it does not match, then
 	     shift to the next possible match location.  */
 	  shift = shift_table[CANON_ELEMENT (haystack[j + needle_len - 1])];
@@ -398,15 +477,19 @@
 	  /* Scan for matches in right half.  The last byte has
 	     already been matched, by virtue of the shift table.  */
 	  i = suffix;
-	  while (i < needle_len - 1 && (CANON_ELEMENT (needle[i])
-					== CANON_ELEMENT (haystack[i + j])))
+	  pneedle = &needle[i];
+	  phaystack = &haystack[i + j];
+	  while (i < needle_len - 1 && (CANON_ELEMENT (*pneedle++)
+					== CANON_ELEMENT (*phaystack++)))
 	    ++i;
 	  if (needle_len - 1 <= i)
 	    {
 	      /* Scan for matches in left half.  */
 	      i = suffix - 1;
-	      while (i != SIZE_MAX && (CANON_ELEMENT (needle[i])
-				       == CANON_ELEMENT (haystack[i + j])))
+	      pneedle = &needle[i];
+	      phaystack = &haystack[i + j];
+	      while (i != SIZE_MAX && (CANON_ELEMENT (*pneedle--)
+				       == CANON_ELEMENT (*phaystack--)))
 		--i;
 	      if (i == SIZE_MAX)
 		return (RETURN_TYPE) (haystack + j);
@@ -420,6 +503,10 @@
 }
 
 #undef AVAILABLE
+#undef AVAILABLE1
+#undef AVAILABLE2
+#undef AVAILABLE1_USES_J
 #undef CANON_ELEMENT
 #undef CMP_FUNC
+#undef RET0_IF_0
 #undef RETURN_TYPE

Modified: fsf/trunk/libc/string/strcasestr.c
==============================================================================
--- fsf/trunk/libc/string/strcasestr.c (original)
+++ fsf/trunk/libc/string/strcasestr.c Thu Aug 23 00:02:12 2012
@@ -1,6 +1,5 @@
 /* Return the offset of one string within another.
-   Copyright (C) 1994, 1996-2000, 2004, 2008, 2009, 2010
-   Free Software Foundation, Inc.
+   Copyright (C) 1994-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -37,13 +36,17 @@
 #include <stdbool.h>
 #include <strings.h>
 
-#define TOLOWER(Ch) (isupper (Ch) ? tolower (Ch) : (Ch))
+#define TOLOWER(Ch) tolower (Ch)
 
 /* Two-Way algorithm.  */
 #define RETURN_TYPE char *
 #define AVAILABLE(h, h_l, j, n_l)			\
   (!memchr ((h) + (h_l), '\0', (j) + (n_l) - (h_l))	\
    && ((h_l) = (j) + (n_l)))
+#define AVAILABLE1(h, h_l, j, n_l) (true)
+#define AVAILABLE2(h, h_l, j, n_l) AVAILABLE (h, h_l, j, n_l)
+#define RET0_IF_0(a) if (!a) goto ret0
+#define AVAILABLE1_USES_J (0)
 #define CANON_ELEMENT(c) TOLOWER (c)
 #define CMP_FUNC(p1, p2, l)				\
   __strncasecmp ((const char *) (p1), (const char *) (p2), l)

Modified: fsf/trunk/libc/string/strstr.c
==============================================================================
--- fsf/trunk/libc/string/strstr.c (original)
+++ fsf/trunk/libc/string/strstr.c Thu Aug 23 00:02:12 2012
@@ -1,6 +1,5 @@
 /* Return the offset of one string within another.
-   Copyright (C) 1994,1996,1997,2000,2001,2003,2008,2009
-   Free Software Foundation, Inc.
+   Copyright (C) 1994-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -36,6 +35,10 @@
 #define AVAILABLE(h, h_l, j, n_l)			\
   (!memchr ((h) + (h_l), '\0', (j) + (n_l) - (h_l))	\
    && ((h_l) = (j) + (n_l)))
+#define AVAILABLE1(h, h_l, j, n_l) (true)
+#define AVAILABLE2(h, h_l, j, n_l) AVAILABLE (h, h_l, j, n_l)
+#define RET0_IF_0(a) if (!a) goto ret0
+#define AVAILABLE1_USES_J (0)
 #include "str-two-way.h"
 
 #undef strstr

Modified: fsf/trunk/libc/sysdeps/posix/getaddrinfo.c
==============================================================================
--- fsf/trunk/libc/sysdeps/posix/getaddrinfo.c (original)
+++ fsf/trunk/libc/sysdeps/posix/getaddrinfo.c Thu Aug 23 00:02:12 2012
@@ -832,8 +832,13 @@
 	  while (!no_more)
 	    {
 	      no_data = 0;
-	      nss_gethostbyname4_r fct4
-		= __nss_lookup_function (nip, "gethostbyname4_r");
+	      nss_gethostbyname4_r fct4 = NULL;
+
+	      /* gethostbyname4_r sends out parallel A and AAAA queries and
+		 is thus only suitable for PF_UNSPEC.  */
+	      if (req->ai_family == PF_UNSPEC)
+		fct4 = __nss_lookup_function (nip, "gethostbyname4_r");
+
 	      if (fct4 != NULL)
 		{
 		  int herrno;

Added: fsf/trunk/libc/sysdeps/powerpc/powerpc32/power6/wcschr.c
==============================================================================
--- fsf/trunk/libc/sysdeps/powerpc/powerpc32/power6/wcschr.c (added)
+++ fsf/trunk/libc/sysdeps/powerpc/powerpc32/power6/wcschr.c Thu Aug 23 00:02:12 2012
@@ -1,0 +1,88 @@
+/* wcschr.c - Wide Character Search for powerpc32/power6.
+   Copyright (C) 2012 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If
+   not, see <http://www.gnu.org/licenses/>.  */
+
+#include <wchar.h>
+
+
+/* Find the first occurrence of WC in WCS.  */
+wchar_t *
+wcschr (wcs, wc)
+     register const wchar_t *wcs;
+     register const wchar_t wc;
+{
+  register const wchar_t *wcs2 = wcs + 1;
+
+  if (*wcs == wc)
+    return (wchar_t *) wcs;
+  if (*wcs == L'\0')
+    return NULL;
+
+  do
+    {
+      wcs += 2;
+
+      if (*wcs2 == wc)
+        return (wchar_t *) wcs2;
+      if (*wcs2 == L'\0')
+        return NULL;
+       wcs2 += 2;
+
+      if (*wcs == wc)
+        return (wchar_t *) wcs;
+      if (*wcs == L'\0')
+        return NULL;
+      wcs += 2;
+
+      if (*wcs2 == wc)
+        return (wchar_t *) wcs2;
+      if (*wcs2 == L'\0')
+        return NULL;
+      wcs2 += 2;
+
+      if (*wcs == wc)
+        return (wchar_t *) wcs;
+      if (*wcs == L'\0')
+        return NULL;
+      wcs += 2;
+
+      if (*wcs2 == wc)
+        return (wchar_t *) wcs2;
+      if (*wcs2 == L'\0')
+        return NULL;
+      wcs2 += 2;
+
+      if (*wcs == wc)
+        return (wchar_t *) wcs;
+      if (*wcs == L'\0')
+        return NULL;
+      wcs += 2;
+
+      if (*wcs2 == wc)
+        return (wchar_t *) wcs2;
+      if (*wcs2 == L'\0')
+        return NULL;
+      wcs2 += 2;
+
+      if (*wcs == wc)
+        return (wchar_t *) wcs;
+    }
+  while (*wcs != L'\0');
+
+  return NULL;
+}
+libc_hidden_def (wcschr)

Added: fsf/trunk/libc/sysdeps/powerpc/powerpc32/power6/wcscpy.c
==============================================================================
--- fsf/trunk/libc/sysdeps/powerpc/powerpc32/power6/wcscpy.c (added)
+++ fsf/trunk/libc/sysdeps/powerpc/powerpc32/power6/wcscpy.c Thu Aug 23 00:02:12 2012
@@ -1,0 +1,104 @@
+/* wcscpy.c - Wide Character Copy for powerpc32/power6.
+   Copyright (C) 2012 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If
+   not, see <http://www.gnu.org/licenses/>.  */
+
+#include <stddef.h>
+#include <wchar.h>
+
+
+/* Copy SRC to DEST.  */
+wchar_t *
+wcscpy (dest, src)
+     wchar_t *dest;
+     const wchar_t *src;
+{
+  wint_t c,d;
+  wchar_t *wcp, *wcp2;
+
+  if (__alignof__ (wchar_t) >= sizeof (wchar_t))
+    {
+      const ptrdiff_t off = dest - src;
+
+      wcp = (wchar_t *) src;
+      wcp2 = wcp + 1 ;
+
+      do
+        {
+          d = *wcp;
+          wcp[off] = d;
+          if (d == L'\0')
+            return dest;
+          wcp += 2;
+
+          c = *wcp2;
+          wcp2[off] = c;
+          if (c == L'\0')
+            return dest;
+          wcp2 += 2;
+
+          d = *wcp;
+          wcp[off] = d;
+          if (d == L'\0')
+            return dest;
+          wcp += 2;
+
+          c = *wcp2;
+          wcp2[off] = c;
+          if (c == L'\0')
+            return dest;
+          wcp2 += 2;
+
+          d = *wcp;
+          wcp[off] = d;
+          if (d == L'\0')
+            return dest;
+          wcp += 2;
+
+          c = *wcp2;
+          wcp2[off] = c;
+          if (c == L'\0')
+            return dest;
+          wcp2 += 2;
+
+          d = *wcp;
+          wcp[off] = d;
+          if (d == L'\0')
+            return dest;
+          wcp += 2;
+
+          c = *wcp2;
+          wcp2[off] = c;
+          if (c == L'\0')
+            return dest;
+          wcp2 += 2;
+        }
+      while (c != L'\0');
+
+    }
+  else
+    {
+      wcp = dest;
+
+      do
+        {
+          c = *src++;
+          *wcp++ = c;
+        }
+      while (c != L'\0');
+    }
+  return dest;
+}

Added: fsf/trunk/libc/sysdeps/powerpc/powerpc32/power6/wcsrchr.c
==============================================================================
--- fsf/trunk/libc/sysdeps/powerpc/powerpc32/power6/wcsrchr.c (added)
+++ fsf/trunk/libc/sysdeps/powerpc/powerpc32/power6/wcsrchr.c Thu Aug 23 00:02:12 2012
@@ -1,0 +1,88 @@
+/* wcsrchr.c - Wide Character Reverse Search for powerpc32/power6.
+   Copyright (C) 2012 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If
+   not, see <http://www.gnu.org/licenses/>.  */
+
+#include <wchar.h>
+
+
+/* Find the last occurrence of WC in WCS.  */
+wchar_t *
+wcsrchr (wcs, wc)
+     register const wchar_t *wcs;
+     register const wchar_t wc;
+{
+  register const wchar_t *wcs2 = wcs + 1;
+  const wchar_t *retval = NULL;
+
+  if (*wcs == wc)
+    retval = wcs;
+
+  if (*wcs == L'\0') return (wchar_t *) retval;
+
+  do
+    {
+    wcs+=2;
+
+    if (*wcs2 == wc)
+      retval = wcs2;
+    if (*wcs2 == L'\0')
+      return (wchar_t *) retval;
+    wcs2+=2;
+
+    if (*wcs == wc)
+      retval = wcs;
+    if (*wcs == L'\0')
+      return (wchar_t *) retval;
+    wcs+=2;
+
+    if (*wcs2 == wc)
+      retval = wcs2;
+    if (*wcs2 == L'\0')
+      return (wchar_t *) retval;
+    wcs2+=2;
+
+    if (*wcs == wc)
+      retval = wcs;
+    if (*wcs == L'\0')
+      return (wchar_t *) retval;
+    wcs+=2;
+
+    if (*wcs2 == wc)
+      retval = wcs2;
+    if (*wcs2 == L'\0')
+      return (wchar_t *) retval;
+    wcs2+=2;
+
+    if (*wcs == wc)
+      retval = wcs;
+    if (*wcs == L'\0')
+      return (wchar_t *) retval;
+    wcs+=2;
+
+    if (*wcs2 == wc)
+      retval = wcs2;
+    if (*wcs2 == L'\0')
+      return (wchar_t *) retval;
+    wcs2+=2;
+
+    if (*wcs == wc)
+      retval = wcs;
+    }
+  while (*wcs != L'\0');
+
+  return (wchar_t *) retval;
+}

Added: fsf/trunk/libc/sysdeps/powerpc/powerpc64/power6/wcschr.c
==============================================================================
--- fsf/trunk/libc/sysdeps/powerpc/powerpc64/power6/wcschr.c (added)
+++ fsf/trunk/libc/sysdeps/powerpc/powerpc64/power6/wcschr.c Thu Aug 23 00:02:12 2012
@@ -1,0 +1,1 @@
+#include "../../powerpc32/power6/wcschr.c"

Added: fsf/trunk/libc/sysdeps/powerpc/powerpc64/power6/wcscpy.c
==============================================================================
--- fsf/trunk/libc/sysdeps/powerpc/powerpc64/power6/wcscpy.c (added)
+++ fsf/trunk/libc/sysdeps/powerpc/powerpc64/power6/wcscpy.c Thu Aug 23 00:02:12 2012
@@ -1,0 +1,1 @@
+#include "../../powerpc32/power6/wcscpy.c"

Added: fsf/trunk/libc/sysdeps/powerpc/powerpc64/power6/wcsrchr.c
==============================================================================
--- fsf/trunk/libc/sysdeps/powerpc/powerpc64/power6/wcsrchr.c (added)
+++ fsf/trunk/libc/sysdeps/powerpc/powerpc64/power6/wcsrchr.c Thu Aug 23 00:02:12 2012
@@ -1,0 +1,1 @@
+#include "../../powerpc32/power6/wcsrchr.c"

Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/check_pf.c
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/check_pf.c (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/check_pf.c Thu Aug 23 00:02:12 2012
@@ -77,6 +77,29 @@
   return nl_timestamp;
 }
 #endif
+
+static inline uint32_t
+get_nl_timestamp (void)
+{
+#ifdef IS_IN_nscd
+  return nl_timestamp;
+#elif defined USE_NSCD
+  return __nscd_get_nl_timestamp ();
+#else
+  return 0;
+#endif
+}
+
+static inline bool
+cache_valid_p (void)
+{
+  if (cache != NULL)
+    {
+      uint32_t timestamp = get_nl_timestamp ();
+      return timestamp != 0 && cache->timestamp == timestamp;
+    }
+  return false;
+}
 
 
 static struct cached_data *
@@ -253,11 +276,7 @@
       if (result == NULL)
 	goto out_fail;
 
-#ifdef IS_IN_nscd
-      result->timestamp = nl_timestamp;
-#else
-      result->timestamp = __nscd_get_nl_timestamp ();
-#endif
+      result->timestamp = get_nl_timestamp ();
       result->usecnt = 2;
       result->seen_ipv4 = seen_ipv4;
       result->seen_ipv6 = true;
@@ -302,14 +321,7 @@
 
   __libc_lock_lock (lock);
 
-#ifdef IS_IN_nscd
-# define cache_valid() nl_timestamp != 0 && cache->timestamp == nl_timestamp
-#else
-# define cache_valid() \
-      ({ uint32_t val = __nscd_get_nl_timestamp ();			      \
-	 val != 0 && cache->timestamp == val; })
-#endif
-  if (cache != NULL && cache_valid ())
+  if (cache_valid_p ())
     {
       data = cache;
       atomic_increment (&cache->usecnt);

_______________________________________________
Commits mailing list
Commits@xxxxxxxxxx
http://eglibc.org/cgi-bin/mailman/listinfo/commits