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

[commits] r6404 - in /trunk: libc/ libc/bits/ libc/elf/ libc/iconvdata/ libc/include/ libc/libio/ libc/locale/programs/ libc/localedat...



Author: joseph
Date: Fri Jun 20 02:26:44 2008
New Revision: 6404

Log:
Merge changes between r6192 and r6403 from /fsf/trunk.

Added:
    trunk/libc/nptl/sysdeps/unix/sysv/linux/sparc/sparc64/Makefile
      - copied unchanged from r6403, fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/sparc/sparc64/Makefile
    trunk/libc/nptl/tst-rwlock2a.c
      - copied unchanged from r6403, fsf/trunk/libc/nptl/tst-rwlock2a.c
    trunk/libc/scripts/data/localplt-sparc-linux-gnu.data
      - copied unchanged from r6403, fsf/trunk/libc/scripts/data/localplt-sparc-linux-gnu.data
    trunk/libc/scripts/data/localplt-sparc64-linux-gnu.data
      - copied unchanged from r6403, fsf/trunk/libc/scripts/data/localplt-sparc64-linux-gnu.data
    trunk/libc/stdio-common/scanf16.c
      - copied unchanged from r6403, fsf/trunk/libc/stdio-common/scanf16.c
    trunk/libc/stdio-common/scanf17.c
      - copied unchanged from r6403, fsf/trunk/libc/stdio-common/scanf17.c
    trunk/libc/string/test-memmem.c
      - copied unchanged from r6403, fsf/trunk/libc/string/test-memmem.c
    trunk/libc/sysdeps/sparc/machine-gmon.h
      - copied unchanged from r6403, fsf/trunk/libc/sysdeps/sparc/machine-gmon.h
    trunk/libc/sysdeps/sparc/sparc-mcount.S
      - copied unchanged from r6403, fsf/trunk/libc/sysdeps/sparc/sparc-mcount.S
    trunk/libc/sysdeps/sparc/sparc64/backtrace.c
      - copied unchanged from r6403, fsf/trunk/libc/sysdeps/sparc/sparc64/backtrace.c
Modified:
    trunk/libc/ChangeLog
    trunk/libc/Makeconfig
    trunk/libc/Makefile
    trunk/libc/bits/termios.h
    trunk/libc/elf/Makefile
    trunk/libc/elf/soinit.c
    trunk/libc/iconvdata/Depend
    trunk/libc/include/inline-hashtab.h
    trunk/libc/libio/freopen.c
    trunk/libc/libio/freopen64.c
    trunk/libc/libio/stdio.h
    trunk/libc/locale/programs/ld-collate.c
    trunk/libc/localedata/ChangeLog
    trunk/libc/localedata/locales/iso14651_t1_common
    trunk/libc/math/libm-test.inc
    trunk/libc/misc/fstab.c
    trunk/libc/misc/regexp.h
    trunk/libc/nptl/ChangeLog
    trunk/libc/nptl/Makefile
    trunk/libc/nptl/sysdeps/pthread/createthread.c
    trunk/libc/nptl/sysdeps/pthread/pthread.h
    trunk/libc/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_barrier_wait.S
    trunk/libc/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_broadcast.S
    trunk/libc/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_signal.S
    trunk/libc/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_rdlock.S
    trunk/libc/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_timedrdlock.S
    trunk/libc/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_timedwrlock.S
    trunk/libc/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_unlock.S
    trunk/libc/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_wrlock.S
    trunk/libc/nptl/sysdeps/unix/sysv/linux/i386/i486/sem_post.S
    trunk/libc/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedrdlock.S
    trunk/libc/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedwrlock.S
    trunk/libc/nptl/tst-rwlock2.c
    trunk/libc/nptl/tst-typesizes.c
    trunk/libc/nscd/aicache.c
    trunk/libc/nscd/cache.c
    trunk/libc/nscd/connections.c
    trunk/libc/nscd/grpcache.c
    trunk/libc/nscd/hstcache.c
    trunk/libc/nscd/initgrcache.c
    trunk/libc/nscd/mem.c
    trunk/libc/nscd/nscd.h
    trunk/libc/nscd/nscd_getserv_r.c
    trunk/libc/nscd/pwdcache.c
    trunk/libc/nscd/servicescache.c
    trunk/libc/posix/glob.c
    trunk/libc/resolv/arpa/nameser_compat.h
    trunk/libc/resolv/nss_dns/dns-host.c
    trunk/libc/resolv/res_query.c
    trunk/libc/resolv/res_send.c
    trunk/libc/scripts/soversions.awk
    trunk/libc/shlib-versions
    trunk/libc/stdio-common/Makefile
    trunk/libc/stdio-common/scanf14.c
    trunk/libc/stdio-common/scanf15.c
    trunk/libc/string/Makefile
    trunk/libc/string/endian.h
    trunk/libc/string/test-string.h
    trunk/libc/sysdeps/posix/getaddrinfo.c
    trunk/libc/sysdeps/powerpc/powerpc32/fpu/s_lround.S
    trunk/libc/sysdeps/powerpc/powerpc32/power4/fpu/s_llround.S
    trunk/libc/sysdeps/powerpc/powerpc64/fpu/s_llround.S
    trunk/libc/sysdeps/powerpc/powerpc64/fpu/s_llroundf.S
    trunk/libc/sysdeps/sparc/Makefile
    trunk/libc/sysdeps/unix/sysv/linux/Makefile
    trunk/libc/sysdeps/unix/sysv/linux/sparc/sparc32/setcontext.S
    trunk/libc/sysdeps/unix/sysv/linux/sparc/sparc32/sigcontextinfo.h
    trunk/libc/sysdeps/unix/sysv/linux/sparc/sparc32/sysdep.h
    trunk/libc/sysdeps/unix/sysv/linux/sparc/sparc64/brk.S
    trunk/libc/sysdeps/unix/sysv/linux/sparc/sparc64/sysdep.h
    trunk/libc/time/strftime_l.c
    trunk/ports/ChangeLog.arm
    trunk/ports/ChangeLog.hppa
    trunk/ports/ChangeLog.mips
    trunk/ports/sysdeps/arm/nptl/pthread_spin_lock.c
    trunk/ports/sysdeps/arm/nptl/pthread_spin_trylock.c
    trunk/ports/sysdeps/unix/sysv/linux/arm/eabi/configure
    trunk/ports/sysdeps/unix/sysv/linux/arm/eabi/configure.in
    trunk/ports/sysdeps/unix/sysv/linux/hppa/bits/atomic.h
    trunk/ports/sysdeps/unix/sysv/linux/hppa/nptl/lowlevellock.h
    trunk/ports/sysdeps/unix/sysv/linux/mips/bits/socket.h

Modified: trunk/libc/ChangeLog
==============================================================================
--- trunk/libc/ChangeLog (original)
+++ trunk/libc/ChangeLog Fri Jun 20 02:26:44 2008
@@ -1,3 +1,257 @@
+2008-06-18  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	* nscd/connections.c (main_loop_poll): Fix test for read error.
+	(main_loop_epoll): Likewise.
+
+2008-06-13  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	* sysdeps/posix/getaddrinfo.c: Move _res_hconf_init call to a
+	better place so it is not called when nscd is used.
+
+	* nscd/connections.c: Also recognize and handle changes to the
+	resolver configuration file.
+
+2008-06-12  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	* time/strftime.c: Pass reference to tzset_called around to handle
+	recursive calls.
+
+	[BZ #6612]
+	* time/strftime.c (__strftime_internal): Call tzset() only
+	when printing timezone-dependent values.
+	Based on a patch by Petr Baudis <pasky@xxxxxxx>.
+
+	* resolv/nss_dns/dns-host.c (gaih_getanswer): Don't
+	unconditionally use second gaih_getanswer_slice result.
+
+	* sysdeps/posix/getaddrinfo.c (gai_inet): Remove unnecessary test.
+	(getaddrinfo): RES must always be non-NULL.
+
+2008-06-12  Jakub Jelinek  <jakub@xxxxxxxxxx>
+
+	* sysdeps/powerpc/powerpc64/fpu/s_llround.S (__llround): Avoid using
+	cr[34] registers.
+	* sysdeps/powerpc/powerpc64/fpu/s_llroundf.S (__llroundf): Likewise.
+	* sysdeps/powerpc/powerpc32/power4/fpu/s_llround.S (__llround):
+	Likewise.
+	* sysdeps/powerpc/powerpc32/fpu/s_lround.S (__lround): Avoid using cr3
+	register.
+
+2008-06-12  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	* nscd/nscd.h (struct database_dyn): Add inotify_descr and clear_cache
+	fields.
+	* nscd/connections.c (inotify_fd): New variable.
+	(nscd_init): Try to open an inotify descriptor.
+	If successful, watch files for databases using inotify instead of
+	having prune threads stat the files.
+	(nscd_run_prune): Recognize clear_cache flag being set and call
+	prune_cache appropriately.
+	(main_loop_poll): Add inotify descriptor to wait set and handle the
+	reported changes.
+	(main_loop_epoll): Likewise.
+	* nscd/cache.c (prune_cache): Don't stat files for databases if
+	inotify is used.
+	* sysdeps/unix/sysv/linux/Makefile [subdir=nscd]
+	(CFLAGS-connections.c): Add -DHAVE_INOTIFY.
+
+	* nscd/grpcache.c (cache_addgr): Correctly compute size of
+	fixed-size portion of the record.
+	* nscd/servicescache.c (cache_addserv): Likewise.
+	* nscd/pwdcache.c (cache_addpw): Likewise.
+	* nscd/initgrcache.c (addinitgroupsX): Likewise.
+
+2008-06-11  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	* nscd/mem.c (gc): Initialize obstack earlier so that if we jump
+	out we don't use uninitialized memory.
+
+	* nscd/hstcache.c (cache_addhst): Send correct number of bytes to
+	the client.
+
+2008-06-10  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	* resolv/nss_dns/dns-host.c (gaih_getanswer_slice): Also log and
+	ignore T_DNAME messages.
+	* resolv/arpa/nameser_compat.h (T_DNAME): Define.
+
+2008-06-05  Jakub Jelinek  <jakub@xxxxxxxxxx>
+
+	* misc/regexp.h (compile): Use __REPB_PREFIX macro.
+	Avoid segfault if first GETC returns eof/'\0'/'\n'.
+
+2008-06-03  Jakub Jelinek  <jakub@xxxxxxxxxx>
+
+	* nscd/nscd_getserv_r.c (__nscd_getservbyport_r): Pass cp
+	instead of portstr to nscd_getserv_r.  Patch by
+	Roman Kagan <rkagan@xxxxxxx>.
+
+2008-05-26  Jim Meyering  <meyering@xxxxxxxxxx>
+
+	Remove more useless "if" tests before "free".
+	* include/inline-hashtab.h (htab_delete): Likewise.
+	* libio/freopen.c (freopen): Likewise.
+	* libio/freopen64.c (freopen64): Likewise.
+	* locale/programs/ld-collate.c (collate_read): Likewise.
+	* misc/fstab.c (libc_freeres_fn): Likewise.
+	* posix/glob.c (globfree): Likewise.
+
+2008-05-24  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	* string/Makefile (strop-tests): Add memmem.
+	* string/test-memmem.c: New file.
+	* string/test-string.h (BUF1PAGES): Define to 1 if undefined.
+	(test_init): Size buf1 according to BUF1PAGES.
+
+2008-05-24  Jakub Jelinek  <jakub@xxxxxxxxxx>
+
+	* libio/stdio.h (vscanf): Fix -std=c99 redirect.
+	* stdio-common/Makefile (tests): Add scanf16 and scanf17.
+	(CFLAGS-scanf17.c): New.
+	* stdio-common/scanf14.c (main): Add fscanf and scanf tests.
+	* stdio-common/scanf15.c (main): Likewise.
+	* stdio-common/scanf16.c: New file.
+	* stdio-common/scanf17.c: New file.
+
+2008-05-24  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	* resolv/res_send.c (send_dg): If we already have one of two
+	answers and the server reports SERVFAIL, NOTIMP, or REFUSED, then
+	use the one answer insted of failing.
+
+2008-02-20  Ryan S. Arnold  <rsa@xxxxxxxxxx>
+
+	* math/libm-test.inc (exp_test): Exclude expl(1000.0L) from
+	being executed on PowerPC as the expected result exceeds IBM
+	long double 128 __LDBL_MAX__.
+
+2008-05-21  Roland McGrath  <roland@xxxxxxxxxx>
+
+	* shlib-versions (sparc.*-.*-.*, sparc64.*-.*-.*): Add ABI lines.
+
+	* Makefile (check-data): Use $(abi-name) before other guesses.
+	Look in $(add-ons) dirs before scripts/data/.
+	* elf/Makefile (check-data): Likewise.
+
+	* scripts/soversions.awk: Grok ABI line.
+	* Makeconfig ($(common-objpfx)soversions.mk): Likewise.
+	Emit definition for abi-name variable.
+
+2008-05-21  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	* string/endian.h: Define new fixed-size hto* and *toh macros only
+	if [__USE_BSD].
+
+	* iconvdata/Depend: Add localedata.
+
+2008-05-21  Samuel Thibault  <samuel.thibault@xxxxxxxxxxxx>
+
+	* bits/termios.h (ONLCR): Define under [__USE_XOPEN] too.
+
+2008-05-08  David S. Miller  <davem@xxxxxxxxxxxxx>
+
+	* sysdeps/unix/sysv/linux/sparc/sparc32/setcontext.S: Use
+	HIDDEN_JUMPTARGET.
+	* sysdeps/unix/sysv/linux/sparc/sparc32/sysdep.h
+	(__SYSCALL_CLOBBERS): Remove %g* registers.
+	* sysdeps/unix/sysv/linux/sparc/sparc64/sysdep.h
+	(__SYSCALL_CLOBBERS): Likewise.
+	* scripts/data/localplt-sparc-linux-gnu.data: New file.
+	* scripts/data/localplt-sparc64-linux-gnu.data: New file.
+
+2008-05-21  Jakub Jelinek  <jakub@xxxxxxxxxx>
+
+	* sysdeps/unix/sysv/linux/sparc/sparc32/sysdep.h
+	(CALL_ERRNO_LOCATION): Define.
+	(__SYSCALL_STRING, __CLONE_SYSCALL_STRING): Use it.
+	* sysdeps/unix/sysv/linux/sparc/sparc64/sysdep.h
+	(CALL_ERRNO_LOCATION): Define.
+	(__SYSCALL_STRING, __CLONE_SYSCALL_STRING): Use it.
+	* sysdeps/unix/sysv/linux/sparc/sparc64/brk.S (__brk): Use
+	HIDDEN_JUMPTARGET for __errno_location call in libc.so.
+
+2008-05-20  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	* include/inline-hashtab.h (higher_prime_number): Fix type of mid
+	variable.
+
+2008-05-20  Jakub Jelinek  <jakub@xxxxxxxxxx>
+
+	* sysdeps/unix/sysv/linux/sparc/sparc32/sigcontextinfo.h
+	(FIRST_FRAME_POINTER): Define.
+
+2008-05-09  David S. Miller  <davem@xxxxxxxxxxxxx>
+
+	* sysdeps/sparc/sparc64/backtrace.c: New file.
+
+2008-05-14  David S. Miller  <davem@xxxxxxxxxxxxx>
+
+	* sysdeps/sparc/machine-gmon.h: New file.
+	* sysdeps/sparc/sparc-mcount.S: Likewise.
+	* sysdeps/sparc/Makefile: Add sparc-mcount target to
+	sysdep_routines in gmon directory.
+
+2008-05-19  Jakub Jelinek  <jakub@xxxxxxxxxx>
+
+	* elf/soinit.c (__EH_FRAME_BEGIN__): Remove.
+
+2008-05-19  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	* resolv/res_query.c (__libc_res_nquery): In case one of two
+	answer was too short don't try to read that answer's header.
+
+	* resolv/res_send.c (send_dg): In case of timeout and there are
+	two queries and one has been answered, return value indicating
+	success.
+
+2008-05-18  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	* nscd/cache.c (cache_add): Take additional parameter specifying
+	whether this is in response of a cache refill.  Check alignment
+	of package data.  Revamp waking of pruning thread.
+	(prune_cache): Small optimization.
+	* nscd/nscd.h: Adjust cache_add prototypes.
+	* nscd/aicache.c: Adjust cache_add calls.
+	* nscd/grpcache.c: Likewise.
+	* nscd/hstcache.c: Likewise.
+	* nscd/initgrcache.c: Likewise.
+	* nscd/pwdcache.c: Likewise.
+	* nscd/servicescache.c: Likewise.
+	* nscd/connections.c (restart): Really disable cache use before
+	exec attempt.  If it fails, reenable cache.
+	(nscd_run_prune): Initialize wakeup_time.  After wakeup, set wakeup
+	time to max to be able to notice concurrent cache additions.  Unlock
+	prune_lock while performing gc.  Afterwards compute wakeup time with
+	current wakeup_time value in mind.
+
+2008-05-17  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	* nscd/mem.c (gc): Avoid stack overflow when allocating move list.
+
+	* nscd/mem.c (gc): Correctly determine highest used array element
+	in mark.
+
+	* nscd/mem.c (markrange): Add assert to check entries are all
+	aligned.  Small cleanup in bitmap use.
+
+	* nscd/nscd.h (mem_in_flight): Replace blockaddr field with
+	blockoff of type nscd_ssize_t.
+	* nscd/mem.c (gc): Simplify markrange call for on-flight blocks.
+	(mempoll_alloc): Record block offset and not address.
+
+	* nscd/mem.c (gc): Fix test for stack overuse.
+
+	* nscd/aicache.c (addhstaiX): Fix a few small problems, cleanups,
+	more asserts.
+
+	* sysdeps/posix/getaddrinfo.c (gaih_inet): If nscd reports no
+	entry is available, believe it.
+
+	* resolv/nss_dns/dns-host.c (gaih_getanswer_slice): If there are
+	no answers return NSS_STATUS_NOTFOUND.
+	(gaih_getanswer): Don't call gaih_getanswer_slice if the answer
+	buffer does not have any content.
+
 2008-05-16  Ulrich Drepper  <drepper@xxxxxxxxxx>
 
 	* string/strcasestr.c (CMP_FUNC): Use __strncasecmp, not strncasecmp.
@@ -174,7 +428,7 @@
 	* nscd/hstcache.c: Likewise.
 	* nscd/initgrcache.c: Likewise.
 	* nscd/pwdcache.c: Likewise.
-	* nscd/servicecache.c: Likewise.
+	* nscd/servicescache.c: Likewise.
 
 2008-05-10  Roland McGrath  <roland@xxxxxxxxxx>
 

Modified: trunk/libc/Makeconfig
==============================================================================
--- trunk/libc/Makeconfig (original)
+++ trunk/libc/Makeconfig Fri Jun 20 02:26:44 2008
@@ -834,6 +834,7 @@
 	(seen_DEFAULT=0; seen_WORDSIZE32=0; seen_WORDSIZE64=0; \
 	 while read which lib number setname; do \
 	   eval seen_$$which=1; \
+	   test x"$$which" != xABI || echo abi-name = "$$lib"; \
 	   test x"$$which" = xDEFAULT || continue; \
 	   case $$number in \
 	     [0-9]*) echo "$$lib.so-version=.$$number"; \

Modified: trunk/libc/Makefile
==============================================================================
--- trunk/libc/Makefile (original)
+++ trunk/libc/Makefile Fri Jun 20 02:26:44 2008
@@ -1,4 +1,5 @@
-# Copyright (C) 1991-2002,2003,2004,2005,2006 Free Software Foundation, Inc.
+# Copyright (C) 1991-2002,2003,2004,2005,2006,2008
+#	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
@@ -266,8 +267,12 @@
 tests: $(objpfx)c++-types-check.out $(objpfx)check-local-headers.out
 ifneq ($(CXX),no)
 check-data := $(firstword $(wildcard \
-	        $(foreach M,$(config-machine) $(base-machine),\
-			  scripts/data/c++-types-$M-$(config-os).data)))
+	        $(foreach D,$(add-ons) scripts/data,\
+	        	  $(patsubst %,$D/c++-types-%.data,\
+			   	     $(abi-name) \
+			   	     $(addsuffix -$(config-os),\
+				     		 $(config-machine) \
+						 $(base-machine))))))
 ifneq (,$(check-data))
 $(objpfx)c++-types-check.out: $(check-data) scripts/check-c++-types.sh
 	scripts/check-c++-types.sh $< $(CXX) $(filter-out -std=gnu99 -Wstrict-prototypes,$(CFLAGS)) $(CPPFLAGS) > $@

Modified: trunk/libc/bits/termios.h
==============================================================================
--- trunk/libc/bits/termios.h (original)
+++ trunk/libc/bits/termios.h Fri Jun 20 02:26:44 2008
@@ -135,8 +135,10 @@
   /* Output modes.  */
   tcflag_t c_oflag;
 #define	OPOST	(1 << 0)	/* Perform output processing.  */
-#ifdef	__USE_BSD
+#if defined __USE_BSD || defined __USE_XOPEN
 # define ONLCR	(1 << 1)	/* Map NL to CR-NL on output.  */
+#endif
+#ifdef	__USE_BSD
 # define OXTABS	TAB3		/* Expand tabs to spaces.  */
 # define ONOEOT	(1 << 3)	/* Discard EOT (^D) on output.  */
 #endif

Modified: trunk/libc/elf/Makefile
==============================================================================
--- trunk/libc/elf/Makefile (original)
+++ trunk/libc/elf/Makefile Fri Jun 20 02:26:44 2008
@@ -847,10 +847,14 @@
 $(objpfx)tst-dlmodcount.out: $(test-modules)
 
 check-data := $(firstword $(wildcard \
-	        $(patsubst %,../scripts/data/localplt-%.data,\
-			   $(addsuffix -$(config-os),\
-			   	       $(config-machine) $(base-machine))\
-			   generic)))
+	        $(foreach D,$(add-ons) scripts/data,\
+	        	  $(patsubst %,$(..)$D/localplt-%.data,\
+			   	     $(abi-name) \
+			   	     $(addsuffix -$(config-os),\
+				     		 $(config-machine) \
+						 $(base-machine)) \
+			   generic))))
+
 tests: $(objpfx)check-localplt.out
 
 ifeq ($(have-thread-library),yes)

Modified: trunk/libc/elf/soinit.c
==============================================================================
--- trunk/libc/elf/soinit.c (original)
+++ trunk/libc/elf/soinit.c Fri Jun 20 02:26:44 2008
@@ -20,10 +20,6 @@
     (**list) ();
 }
 
-static const char __EH_FRAME_BEGIN__[]
-  __attribute__ ((used, section (".eh_frame")))
-  = { };
-
 /* This function will be called from _init in init-first.c.  */
 void
 __libc_global_ctors (void)

Modified: trunk/libc/iconvdata/Depend
==============================================================================
--- trunk/libc/iconvdata/Depend (original)
+++ trunk/libc/iconvdata/Depend Fri Jun 20 02:26:44 2008
@@ -1,1 +1,2 @@
 iconv
+localedata

Modified: trunk/libc/include/inline-hashtab.h
==============================================================================
--- trunk/libc/include/inline-hashtab.h (original)
+++ trunk/libc/include/inline-hashtab.h Fri Jun 20 02:26:44 2008
@@ -74,7 +74,7 @@
 
   while (low != high)
     {
-      const unsigned long *mid = low + (high - low) / 2;
+      const uint32_t *mid = low + (high - low) / 2;
       if (n > *mid)
 	low = mid + 1;
       else
@@ -142,8 +142,7 @@
   int i;
 
   for (i = htab->size - 1; i >= 0; i--)
-    if (htab->entries[i])
-      free (htab->entries[i]);
+    free (htab->entries[i]);
 
   if (htab->free)
     htab->free (htab->entries);

Modified: trunk/libc/libio/freopen.c
==============================================================================
--- trunk/libc/libio/freopen.c (original)
+++ trunk/libc/libio/freopen.c Fri Jun 20 02:26:44 2008
@@ -1,4 +1,4 @@
-/* Copyright (C) 1993,95,96,97,98,2000,2001,2002,2003
+/* Copyright (C) 1993,95,96,97,98,2000,2001,2002,2003,2008
 	Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -80,8 +80,7 @@
   if (fd != -1)
     {
       __close (fd);
-      if (filename != NULL)
-	free ((char *) filename);
+      free ((char *) filename);
     }
   _IO_release_lock (fp);
   return result;

Modified: trunk/libc/libio/freopen64.c
==============================================================================
--- trunk/libc/libio/freopen64.c (original)
+++ trunk/libc/libio/freopen64.c Fri Jun 20 02:26:44 2008
@@ -1,4 +1,4 @@
-/* Copyright (C) 1993,1995,1996,1997,1998,2000,2001,2002, 2003
+/* Copyright (C) 1993,1995,1996,1997,1998,2000,2001,2002, 2003, 2008
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -64,8 +64,7 @@
   if (fd != -1)
     {
       __close (fd);
-      if (filename != NULL)
-	free ((char *) filename);
+      free ((char *) filename);
     }
   _IO_release_lock (fp);
   return result;

Modified: trunk/libc/libio/stdio.h
==============================================================================
--- trunk/libc/libio/stdio.h (original)
+++ trunk/libc/libio/stdio.h Fri Jun 20 02:26:44 2008
@@ -475,7 +475,7 @@
 		       __isoc99_vfscanf)
      __attribute__ ((__format__ (__scanf__, 2, 0))) __wur;
 extern int __REDIRECT (vscanf, (__const char *__restrict __format,
-				_G_va_list __arg), __isoc99_vfscanf)
+				_G_va_list __arg), __isoc99_vscanf)
      __attribute__ ((__format__ (__scanf__, 1, 0))) __wur;
 extern int __REDIRECT (vsscanf,
 		       (__const char *__restrict __s,

Modified: trunk/libc/locale/programs/ld-collate.c
==============================================================================
--- trunk/libc/locale/programs/ld-collate.c (original)
+++ trunk/libc/locale/programs/ld-collate.c Fri Jun 20 02:26:44 2008
@@ -2817,8 +2817,7 @@
 	      else
 		{
 		col_elem_free:
-		  if (symbol != NULL)
-		    free ((char *) symbol);
+		  free ((char *) symbol);
 		  free (arg->val.str.startmb);
 		  free (arg->val.str.startwc);
 		}
@@ -2998,8 +2997,7 @@
 	      arg = lr_token (ldfile, charmap, result, repertoire, verbose);
 	      if (arg->tok != tok_bsymbol)
 		{
-		  if (newname != NULL)
-		    free ((char *) newname);
+		  free ((char *) newname);
 		  goto err_label;
 		}
 
@@ -3013,10 +3011,8 @@
 			    "LC_COLLATE");
 
 		sym_equiv_free:
-		  if (newname != NULL)
-		    free ((char *) newname);
-		  if (symname != NULL)
-		    free ((char *) symname);
+		  free ((char *) newname);
+		  free ((char *) symname);
 		  break;
 		}
 	      if (symname == NULL)

Modified: trunk/libc/localedata/ChangeLog
==============================================================================
--- trunk/libc/localedata/ChangeLog (original)
+++ trunk/libc/localedata/ChangeLog Fri Jun 20 02:26:44 2008
@@ -1,3 +1,8 @@
+2008-05-21  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	* locales/iso14651_t1_common: Remove U0C0D entry added for Telugu.
+	Reported by Pravin Satpute.
+
 2008-05-16  Ulrich Drepper  <drepper@xxxxxxxxxx>
 
 	* locales/iso14651_t1_common: Remove duplicate U0C7B definition.

Modified: trunk/libc/localedata/locales/iso14651_t1_common
==============================================================================
--- trunk/libc/localedata/locales/iso14651_t1_common (original)
+++ trunk/libc/localedata/locales/iso14651_t1_common Fri Jun 20 02:26:44 2008
@@ -3406,7 +3406,6 @@
 <U0C60> <tvw-vocalicrr>;<BAS>;<MIN>;IGNORE
 <U0C0C> <tvw-vocalicl>;<BAS>;<MIN>;IGNORE
 <U0C61> <tvw-vocalicll>;<BAS>;<MIN>;IGNORE
-<U0C0D> <tvw-candrae>;<BAS>;<MIN>;IGNORE
 <U0C0E> <tvw-shorte>;<BAS>;<MIN>;IGNORE
 <U0C0F> <tvw-e>;<BAS>;<MIN>;IGNORE
 <U0C10> <tvw-ai>;<BAS>;<MIN>;IGNORE
@@ -3416,8 +3415,6 @@
 <U0C15> <t-ka>;<BAS>;<MIN>;IGNORE
 <U0C16> <t-kha>;<BAS>;<MIN>;IGNORE
 <U0C17> <t-ga>;<BAS>;<MIN>;IGNORE
-#XXX This is wrong since there is already a definition for U0C7B.
-#<U0C7B> <t-gga>;<BAS>;<MIN>;IGNORE
 <U0C18> <t-gha>;<BAS>;<MIN>;IGNORE
 <U0C19> <t-nga>;<BAS>;<MIN>;IGNORE
 <U0C1A> <t-ca>;<BAS>;<MIN>;IGNORE

Modified: trunk/libc/math/libm-test.inc
==============================================================================
--- trunk/libc/math/libm-test.inc (original)
+++ trunk/libc/math/libm-test.inc Fri Jun 20 02:26:44 2008
@@ -2511,8 +2511,8 @@
   TEST_f_f (exp, 0.75L, 2.11700001661267466854536981983709561L);
   TEST_f_f (exp, 50.0L, 5184705528587072464087.45332293348538L);
   TEST_f_f (exp, 88.72269439697265625L, 3.40233126623160774937554134772290447915e38L);
-#ifdef TEST_LDOUBLE
-  /* The result can only be represented in long double.  */
+#if defined TEST_LDOUBLE && __LDBL_MAX_EXP__ > 1024
+  /* The result can only be represented in sane long double.  */
   TEST_f_f (exp, 1000.0L, 0.197007111401704699388887935224332313e435L);
 #endif
 

Modified: trunk/libc/misc/fstab.c
==============================================================================
--- trunk/libc/misc/fstab.c (original)
+++ trunk/libc/misc/fstab.c Fri Jun 20 02:26:44 2008
@@ -1,4 +1,5 @@
-/* Copyright (C) 1995, 1996, 1997, 1998, 2000 Free Software Foundation, Inc.
+/* Copyright (C) 1995, 1996, 1997, 1998, 2000, 2008
+   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
@@ -185,6 +186,5 @@
   char *buffer;
 
   buffer = fstab_state.fs_buffer;
-  if (buffer != NULL)
-    free ((void *) buffer);
+  free ((void *) buffer);
 }

Modified: trunk/libc/misc/regexp.h
==============================================================================
--- trunk/libc/misc/regexp.h (original)
+++ trunk/libc/misc/regexp.h Fri Jun 20 02:26:44 2008
@@ -1,4 +1,5 @@
-/* Copyright (C) 1996, 1997, 1998, 1999, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 1996, 1997, 1998, 1999, 2004, 2008
+   Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 1996.
 
@@ -129,8 +130,9 @@
   __expr_ptr = (regex_t *) expbuf;
   /* The remaining space in the buffer can be used for the compiled
      pattern.  */
-  __expr_ptr->buffer = expbuf + sizeof (regex_t);
-  __expr_ptr->allocated = endbuf -  (char *) __expr_ptr->buffer;
+  __expr_ptr->__REPB_PREFIX (buffer) = expbuf + sizeof (regex_t);
+  __expr_ptr->__REPB_PREFIX (allocated)
+    = endbuf - (char *) __expr_ptr->__REPB_PREFIX (buffer);
 
   while ((__ch = (GETC ())) != eof)
     {
@@ -162,7 +164,10 @@
 	}
       __input_buffer[__current_size++] = __ch;
     }
-  __input_buffer[__current_size++] = '\0';
+  if (__current_size)
+    __input_buffer[__current_size++] = '\0';
+  else
+    __input_buffer = "";
 
   /* Now compile the pattern.  */
   __error = regcomp (__expr_ptr, __input_buffer, REG_NEWLINE);
@@ -198,7 +203,8 @@
       }
 
   /* Everything is ok.  */
-  RETURN ((char *) (__expr_ptr->buffer + __expr_ptr->used));
+  RETURN ((char *) (__expr_ptr->__REPB_PREFIX (buffer)
+		    + __expr_ptr->__REPB_PREFIX (used)));
 }
 #endif
 

Modified: trunk/libc/nptl/ChangeLog
==============================================================================
--- trunk/libc/nptl/ChangeLog (original)
+++ trunk/libc/nptl/ChangeLog Fri Jun 20 02:26:44 2008
@@ -1,3 +1,48 @@
+2008-06-12  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	* sysdeps/pthread/pthread.h: Remove inadvertant checkin.
+
+2008-05-17  Samuel Thibault  <samuel.thibault@xxxxxxxxxxxx>
+
+	* sysdeps/pthread/pthread.h: Fix typo in comment.
+
+2008-05-28  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	* sysdeps/pthread/createthread.c (do_clone): Pass accurate length
+	of CPU set to the kernel.
+
+2008-05-23  Paul Pluzhnikov  <ppluzhnikov@xxxxxxxxxx>
+
+	* sysdeps/unix/sysv/linux/i386/i486/pthread_barrier_wait.S: Add
+	cfi directives.
+	* sysdeps/unix/sysv/linux/i386/i486/pthread_cond_broadcast.S: Likewise.
+	* sysdeps/unix/sysv/linux/i386/i486/pthread_cond_signal.S: Likewise.
+	* sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_rdlock.S: Likewise.
+	* sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_unlock.S: Likewise.
+	* sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_wrlock.S: Likewise.
+	* sysdeps/unix/sysv/linux/i386/i486/sem_post.S: Likewise.
+
+2008-05-22  Paul Pluzhnikov  <ppluzhnikov@xxxxxxxxxx>
+
+	* sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_timedrdlock.S: Add
+	cfi directives.
+	* sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_timedwrlock.S:
+	Likewise.
+	* sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedrdlock.S:
+	Likewise.
+	* sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedwrlock.S:
+	Likewise.
+
+2008-05-26  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	* tst-typesizes.c: Explicitly check __SIZEOF_PTHREAD_* constants.
+
+2008-05-20  Jakub Jelinek  <jakub@xxxxxxxxxx>
+
+	David S. Miller  <davem@xxxxxxxxxxxxx>
+
+	* sysdeps/unix/sysv/linux/sparc/sparc64/Makefile: New file.
+
 2008-05-10  Ulrich Drepper  <drepper@xxxxxxxxxx>
 
 	* sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_rdlock.S: Access

Modified: trunk/libc/nptl/Makefile
==============================================================================
--- trunk/libc/nptl/Makefile (original)
+++ trunk/libc/nptl/Makefile Fri Jun 20 02:26:44 2008
@@ -214,9 +214,9 @@
 	tst-robust6 tst-robust7 tst-robust8 tst-robust9 \
 	tst-robustpi1 tst-robustpi2 tst-robustpi3 tst-robustpi4 tst-robustpi5 \
 	tst-robustpi6 tst-robustpi7 tst-robustpi8 tst-robustpi9 \
-	tst-rwlock1 tst-rwlock2 tst-rwlock3 tst-rwlock4 tst-rwlock5 \
-	tst-rwlock6 tst-rwlock7 tst-rwlock8 tst-rwlock9 tst-rwlock10 \
-	tst-rwlock11 tst-rwlock12 tst-rwlock13 tst-rwlock14 \
+	tst-rwlock1 tst-rwlock2 tst-rwlock2a tst-rwlock3 tst-rwlock4 \
+	tst-rwlock5 tst-rwlock6 tst-rwlock7 tst-rwlock8 tst-rwlock9 \
+	tst-rwlock10 tst-rwlock11 tst-rwlock12 tst-rwlock13 tst-rwlock14 \
 	tst-once1 tst-once2 tst-once3 tst-once4 \
 	tst-key1 tst-key2 tst-key3 tst-key4 \
 	tst-sem1 tst-sem2 tst-sem3 tst-sem4 tst-sem5 tst-sem6 tst-sem7 \

Modified: trunk/libc/nptl/sysdeps/pthread/createthread.c
==============================================================================
--- trunk/libc/nptl/sysdeps/pthread/createthread.c (original)
+++ trunk/libc/nptl/sysdeps/pthread/createthread.c Fri Jun 20 02:26:44 2008
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2004, 2006, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2007, 2008 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 2002.
 
@@ -98,7 +98,7 @@
       if (attr->cpuset != NULL)
 	{
 	  res = INTERNAL_SYSCALL (sched_setaffinity, err, 3, pd->tid,
-				  sizeof (cpu_set_t), attr->cpuset);
+				  attr->cpusetsize, attr->cpuset);
 
 	  if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (res, err), 0))
 	    {

Modified: trunk/libc/nptl/sysdeps/pthread/pthread.h
==============================================================================
--- trunk/libc/nptl/sysdeps/pthread/pthread.h (original)
+++ trunk/libc/nptl/sysdeps/pthread/pthread.h Fri Jun 20 02:26:44 2008
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007
+/* Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -127,7 +127,7 @@
 #  if __WORDSIZE == 64
 #   define PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP \
   { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,					      \
-      PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP } }
+	PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP } }
 #  else
 #   if __BYTE_ORDER == __LITTLE_ENDIAN
 #    define PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP \
@@ -399,7 +399,7 @@
 
 
 /* Initialize thread attribute *ATTR with attributes corresponding to the
-   already running thread TH.  It shall be called on unitialized ATTR
+   already running thread TH.  It shall be called on uninitialized ATTR
    and destroyed with pthread_attr_destroy when no longer needed.  */
 extern int pthread_getattr_np (pthread_t __th, pthread_attr_t *__attr)
      __THROW __nonnull ((2));

Modified: trunk/libc/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_barrier_wait.S
==============================================================================
--- trunk/libc/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_barrier_wait.S (original)
+++ trunk/libc/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_barrier_wait.S Fri Jun 20 02:26:44 2008
@@ -27,7 +27,10 @@
 	.type	pthread_barrier_wait,@function
 	.align	16
 pthread_barrier_wait:
+	cfi_startproc
 	pushl	%ebx
+	cfi_adjust_cfa_offset(4)
+	cfi_offset(%ebx, -8)
 
 	movl	8(%esp), %ebx
 
@@ -45,6 +48,8 @@
 
 	/* There are more threads to come.  */
 	pushl	%esi
+	cfi_adjust_cfa_offset(4)
+	cfi_offset(%esi, -12)
 
 #if CURR_EVENT == 0
 	movl	(%ebx), %edx
@@ -101,9 +106,16 @@
 10:	movl	%esi, %eax		/* != PTHREAD_BARRIER_SERIAL_THREAD */
 
 	popl	%esi
+	cfi_adjust_cfa_offset(-4)
+	cfi_restore(%esi)
 	popl	%ebx
+	cfi_adjust_cfa_offset(-4)
+	cfi_restore(%ebx)
 	ret
 
+	cfi_adjust_cfa_offset(4)
+	cfi_offset(%ebx, -8)
+	
 	/* The necessary number of threads arrived.  */
 3:
 #if CURR_EVENT == 0
@@ -140,8 +152,12 @@
 5:	orl	$-1, %eax		/* == PTHREAD_BARRIER_SERIAL_THREAD */
 
 	popl	%ebx
+	cfi_adjust_cfa_offset(-4)
+	cfi_restore(%ebx)
 	ret
 
+	cfi_adjust_cfa_offset(4)
+	cfi_offset(%ebx, -8)
 1:	movl	PRIVATE(%ebx), %ecx
 	leal	MUTEX(%ebx), %edx
 	xorl	$LLL_SHARED, %ecx
@@ -154,6 +170,8 @@
 	call	__lll_unlock_wake
 	jmp	5b
 
+	cfi_adjust_cfa_offset(4)
+	cfi_offset(%esi, -12)
 6:	movl	PRIVATE(%ebx), %ecx
 	leal	MUTEX(%ebx), %eax
 	xorl	$LLL_SHARED, %ecx
@@ -165,4 +183,5 @@
 	xorl	$LLL_SHARED, %ecx
 	call	__lll_unlock_wake
 	jmp	10b
+	cfi_endproc
 	.size	pthread_barrier_wait,.-pthread_barrier_wait

Modified: trunk/libc/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_broadcast.S
==============================================================================
--- trunk/libc/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_broadcast.S (original)
+++ trunk/libc/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_broadcast.S Fri Jun 20 02:26:44 2008
@@ -32,11 +32,19 @@
 	.type	__pthread_cond_broadcast, @function
 	.align	16
 __pthread_cond_broadcast:
-
+	cfi_startproc
 	pushl	%ebx
+	cfi_adjust_cfa_offset(4)
 	pushl	%esi
+	cfi_adjust_cfa_offset(4)
 	pushl	%edi
+	cfi_adjust_cfa_offset(4)
 	pushl	%ebp
+	cfi_adjust_cfa_offset(4)
+	cfi_offset(%ebx, -8)
+	cfi_offset(%esi, -12)
+	cfi_offset(%edi, -16)
+	cfi_offset(%ebp, -20)
 
 	movl	20(%esp), %ebx
 
@@ -114,11 +122,24 @@
 
 10:	xorl	%eax, %eax
 	popl	%ebp
+	cfi_adjust_cfa_offset(-4)
+	cfi_restore(%ebp)
 	popl	%edi
+	cfi_adjust_cfa_offset(-4)
+	cfi_restore(%edi)
 	popl	%esi
+	cfi_adjust_cfa_offset(-4)
+	cfi_restore(%esi)
 	popl	%ebx
+	cfi_adjust_cfa_offset(-4)
+	cfi_restore(%ebx)
 	ret
 
+	cfi_adjust_cfa_offset(16)
+	cfi_offset(%ebx, -8)
+	cfi_offset(%esi, -12)
+	cfi_offset(%edi, -16)
+	cfi_offset(%ebp, -20)
 	.align	16
 	/* Unlock.  */
 4:	LOCK
@@ -127,11 +148,24 @@
 
 6:	xorl	%eax, %eax
 	popl	%ebp
+	cfi_adjust_cfa_offset(-4)
+	cfi_restore(%ebp)
 	popl	%edi
+	cfi_adjust_cfa_offset(-4)
+	cfi_restore(%edi)
 	popl	%esi
+	cfi_adjust_cfa_offset(-4)
+	cfi_restore(%esi)
 	popl	%ebx
+	cfi_adjust_cfa_offset(-4)
+	cfi_restore(%ebx)
 	ret
 
+	cfi_adjust_cfa_offset(16)
+	cfi_offset(%ebx, -8)
+	cfi_offset(%esi, -12)
+	cfi_offset(%edi, -16)
+	cfi_offset(%ebp, -20)
 	/* Initial locking failed.  */
 1:
 #if cond_lock == 0
@@ -199,6 +233,7 @@
 	movl	$SYS_futex, %eax
 	ENTER_KERNEL
 	jmp	10b
+	cfi_endproc
 	.size	__pthread_cond_broadcast, .-__pthread_cond_broadcast
 versioned_symbol (libpthread, __pthread_cond_broadcast, pthread_cond_broadcast,
 		  GLIBC_2_3_2)

Modified: trunk/libc/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_signal.S
==============================================================================
--- trunk/libc/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_signal.S (original)
+++ trunk/libc/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_signal.S Fri Jun 20 02:26:44 2008
@@ -33,8 +33,13 @@
 	.align	16
 __pthread_cond_signal:
 
+	cfi_startproc
 	pushl	%ebx
+	cfi_adjust_cfa_offset(4)
 	pushl	%edi
+	cfi_adjust_cfa_offset(4)
+	cfi_offset(%ebx, -8)
+	cfi_offset(%edi, -12)
 
 	movl	12(%esp), %edi
 
@@ -69,7 +74,12 @@
 
 	/* Wake up one thread.  */
 	pushl	%esi
+	cfi_adjust_cfa_offset(4)
 	pushl	%ebp
+	cfi_adjust_cfa_offset(4)
+	cfi_offset(%esi, -16)
+	cfi_offset(%ebp, -20)
+
 #if FUTEX_PRIVATE_FLAG > 255
 	xorl	%ecx, %ecx
 #endif
@@ -91,7 +101,11 @@
 	ENTER_KERNEL  */
 	int	$0x80
 	popl	%ebp
+	cfi_adjust_cfa_offset(-4)
+	cfi_restore(%ebp)
 	popl	%esi
+	cfi_adjust_cfa_offset(-4)
+	cfi_restore(%esi)
 
 	/* For any kind of error, we try again with WAKE.
 	   The general test also covers running on old kernels.  */
@@ -100,8 +114,16 @@
 
 6:	xorl	%eax, %eax
 	popl	%edi
+	cfi_adjust_cfa_offset(-4)
+	cfi_restore(%edi)
 	popl	%ebx
+	cfi_adjust_cfa_offset(-4)
+	cfi_restore(%ebx)
 	ret
+
+	cfi_adjust_cfa_offset(8)
+	cfi_offset(%ebx, -8)
+	cfi_offset(%edi, -12)
 
 7:	/* %ecx should be either FUTEX_WAKE_OP or
 	   FUTEX_WAKE_OP|FUTEX_PRIVATE_FLAG from the previous syscall.  */
@@ -152,6 +174,7 @@
 	call	__lll_lock_wait
 	jmp	2b
 
+	cfi_endproc
 	.size	__pthread_cond_signal, .-__pthread_cond_signal
 versioned_symbol (libpthread, __pthread_cond_signal, pthread_cond_signal,
 		  GLIBC_2_3_2)

Modified: trunk/libc/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_rdlock.S
==============================================================================
--- trunk/libc/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_rdlock.S (original)
+++ trunk/libc/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_rdlock.S Fri Jun 20 02:26:44 2008
@@ -30,8 +30,13 @@
 	.type	__pthread_rwlock_rdlock,@function
 	.align	16
 __pthread_rwlock_rdlock:
+	cfi_startproc
 	pushl	%esi
+	cfi_adjust_cfa_offset(4)
 	pushl	%ebx
+	cfi_adjust_cfa_offset(4)
+	cfi_offset(%esi, -8)
+	cfi_offset(%ebx, -12)
 
 	xorl	%esi, %esi
 	movl	12(%esp), %ebx
@@ -113,9 +118,16 @@
 
 	movl	%edx, %eax
 	popl	%ebx
+	cfi_adjust_cfa_offset(-4)
+	cfi_restore(%ebx)
 	popl	%esi
+	cfi_adjust_cfa_offset(-4)
+	cfi_restore(%esi)
 	ret
 
+	cfi_adjust_cfa_offset(8)
+	cfi_offset(%esi, -8)
+	cfi_offset(%ebx, -12)
 1:
 #if MUTEX == 0
 	movl	%ebx, %edx
@@ -171,6 +183,7 @@
 	movzbl	PSHARED(%ebx), %ecx
 	call	__lll_lock_wait
 	jmp	13b
+	cfi_endproc
 	.size	__pthread_rwlock_rdlock,.-__pthread_rwlock_rdlock
 
 	.globl	pthread_rwlock_rdlock

Modified: trunk/libc/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_timedrdlock.S
==============================================================================
--- trunk/libc/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_timedrdlock.S (original)
+++ trunk/libc/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_timedrdlock.S Fri Jun 20 02:26:44 2008
@@ -30,11 +30,21 @@
 	.type	pthread_rwlock_timedrdlock,@function
 	.align	16
 pthread_rwlock_timedrdlock:
+	cfi_startproc
 	pushl	%esi
+	cfi_adjust_cfa_offset(4)
 	pushl	%edi
+	cfi_adjust_cfa_offset(4)
 	pushl	%ebx
+	cfi_adjust_cfa_offset(4)
 	pushl	%ebp
+	cfi_adjust_cfa_offset(4)
+	cfi_offset(%esi, -8)
+	cfi_offset(%edi, -12)
+	cfi_offset(%ebx, -16)
+	cfi_offset(%ebp, -20)
 	subl	$8, %esp
+	cfi_adjust_cfa_offset(8)
 
 	movl	28(%esp), %ebp
 	movl	32(%esp), %edi
@@ -150,12 +160,26 @@
 7:	movl	%edx, %eax
 
 	addl	$8, %esp
+	cfi_adjust_cfa_offset(-8)
 	popl	%ebp
+	cfi_adjust_cfa_offset(-4)
+	cfi_restore(%ebp)
 	popl	%ebx
+	cfi_adjust_cfa_offset(-4)
+	cfi_restore(%ebx)
 	popl	%edi
+	cfi_adjust_cfa_offset(-4)
+	cfi_restore(%edi)
 	popl	%esi
+	cfi_adjust_cfa_offset(-4)
+	cfi_restore(%esi)
 	ret
 
+	cfi_adjust_cfa_offset(24)
+	cfi_offset(%esi, -8)
+	cfi_offset(%edi, -12)
+	cfi_offset(%ebx, -16)
+	cfi_offset(%ebp, -20)
 1:
 #if MUTEX == 0
 	movl	%ebp, %edx
@@ -216,4 +240,5 @@
 
 19:	movl	$EINVAL, %edx
 	jmp	9b
+	cfi_endproc
 	.size	pthread_rwlock_timedrdlock,.-pthread_rwlock_timedrdlock

Modified: trunk/libc/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_timedwrlock.S
==============================================================================
--- trunk/libc/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_timedwrlock.S (original)
+++ trunk/libc/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_timedwrlock.S Fri Jun 20 02:26:44 2008
@@ -30,11 +30,21 @@
 	.type	pthread_rwlock_timedwrlock,@function
 	.align	16
 pthread_rwlock_timedwrlock:
+	cfi_startproc
 	pushl	%esi
+	cfi_adjust_cfa_offset(4)
 	pushl	%edi
+	cfi_adjust_cfa_offset(4)
 	pushl	%ebx
+	cfi_adjust_cfa_offset(4)
 	pushl	%ebp
+	cfi_adjust_cfa_offset(4)
+	cfi_offset(%esi, -8)
+	cfi_offset(%edi, -12)
+	cfi_offset(%ebx, -16)
+	cfi_offset(%ebp, -20)
 	subl	$8, %esp
+	cfi_adjust_cfa_offset(8)
 
 	movl	28(%esp), %ebp
 	movl	32(%esp), %edi
@@ -148,12 +158,26 @@
 7:	movl	%edx, %eax
 
 	addl	$8, %esp
+	cfi_adjust_cfa_offset(-8)
 	popl	%ebp
+	cfi_adjust_cfa_offset(-4)
+	cfi_restore(%ebp)
 	popl	%ebx
+	cfi_adjust_cfa_offset(-4)
+	cfi_restore(%ebx)
 	popl	%edi
+	cfi_adjust_cfa_offset(-4)
+	cfi_restore(%edi)
 	popl	%esi
+	cfi_adjust_cfa_offset(-4)
+	cfi_restore(%esi)
 	ret
 
+	cfi_adjust_cfa_offset(24)
+	cfi_offset(%esi, -8)
+	cfi_offset(%edi, -12)
+	cfi_offset(%ebx, -16)
+	cfi_offset(%ebp, -20)
 1:
 #if MUTEX == 0
 	movl	%ebp, %edx
@@ -209,4 +233,5 @@
 
 19:	movl	$EINVAL, %edx
 	jmp	9b
+	cfi_endproc
 	.size	pthread_rwlock_timedwrlock,.-pthread_rwlock_timedwrlock

Modified: trunk/libc/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_unlock.S
==============================================================================
--- trunk/libc/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_unlock.S (original)
+++ trunk/libc/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_unlock.S Fri Jun 20 02:26:44 2008
@@ -29,8 +29,13 @@
 	.type	__pthread_rwlock_unlock,@function
 	.align	16
 __pthread_rwlock_unlock:
+	cfi_startproc
 	pushl	%ebx
+	cfi_adjust_cfa_offset(4)
 	pushl	%edi
+	cfi_adjust_cfa_offset(4)
+	cfi_offset(%ebx, -8)
+	cfi_offset(%edi, -12)
 
 	movl	12(%esp), %edi
 
@@ -87,9 +92,16 @@
 
 	xorl	%eax, %eax
 	popl	%edi
+	cfi_adjust_cfa_offset(-4)
+	cfi_restore(%edi)
 	popl	%ebx
+	cfi_adjust_cfa_offset(-4)
+	cfi_restore(%ebx)
 	ret
 
+	cfi_adjust_cfa_offset(8)
+	cfi_offset(%ebx, -8)
+	cfi_offset(%edi, -12)
 	.align	16
 6:	LOCK
 #if MUTEX == 0
@@ -133,7 +145,7 @@
 	movzbl	PSHARED(%edi), %ecx
 	call	__lll_unlock_wake
 	jmp	8b
-
+	cfi_endproc
 	.size	__pthread_rwlock_unlock,.-__pthread_rwlock_unlock
 
 	.globl	pthread_rwlock_unlock

Modified: trunk/libc/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_wrlock.S
==============================================================================
--- trunk/libc/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_wrlock.S (original)
+++ trunk/libc/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_wrlock.S Fri Jun 20 02:26:44 2008
@@ -30,8 +30,13 @@
 	.type	__pthread_rwlock_wrlock,@function
 	.align	16
 __pthread_rwlock_wrlock:
+	cfi_startproc
 	pushl	%esi
+	cfi_adjust_cfa_offset(4)
 	pushl	%ebx
+	cfi_adjust_cfa_offset(4)
+	cfi_offset(%esi, -8)
+	cfi_offset(%ebx, -12)
 
 	xorl	%esi, %esi
 	movl	12(%esp), %ebx
@@ -111,9 +116,16 @@
 
 	movl	%edx, %eax
 	popl	%ebx
+	cfi_adjust_cfa_offset(-4)
+	cfi_restore(%ebx)
 	popl	%esi
+	cfi_adjust_cfa_offset(-4)
+	cfi_restore(%esi)
 	ret
 
+	cfi_adjust_cfa_offset(8)
+	cfi_offset(%esi, -8)
+	cfi_offset(%ebx, -12)
 1:
 #if MUTEX == 0
 	movl	%ebx, %edx
@@ -162,6 +174,7 @@
 	movzbl	PSHARED(%ebx), %ecx
 	call	__lll_lock_wait
 	jmp	13b
+	cfi_endproc
 	.size	__pthread_rwlock_wrlock,.-__pthread_rwlock_wrlock
 
 	.globl	pthread_rwlock_wrlock

Modified: trunk/libc/nptl/sysdeps/unix/sysv/linux/i386/i486/sem_post.S
==============================================================================
--- trunk/libc/nptl/sysdeps/unix/sysv/linux/i386/i486/sem_post.S (original)
+++ trunk/libc/nptl/sysdeps/unix/sysv/linux/i386/i486/sem_post.S Fri Jun 20 02:26:44 2008
@@ -30,7 +30,10 @@
 	.type	__new_sem_post,@function
 	.align	16
 __new_sem_post:
+	cfi_startproc
 	pushl	%ebx
+	cfi_adjust_cfa_offset(4)
+	cfi_offset(%ebx, -8)
 
 	movl	8(%esp), %ebx
 
@@ -64,8 +67,12 @@
 
 2:	xorl	%eax, %eax
 	popl	%ebx
+	cfi_adjust_cfa_offset(-4)
+	cfi_restore(%ebx)
 	ret
 
+	cfi_adjust_cfa_offset(4)
+	cfi_offset(%ebx, -8)
 1:
 #ifdef PIC
 	call	__i686.get_pc_thunk.bx
@@ -116,14 +123,20 @@
 
 	orl	$-1, %eax
 	popl	%ebx
+	cfi_adjust_cfa_offset(-4)
+	cfi_restore(%ebx)
 	ret
+	cfi_endproc
 	.size	__new_sem_post,.-__new_sem_post
 	versioned_symbol(libpthread, __new_sem_post, sem_post, GLIBC_2_1)
 #if SHLIB_COMPAT(libpthread, GLIBC_2_0, GLIBC_2_1)
 	.global	__old_sem_post
 	.type	__old_sem_post,@function
 __old_sem_post:
+	cfi_startproc
 	pushl	%ebx
+	cfi_adjust_cfa_offset(4)
+	cfi_offset(%ebx, -8)
 
 	movl	8(%esp), %ebx
 	LOCK
@@ -139,7 +152,10 @@
 
 	xorl	%eax, %eax
 	popl	%ebx
+	cfi_adjust_cfa_offset(-4)
+	cfi_restore(%ebx)
 	ret
+	cfi_endproc
 	.size	__old_sem_post,.-__old_sem_post
 	compat_symbol(libpthread, __old_sem_post, sem_post, GLIBC_2_0)
 #endif

Modified: trunk/libc/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedrdlock.S
==============================================================================
--- trunk/libc/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedrdlock.S (original)
+++ trunk/libc/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedrdlock.S Fri Jun 20 02:26:44 2008
@@ -33,10 +33,19 @@
 	.type	pthread_rwlock_timedrdlock,@function
 	.align	16
 pthread_rwlock_timedrdlock:
+	cfi_startproc
 	pushq	%r12
+	cfi_adjust_cfa_offset(8)
 	pushq	%r13
+	cfi_adjust_cfa_offset(8)
 	pushq	%r14
+	cfi_adjust_cfa_offset(8)
+	cfi_offset(%r12, -16)
+	cfi_offset(%r13, -24)
+	cfi_offset(%r14, -32)
+
 	subq	$16, %rsp
+	cfi_adjust_cfa_offset(16)
 
 	movq	%rdi, %r12
 	movq	%rsi, %r13
@@ -155,11 +164,22 @@
 7:	movq	%rdx, %rax
 
 	addq	$16, %rsp
+	cfi_adjust_cfa_offset(-16)
 	popq	%r14
+	cfi_adjust_cfa_offset(-8)
+	cfi_restore(%r14)
 	popq	%r13
+	cfi_adjust_cfa_offset(-8)
+	cfi_restore(%r13)
 	popq	%r12
+	cfi_adjust_cfa_offset(-8)
+	cfi_restore(%r12)
 	retq
 
+	cfi_adjust_cfa_offset(40)
+	cfi_offset(%r12, -16)
+	cfi_offset(%r13, -24)
+	cfi_offset(%r14, -32)
 1:	movl	PSHARED(%rdi), %esi
 #if MUTEX != 0
 	addq	$MUTEX, %rdi
@@ -214,4 +234,5 @@
 
 19:	movl	$EINVAL, %edx
 	jmp	9b
+	cfi_endproc
 	.size	pthread_rwlock_timedrdlock,.-pthread_rwlock_timedrdlock

Modified: trunk/libc/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedwrlock.S
==============================================================================
--- trunk/libc/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedwrlock.S (original)
+++ trunk/libc/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedwrlock.S Fri Jun 20 02:26:44 2008
@@ -33,10 +33,19 @@
 	.type	pthread_rwlock_timedwrlock,@function
 	.align	16
 pthread_rwlock_timedwrlock:
+	cfi_startproc
 	pushq	%r12
+	cfi_adjust_cfa_offset(8)
 	pushq	%r13
+	cfi_adjust_cfa_offset(8)
 	pushq	%r14
+	cfi_adjust_cfa_offset(8)
+	cfi_offset(%r12, -16)
+	cfi_offset(%r13, -24)
+	cfi_offset(%r14, -32)
+
 	subq	$16, %rsp
+	cfi_adjust_cfa_offset(16)
 
 	movq	%rdi, %r12
 	movq	%rsi, %r13
@@ -152,11 +161,22 @@
 7:	movq	%rdx, %rax
 
 	addq	$16, %rsp
+	cfi_adjust_cfa_offset(-16)
 	popq	%r14
+	cfi_adjust_cfa_offset(-8)
+	cfi_restore(%r14)
 	popq	%r13
+	cfi_adjust_cfa_offset(-8)
+	cfi_restore(%r13)
 	popq	%r12
+	cfi_adjust_cfa_offset(-8)
+	cfi_restore(%r12)
 	retq
 
+	cfi_adjust_cfa_offset(40)
+	cfi_offset(%r12, -16)
+	cfi_offset(%r13, -24)
+	cfi_offset(%r14, -32)
 1:	movl	PSHARED(%rdi), %esi
 #if MUTEX != 0
 	addq	$MUTEX, %rdi
@@ -206,4 +226,5 @@
 
 19:	movl	$EINVAL, %edx
 	jmp	9b
+	cfi_endproc
 	.size	pthread_rwlock_timedwrlock,.-pthread_rwlock_timedwrlock

Modified: trunk/libc/nptl/tst-rwlock2.c
==============================================================================
--- trunk/libc/nptl/tst-rwlock2.c (original)
+++ trunk/libc/nptl/tst-rwlock2.c Fri Jun 20 02:26:44 2008
@@ -26,14 +26,40 @@
 do_test (void)
 {
   pthread_rwlock_t r;
+  pthread_rwlockattr_t at;
   int e;
 
-  if (pthread_rwlock_init (&r, NULL) != 0)
+  if (pthread_rwlockattr_init (&at) != 0)
+    {
+      puts ("rwlockattr_init failed");
+      return 1;
+    }
+  puts ("rwlockattr_init succeeded");
+
+#ifndef TYPE
+# define TYPE PTHREAD_RWLOCK_PREFER_READER_NP
+#endif
+
+  if (pthread_rwlockattr_setkind_np (&at, TYPE) != 0)
+    {
+      puts ("rwlockattr_setkind failed");
+      return 1;
+    }
+  puts ("rwlockattr_setkind succeeded");
+
+  if (pthread_rwlock_init (&r, &at) != 0)
     {
       puts ("rwlock_init failed");
       return 1;
     }
   puts ("rwlock_init succeeded");
+
+  if (pthread_rwlockattr_destroy (&at) != 0)
+    {
+      puts ("rwlockattr_destroy failed");
+      return 1;
+    }
+  puts ("rwlockattr_destroy succeeded");
 
   if (pthread_rwlock_wrlock (&r) != 0)
     {

Modified: trunk/libc/nptl/tst-typesizes.c
==============================================================================
--- trunk/libc/nptl/tst-typesizes.c (original)
+++ trunk/libc/nptl/tst-typesizes.c Fri Jun 20 02:26:44 2008
@@ -1,4 +1,4 @@
-/* Copyright (C) 2005, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 2005, 2007, 2008 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 2005.
 
@@ -21,6 +21,25 @@
 #include <pthreadP.h>
 #include <semaphore.h>
 
+static const struct
+{
+  const char *name;
+  size_t expected;
+  size_t is;
+} types[] =
+  {
+#define T(t, c) \
+    { #t, c, sizeof (t) }
+    T (pthread_attr_t, __SIZEOF_PTHREAD_ATTR_T),
+    T (pthread_mutex_t, __SIZEOF_PTHREAD_MUTEX_T),
+    T (pthread_mutexattr_t, __SIZEOF_PTHREAD_MUTEXATTR_T),
+    T (pthread_cond_t, __SIZEOF_PTHREAD_COND_T),
+    T (pthread_condattr_t, __SIZEOF_PTHREAD_CONDATTR_T),
+    T (pthread_rwlock_t, __SIZEOF_PTHREAD_RWLOCK_T),
+    T (pthread_rwlockattr_t, __SIZEOF_PTHREAD_RWLOCKATTR_T),
+    T (pthread_barrier_t, __SIZEOF_PTHREAD_BARRIER_T),
+    T (pthread_barrierattr_t, __SIZEOF_PTHREAD_BARRIERATTR_T)
+  };
 
 static int
 do_test (void)
@@ -62,6 +81,14 @@
   TEST_TYPE2 (sem_t, struct new_sem);
   TEST_TYPE2 (sem_t, struct old_sem);
 
+  for (size_t i = 0; i < sizeof (types) / sizeof (types[0]); ++i)
+    if (types[i].expected != types[i].is)
+      {
+	printf ("%s: expected %zu, is %zu\n",
+		types[i].name, types[i].expected, types[i].is);
+	result = 1;
+      }
+
   return result;
 }
 

Modified: trunk/libc/nscd/aicache.c
==============================================================================
--- trunk/libc/nscd/aicache.c (original)
+++ trunk/libc/nscd/aicache.c Fri Jun 20 02:26:44 2008
@@ -114,7 +114,6 @@
   char *tmpbuf6 = alloca (tmpbuf6len);
   size_t tmpbuf4len = 0;
   char *tmpbuf4 = NULL;
-  char *canon = NULL;
   int32_t ttl = INT32_MAX;
   ssize_t total = 0;
   char *key_copy = NULL;
@@ -126,6 +125,7 @@
       int status[2] = { NSS_STATUS_UNAVAIL, NSS_STATUS_UNAVAIL };
       int naddrs = 0;
       size_t addrslen = 0;
+      char *canon = NULL;
       size_t canonlen;
 
       nss_gethostbyname4_r fct4 = __nss_lookup_function (nip,
@@ -136,9 +136,11 @@
 	  while (1)
 	    {
 	      rc6 = 0;
-	      status[0] = DL_CALL_FCT (fct4, (key, &at, tmpbuf6, tmpbuf6len,
+	      herrno = 0;
+	      status[1] = DL_CALL_FCT (fct4, (key, &at, tmpbuf6, tmpbuf6len,
 					      &rc6, &herrno, &ttl));
-	      if (rc6 != ERANGE || herrno != NETDB_INTERNAL)
+	      if (rc6 != ERANGE || (herrno != NETDB_INTERNAL
+				    && herrno != TRY_AGAIN))
 		break;
 	      tmpbuf6 = extend_alloca (tmpbuf6, tmpbuf6len, 2 * tmpbuf6len);
 	    }
@@ -146,22 +148,21 @@
 	  if (rc6 != 0 && herrno == NETDB_INTERNAL)
 	    goto out;
 
-	  if (status[0] != NSS_STATUS_SUCCESS)
+	  if (status[1] != NSS_STATUS_SUCCESS)
 	    goto next_nip;
 
 	  /* We found the data.  Count the addresses and the size.  */
-	  for (struct gaih_addrtuple *at2 = at; at2 != NULL; at2 = at2->next)
+	  for (const struct gaih_addrtuple *at2 = at; at2 != NULL;
+	       at2 = at2->next)
 	    {
 	      ++naddrs;
-	      /* We handle unknown types here the best we can: assume
-		 the maximum size for the address.  */
+	      /* We do not handle anything other than IPv4 and IPv6
+		 addresses.  The getaddrinfo implementation does not
+		 either so it is not worth trying to do more.  */
 	      if (at2->family == AF_INET)
 		addrslen += INADDRSZ;
-	      else if (at2->family == AF_INET6
-		       && IN6ADDRSZ != sizeof (at2->addr))
+	      else if (at2->family == AF_INET6)
 		addrslen += IN6ADDRSZ;
-	      else
-		addrslen += sizeof (at2->addr);
 	    }
 	  canon = at->name;
 	  canonlen = strlen (canon) + 1;
@@ -191,19 +192,17 @@
 	    }
 
 	  /* Fill in the address and address families.  */
-	  char *addrs = (char *) (&dataset->resp + 1);
+	  char *addrs = dataset->strdata;
 	  uint8_t *family = (uint8_t *) (addrs + addrslen);
 
-	  for (struct gaih_addrtuple *at2 = at; at2 != NULL; at2 = at2->next)
+	  for (const struct gaih_addrtuple *at2 = at; at2 != NULL;
+	       at2 = at2->next)
 	    {
 	      *family++ = at2->family;
 	      if (at2->family == AF_INET)
 		addrs = mempcpy (addrs, at2->addr, INADDRSZ);
-	      else if (at2->family == AF_INET6
-		       && IN6ADDRSZ != sizeof (at2->addr))
+	      else if (at2->family == AF_INET6)
 		addrs = mempcpy (addrs, at2->addr, IN6ADDRSZ);
-	      else
-		addrs = mempcpy (addrs, at2->addr, sizeof (at2->addr));
 	    }
 
 	  cp = family;
@@ -373,7 +372,7 @@
 	    }
 
 	  /* Fill in the address and address families.  */
-	  char *addrs = (char *) (&dataset->resp + 1);
+	  char *addrs = dataset->strdata;
 	  uint8_t *family = (uint8_t *) (addrs + addrslen);
 
 	  for (int j = 0; j < 2; ++j)
@@ -410,6 +409,8 @@
 	cp = mempcpy (cp, canon, canonlen);
 
       key_copy = memcpy (cp, key, req->key_len);
+
+      assert (cp == (char *) dataset + total);
 
       /* Now we can determine whether on refill we have to create a
 	 new record or not.  */
@@ -557,7 +558,7 @@
       pthread_rwlock_rdlock (&db->lock);
 
       (void) cache_add (req->type, key_copy, req->key_len, &dataset->head,
-			true, db, uid);
+			true, db, uid, he == NULL);
 
       pthread_rwlock_unlock (&db->lock);
 

Modified: trunk/libc/nscd/cache.c
==============================================================================
--- trunk/libc/nscd/cache.c (original)
+++ trunk/libc/nscd/cache.c Fri Jun 20 02:26:44 2008
@@ -135,7 +135,7 @@
 int
 cache_add (int type, const void *key, size_t len, struct datahead *packet,
 	   bool first, struct database_dyn *table,
-	   uid_t owner)
+	   uid_t owner, bool prune_wakeup)
 {
   if (__builtin_expect (debug_level >= 2, 0))
     {
@@ -180,6 +180,7 @@
   assert (newp->key + newp->len <= table->head->first_free);
   newp->owner = owner;
   newp->packet = (char *) packet - table->data;
+  assert ((newp->packet & BLOCK_ALIGN_M1) == 0);
 
   /* Put the new entry in the first position.  */
   do
@@ -211,19 +212,27 @@
 	   (char *) &table->head->array[hash] - (char *) table->head
 	   + sizeof (ref_t), MS_ASYNC);
 
-  /* Perhaps the prune thread for the data is not running in a long
-     time.  Wake it if necessary.  */
-  time_t next_wakeup = table->wakeup_time;
-  while (next_wakeup + CACHE_PRUNE_INTERVAL > packet->timeout)
-    if (atomic_compare_and_exchange_bool_acq (&table->wakeup_time,
-					      packet->timeout,
-					      next_wakeup) == 0)
-      {
+  /* We do not have to worry about the pruning thread if we are
+     re-adding the data since this is done by the pruning thread.  We
+     also do not have to do anything in case this is not the first
+     time the data is entered since different data heads all have the
+     same timeout.  */
+  if (first && prune_wakeup)
+    {
+      /* Perhaps the prune thread for the table is not running in a long
+	 time.  Wake it if necessary.  */
+      pthread_mutex_lock (&table->prune_lock);
+      time_t next_wakeup = table->wakeup_time;
+      bool do_wakeup = false;
+      if (next_wakeup > packet->timeout + CACHE_PRUNE_INTERVAL)
+	{
+	  table->wakeup_time = packet->timeout;
+	  do_wakeup = true;
+	}
+      pthread_mutex_unlock (&table->prune_lock);
+      if (do_wakeup)
 	pthread_cond_signal (&table->prune_cond);
-	break;
-      }
-    else
-      next_wakeup = table->wakeup_time;
+    }
 
   /* Mark the in-flight memory as unused.  */
   for (enum in_flight idx = 0; idx < IDX_last; ++idx)
@@ -265,7 +274,7 @@
 
   /* If we check for the modification of the underlying file we invalidate
      the entries also in this case.  */
-  if (table->check_file && now != LONG_MAX)
+  if (table->inotify_descr < 0 && table->check_file && now != LONG_MAX)
     {
       struct stat64 st;
 
@@ -436,7 +445,8 @@
 	      ref_t *old = &table->head->array[first];
 	      ref_t run = table->head->array[first];
 
-	      while (run != ENDREF)
+	      assert (run != ENDREF);
+	      do
 		{
 		  struct hashentry *runp = (struct hashentry *) (data + run);
 		  struct datahead *dh
@@ -462,6 +472,7 @@
 		      run = runp->next;
 		    }
 		}
+	      while (run != ENDREF);
 	    }
 
 	  ++first;

Modified: trunk/libc/nscd/connections.c
==============================================================================
--- trunk/libc/nscd/connections.c (original)
+++ trunk/libc/nscd/connections.c Fri Jun 20 02:26:44 2008
@@ -35,6 +35,9 @@
 #ifdef HAVE_EPOLL
 # include <sys/epoll.h>
 #endif
+#ifdef HAVE_INOTIFY
+# include <sys/inotify.h>
+#endif
 #include <sys/mman.h>
 #include <sys/param.h>
 #include <sys/poll.h>
@@ -48,6 +51,7 @@
 #include "nscd.h"
 #include "dbg_log.h"
 #include "selinux.h"
+#include <resolv/resolv.h>
 #ifdef HAVE_SENDFILE
 # include <kernel-features.h>
 #endif
@@ -222,6 +226,14 @@
 /* Socket for incoming connections.  */
 static int sock;
 
+#ifdef HAVE_INOTIFY
+/* Inotify descriptor.  */
+static int inotify_fd = -1;
+
+/* Watch descriptor for resolver configuration file.  */
+static int resolv_conf_descr = -1;
+#endif
+
 /* Number of times clients had to wait.  */
 unsigned long int client_queued;
 
@@ -502,6 +514,13 @@
   if (nthreads == -1)
     /* No configuration for this value, assume a default.  */
     nthreads = 4;
+
+#ifdef HAVE_INOTIFY
+  /* Use inotify to recognize changed files.  */
+  inotify_fd = inotify_init ();
+  if (inotify_fd != -1)
+    fcntl (inotify_fd, F_SETFL, O_NONBLOCK);
+#endif
 
   for (size_t cnt = 0; cnt < lastdb; ++cnt)
     if (dbs[cnt].enabled)
@@ -805,21 +824,39 @@
 	    assert (dbs[cnt].ro_fd == -1);
 	  }
 
+	dbs[cnt].inotify_descr = -1;
 	if (dbs[cnt].check_file)
 	  {
-	    /* We need the modification date of the file.  */
-	    struct stat64 st;
-
-	    if (stat64 (dbs[cnt].filename, &st) < 0)
+#ifdef HAVE_INOTIFY
+	    if (inotify_fd < 0
+		|| (dbs[cnt].inotify_descr
+		    = inotify_add_watch (inotify_fd, dbs[cnt].filename,
+					 IN_DELETE_SELF | IN_MODIFY)) < 0)
+	      /* We cannot notice changes in the main thread.  */
+#endif
 	      {
-		/* We cannot stat() the file, disable file checking.  */
-		dbg_log (_("cannot stat() file `%s': %s"),
-			 dbs[cnt].filename, strerror (errno));
-		dbs[cnt].check_file = 0;
+		/* We need the modification date of the file.  */
+		struct stat64 st;
+
+		if (stat64 (dbs[cnt].filename, &st) < 0)
+		  {
+		    /* We cannot stat() the file, disable file checking.  */
+		    dbg_log (_("cannot stat() file `%s': %s"),
+			     dbs[cnt].filename, strerror (errno));
+		    dbs[cnt].check_file = 0;
+		  }
+		else
+		  dbs[cnt].file_mtime = st.st_mtime;
 	      }
-	    else
-	      dbs[cnt].file_mtime = st.st_mtime;
 	  }
+
+#ifdef HAVE_INOTIFY
+	if (cnt == hstdb && inotify_fd >= -1)
+	  /* We also monitor the resolver configuration file.  */
+	  resolv_conf_descr = inotify_add_watch (inotify_fd,
+						 _PATH_RESCONF,
+						 IN_DELETE_SELF | IN_MODIFY);
+#endif
       }
 
   /* Create the socket.  */
@@ -1330,11 +1367,14 @@
     }
 
   /* Synchronize memory.  */
+  int32_t certainly[lastdb];
   for (int cnt = 0; cnt < lastdb; ++cnt)
     if (dbs[cnt].enabled)
       {
 	/* Make sure nobody keeps using the database.  */
 	dbs[cnt].head->timestamp = 0;
+	certainly[cnt] = dbs[cnt].head->nscd_certainly_running;
+	dbs[cnt].head->nscd_certainly_running = 0;
 
 	if (dbs[cnt].persistent)
 	  // XXX async OK?
@@ -1357,6 +1397,15 @@
     dbg_log (_("cannot change current working directory to \"/\": %s"),
 	     strerror (errno));
   paranoia = 0;
+
+  /* Reenable the databases.  */
+  time_t now = time (NULL);
+  for (int cnt = 0; cnt < lastdb; ++cnt)
+    if (dbs[cnt].enabled)
+      {
+	dbs[cnt].head->timestamp = now;
+	dbs[cnt].head->nscd_certainly_running = certainly[cnt];
+      }
 }
 
 
@@ -1394,42 +1443,75 @@
 
   int dont_need_update = setup_thread (&dbs[my_number]);
 
+  time_t now = time (NULL);
+
   /* We are running.  */
-  dbs[my_number].head->timestamp = time (NULL);
+  dbs[my_number].head->timestamp = now;
 
   struct timespec prune_ts;
-  if (clock_gettime (timeout_clock, &prune_ts) == -1)
+  if (__builtin_expect (clock_gettime (timeout_clock, &prune_ts) == -1, 0))
     /* Should never happen.  */
     abort ();
 
   /* Compute the initial timeout time.  Prevent all the timers to go
      off at the same time by adding a db-based value.  */
   prune_ts.tv_sec += CACHE_PRUNE_INTERVAL + my_number;
-
-  pthread_mutex_lock (&dbs[my_number].prune_lock);
+  dbs[my_number].wakeup_time = now + CACHE_PRUNE_INTERVAL + my_number;
+
+  pthread_mutex_t *prune_lock = &dbs[my_number].prune_lock;
+  pthread_cond_t *prune_cond = &dbs[my_number].prune_cond;
+
+  pthread_mutex_lock (prune_lock);
   while (1)
     {
       /* Wait, but not forever.  */
-      int e = pthread_cond_timedwait (&dbs[my_number].prune_cond,
-				      &dbs[my_number].prune_lock,
-				      &prune_ts);
-      assert (e == 0 || e == ETIMEDOUT);
+      int e = 0;
+      if (! dbs[my_number].clear_cache)
+	e = pthread_cond_timedwait (prune_cond, prune_lock, &prune_ts);
+      assert (__builtin_expect (e == 0 || e == ETIMEDOUT, 1));
 
       time_t next_wait;
-      time_t now = time (NULL);
-      if (e == ETIMEDOUT || now >= dbs[my_number].wakeup_time)
+      now = time (NULL);
+      if (e == ETIMEDOUT || now >= dbs[my_number].wakeup_time
+	  || dbs[my_number].clear_cache)
 	{
-	  next_wait = prune_cache (&dbs[my_number], now, -1);
+	  /* We will determine the new timout values based on the
+	     cache content.  Should there be concurrent additions to
+	     the cache which are not accounted for in the cache
+	     pruning we want to know about it.  Therefore set the
+	     timeout to the maximum.  It will be descreased when adding
+	     new entries to the cache, if necessary.  */
+	  if (sizeof (time_t) == sizeof (long int))
+	    dbs[my_number].wakeup_time = LONG_MAX;
+	  else
+	    dbs[my_number].wakeup_time = INT_MAX;
+
+	  /* Unconditionally reset the flag.  */
+	  time_t prune_now = dbs[my_number].clear_cache ? LONG_MAX : now;
+	  dbs[my_number].clear_cache = 0;
+
+	  pthread_mutex_unlock (prune_lock);
+
+	  next_wait = prune_cache (&dbs[my_number], prune_now, -1);
+
 	  next_wait = MAX (next_wait, CACHE_PRUNE_INTERVAL);
 	  /* If clients cannot determine for sure whether nscd is running
 	     we need to wake up occasionally to update the timestamp.
 	     Wait 90% of the update period.  */
 #define UPDATE_MAPPING_TIMEOUT (MAPPING_TIMEOUT * 9 / 10)
 	  if (__builtin_expect (! dont_need_update, 0))
-	    next_wait = MIN (UPDATE_MAPPING_TIMEOUT, next_wait);
+	    {
+	      next_wait = MIN (UPDATE_MAPPING_TIMEOUT, next_wait);
+	      dbs[my_number].head->timestamp = now;
+	    }
+
+	  pthread_mutex_lock (prune_lock);
 
 	  /* Make it known when we will wake up again.  */
-	  dbs[my_number].wakeup_time = now + next_wait;
+	  if (now + next_wait < dbs[my_number].wakeup_time)
+	    dbs[my_number].wakeup_time = now + next_wait;
+	  else
+	    next_wait = dbs[my_number].wakeup_time - now;
 	}
       else
 	/* The cache was just pruned.  Do not do it again now.  Just
@@ -1665,6 +1747,16 @@
   size_t nused = 1;
   size_t firstfree = 1;
 
+#ifdef HAVE_INOTIFY
+  if (inotify_fd != -1)
+    {
+      conns[1].fd = inotify_fd;
+      conns[1].events = POLLRDNORM;
+      nused = 2;
+      firstfree = 2;
+    }
+#endif
+
   while (1)
     {
       /* Wait for any event.  We wait at most a couple of seconds so
@@ -1712,7 +1804,52 @@
 	      --n;
 	    }
 
-	  for (size_t cnt = 1; cnt < nused && n > 0; ++cnt)
+	  size_t first = 1;
+#ifdef HAVE_INOTIFY
+	  if (conns[1].fd == inotify_fd)
+	    {
+	      if (conns[1].revents != 0)
+		{
+		  bool done[lastdb] = { false, };
+		  union
+		  {
+		    struct inotify_event i;
+		    char buf[100];
+		  } inev;
+
+		  while (TEMP_FAILURE_RETRY (read (inotify_fd, &inev,
+						   sizeof (inev)))
+			 >= (ssize_t) sizeof (struct inotify_event))
+		    {
+		      /* Check which of the files changed.  */
+		      for (size_t dbcnt = 0; dbcnt < lastdb; ++dbcnt)
+			if (!done[dbcnt]
+			    && (inev.i.wd == dbs[dbcnt].inotify_descr
+				|| (dbcnt == hstdb
+				    && inev.i.wd == resolv_conf_descr)))
+			  {
+			    if (dbcnt == hstdb
+				&& inev.i.wd == resolv_conf_descr)
+			      res_init ();
+
+			    pthread_mutex_lock (&dbs[dbcnt].prune_lock);
+			    dbs[dbcnt].clear_cache = 1;
+			    pthread_mutex_unlock (&dbs[dbcnt].prune_lock);
+			    pthread_cond_signal (&dbs[dbcnt].prune_cond);
+
+			    done[dbcnt] = true;
+			    break;
+			  }
+		    }
+
+		  --n;
+		}
+
+	      first = 2;
+	    }
+#endif
+
+	  for (size_t cnt = first; cnt < nused && n > 0; ++cnt)
 	    if (conns[cnt].revents != 0)
 	      {
 		fd_ready (conns[cnt].fd);
@@ -1777,6 +1914,18 @@
   if (epoll_ctl (efd, EPOLL_CTL_ADD, sock, &ev) == -1)
     /* We cannot use epoll.  */
     return;
+
+#ifdef HAVE_INOTIFY
+  if (inotify_fd != -1)
+    {
+      ev.events = EPOLLRDNORM;
+      ev.data.fd = inotify_fd;
+      if (epoll_ctl (efd, EPOLL_CTL_ADD, inotify_fd, &ev) == -1)
+	/* We cannot use epoll.  */
+	return;
+      nused = 2;
+    }
+#endif
 
   while (1)
     {
@@ -1814,6 +1963,32 @@
 		  }
 	      }
 	  }
+#ifdef HAVE_INOTIFY
+	else if (revs[cnt].data.fd == inotify_fd)
+	  {
+	    union
+	    {
+	      struct inotify_event i;
+	      char buf[100];
+	    } inev;
+
+	    while (TEMP_FAILURE_RETRY (read (inotify_fd, &inev,
+					     sizeof (inev)))
+		   >= (ssize_t) sizeof (struct inotify_event))
+	      {
+		/* Check which of the files changed.  */
+		for (size_t dbcnt = 0; dbcnt < lastdb; ++dbcnt)
+		  if (inev.i.wd == dbs[dbcnt].inotify_descr)
+		    {
+		      pthread_mutex_trylock (&dbs[dbcnt].prune_lock);
+		      dbs[dbcnt].clear_cache = 1;
+		      pthread_mutex_unlock (&dbs[dbcnt].prune_lock);
+		      pthread_cond_signal (&dbs[dbcnt].prune_cond);
+		      break;
+		    }
+	      }
+	  }
+#endif
 	else
 	  {
 	    /* Remove the descriptor from the epoll descriptor.  */

Modified: trunk/libc/nscd/grpcache.c
==============================================================================
--- trunk/libc/nscd/grpcache.c (original)
+++ trunk/libc/nscd/grpcache.c Fri Jun 20 02:26:44 2008
@@ -147,7 +147,7 @@
 	      pthread_rwlock_rdlock (&db->lock);
 
 	      (void) cache_add (req->type, &dataset->strdata, req->key_len,
-				&dataset->head, true, db, owner);
+				&dataset->head, true, db, owner, he == NULL);
 
 	      pthread_rwlock_unlock (&db->lock);
 
@@ -190,7 +190,7 @@
 	  gr_mem_len_total += gr_mem_len[gr_mem_cnt];
 	}
 
-      written = total = (sizeof (struct dataset)
+      written = total = (offsetof (struct dataset, strdata)
 			 + gr_mem_cnt * sizeof (uint32_t)
 			 + gr_name_len + gr_passwd_len + gr_mem_len_total);
 
@@ -251,6 +251,9 @@
       memcpy (cp, buf, n);
       char *key_copy = cp + key_offset;
       assert (key_copy == (char *) rawmemchr (cp, '\0') + 1);
+
+      assert (cp == dataset->strdata + total - offsetof (struct dataset,
+							 strdata));
 
       /* Now we can determine whether on refill we have to create a new
 	 record or not.  */
@@ -353,7 +356,7 @@
 	  if (req->type == GETGRBYGID)
 	    {
 	      if (cache_add (GETGRBYGID, cp, key_offset, &dataset->head, true,
-			     db, owner) < 0)
+			     db, owner, he == NULL) < 0)
 		goto out;
 
 	      first = false;
@@ -362,7 +365,7 @@
 	  else if (strcmp (key_copy, gr_name) != 0)
 	    {
 	      if (cache_add (GETGRBYNAME, key_copy, key_len + 1,
-			     &dataset->head, true, db, owner) < 0)
+			     &dataset->head, true, db, owner, he == NULL) < 0)
 		goto out;
 
 	      first = false;
@@ -372,12 +375,13 @@
 	  if ((req->type == GETGRBYNAME || db->propagate)
 	      && __builtin_expect (cache_add (GETGRBYNAME, gr_name,
 					      gr_name_len,
-					      &dataset->head, first, db, owner)
+					      &dataset->head, first, db, owner,
+					      he == NULL)
 				   == 0, 1))
 	    {
 	      if (req->type == GETGRBYNAME && db->propagate)
 		(void) cache_add (GETGRBYGID, cp, key_offset, &dataset->head,
-				  false, db, owner);
+				  false, db, owner, false);
 	    }
 
 	out:

Modified: trunk/libc/nscd/hstcache.c
==============================================================================
--- trunk/libc/nscd/hstcache.c (original)
+++ trunk/libc/nscd/hstcache.c Fri Jun 20 02:26:44 2008
@@ -83,8 +83,7 @@
 	      struct hashentry *he, struct datahead *dh, int errval,
 	      int32_t ttl)
 {
-  ssize_t total;
-  ssize_t written;
+  bool all_written = true;
   time_t t = time (NULL);
 
   /* We allocate all data in one memory block: the iov vector,
@@ -108,18 +107,17 @@
 	  if (reload_count != UINT_MAX)
 	    /* Do not reset the value if we never not reload the record.  */
 	    dh->nreloads = reload_count - 1;
-
-	  written = total = 0;
 	}
       else
 	{
 	  /* We have no data.  This means we send the standard reply for this
 	     case.  */
-	  written = total = sizeof (notfound);
-
-	  if (fd != -1)
-	    written = TEMP_FAILURE_RETRY (send (fd, &notfound, total,
-						MSG_NOSIGNAL));
+	  ssize_t total = sizeof (notfound);
+
+	  if (fd != -1 &&
+	      TEMP_FAILURE_RETRY (send (fd, &notfound, total,
+					MSG_NOSIGNAL)) != total)
+	    all_written = false;
 
 	  dataset = mempool_alloc (db, sizeof (struct dataset) + req->key_len,
 				   IDX_result_data);
@@ -156,7 +154,7 @@
 	      pthread_rwlock_rdlock (&db->lock);
 
 	      (void) cache_add (req->type, &dataset->strdata, req->key_len,
-				&dataset->head, true, db, owner);
+				&dataset->head, true, db, owner, he == NULL);
 
 	      pthread_rwlock_unlock (&db->lock);
 
@@ -181,6 +179,7 @@
       char *key_copy = NULL;
       char *cp;
       size_t cnt;
+      ssize_t total;
 
       /* Determine the number of aliases.  */
       h_aliases_cnt = 0;
@@ -208,7 +207,6 @@
 		+ h_name_len
 		+ h_aliases_cnt * sizeof (uint32_t)
 		+ h_addr_list_cnt * hst->h_length);
-      written = total;
 
       /* If we refill the cache, first assume the reconrd did not
 	 change.  Allocate memory on the cache since it is likely
@@ -260,6 +258,9 @@
       dataset->resp.h_addr_list_cnt = h_addr_list_cnt;
       dataset->resp.error = NETDB_SUCCESS;
 
+      /* Make sure there is no gap.  */
+      assert ((char *) (&dataset->resp.error + 1) == dataset->strdata);
+
       cp = dataset->strdata;
 
       cp = mempcpy (cp, hst->h_name, h_name_len);
@@ -285,6 +286,8 @@
 	 is extended by the domainnames from /etc/resolv.conf.  Therefore
 	 we explicitly add the name here.  */
       key_copy = memcpy (cp, key, req->key_len);
+
+      assert ((char *) &dataset->resp + dataset->head.recsize == cp);
 
       /* Now we can determine whether on refill we have to create a new
 	 record or not.  */
@@ -351,20 +354,27 @@
 		      <= (sizeof (struct database_pers_head)
 			  + db->head->module * sizeof (ref_t)
 			  + db->head->data_size));
-	      written = sendfileall (fd, db->wr_fd,
-				     (char *) &dataset->resp
-				     - (char *) db->head, total);
+	      ssize_t written = sendfileall (fd, db->wr_fd,
+					     (char *) &dataset->resp
+					     - (char *) db->head,
+					     dataset->head.recsize);
+	      if (written != dataset->head.recsize)
+		{
 # ifndef __ASSUME_SENDFILE
-	      if (written == -1 && errno == ENOSYS)
-		goto use_write;
+		  if (written == -1 && errno == ENOSYS)
+		    goto use_write;
 # endif
+		  all_written = false;
+		}
 	    }
 	  else
 # ifndef __ASSUME_SENDFILE
 	  use_write:
 # endif
 #endif
-	    written = writeall (fd, &dataset->resp, total);
+	    if (writeall (fd, &dataset->resp, dataset->head.recsize)
+		!= dataset->head.recsize)
+	      all_written = false;
 	}
 
       /* Add the record to the database.  But only if it has not been
@@ -408,13 +418,13 @@
 		  || req->type == GETHOSTBYADDRv6);
 
 	  (void) cache_add (req->type, key_copy, req->key_len,
-			    &dataset->head, true, db, owner);
+			    &dataset->head, true, db, owner, he == NULL);
 
 	  pthread_rwlock_unlock (&db->lock);
 	}
     }
 
-  if (__builtin_expect (written != total, 0) && debug_level > 0)
+  if (__builtin_expect (!all_written, 0) && debug_level > 0)
     {
       char buf[256];
       dbg_log (_("short write in %s: %s"),  __FUNCTION__,

Modified: trunk/libc/nscd/initgrcache.c
==============================================================================
--- trunk/libc/nscd/initgrcache.c (original)
+++ trunk/libc/nscd/initgrcache.c Fri Jun 20 02:26:44 2008
@@ -231,7 +231,7 @@
 	      pthread_rwlock_rdlock (&db->lock);
 
 	      (void) cache_add (req->type, key_copy, req->key_len,
-				&dataset->head, true, db, uid);
+				&dataset->head, true, db, uid, he == NULL);
 
 	      pthread_rwlock_unlock (&db->lock);
 
@@ -246,7 +246,8 @@
   else
     {
 
-      written = total = sizeof (struct dataset) + start * sizeof (int32_t);
+      written = total = (offsetof (struct dataset, strdata)
+			 + start * sizeof (int32_t));
 
       /* If we refill the cache, first assume the reconrd did not
 	 change.  Allocate memory on the cache since it is likely
@@ -306,6 +307,9 @@
 
       /* Finally the user name.  */
       memcpy (cp, key, req->key_len);
+
+      assert (cp == dataset->strdata + total - offsetof (struct dataset,
+							 strdata));
 
       /* Now we can determine whether on refill we have to create a new
 	 record or not.  */
@@ -398,7 +402,7 @@
 	  pthread_rwlock_rdlock (&db->lock);
 
 	  (void) cache_add (INITGROUPS, cp, req->key_len, &dataset->head, true,
-			    db, uid);
+			    db, uid, he == NULL);
 
 	  pthread_rwlock_unlock (&db->lock);
 	}

Modified: trunk/libc/nscd/mem.c
==============================================================================
--- trunk/libc/nscd/mem.c (original)
+++ trunk/libc/nscd/mem.c Fri Jun 20 02:26:44 2008
@@ -24,6 +24,7 @@
 #include <inttypes.h>
 #include <libintl.h>
 #include <limits.h>
+#include <obstack.h>
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
@@ -79,6 +80,7 @@
 markrange (BITMAP_T *mark, ref_t start, size_t len)
 {
   /* Adjust parameters for block alignment.  */
+  assert ((start & BLOCK_ALIGN_M1) == 0);
   start /= BLOCK_ALIGN;
   len = (len + BLOCK_ALIGN_M1) / BLOCK_ALIGN;
 
@@ -93,7 +95,7 @@
 	  return;
 	}
 
-      mark[elem++] |= 0xff << (start % BITS);
+      mark[elem++] |= ALLBITS << (start % BITS);
       len -= BITS - (start % BITS);
     }
 
@@ -130,14 +132,14 @@
   size_t stack_used = sizeof (bool) * db->head->module;
   if (__builtin_expect (stack_used > MAX_STACK_USE, 0))
     stack_used = 0;
-  size_t memory_needed = ((db->head->first_free / BLOCK_ALIGN + BITS - 1)
-			  / BITS) * sizeof (BITMAP_T);
-  if (memory_needed <= MAX_STACK_USE)
+  size_t nmark = (db->head->first_free / BLOCK_ALIGN + BITS - 1) / BITS;
+  size_t memory_needed = nmark * sizeof (BITMAP_T);
+  if (stack_used + memory_needed <= MAX_STACK_USE)
     {
       mark = (BITMAP_T *) alloca (memory_needed);
       mark_use_malloc = false;
       memset (mark, '\0', memory_needed);
-      stack_used = memory_needed;
+      stack_used += memory_needed;
     }
   else
     {
@@ -156,6 +158,7 @@
       he = alloca (db->head->nentries * sizeof (struct hashentry *));
       he_data = alloca (db->head->nentries * sizeof (struct hashentry *));
       he_use_malloc = false;
+      stack_used += memory_needed;
     }
   else
     {
@@ -212,11 +215,12 @@
       for (enum in_flight idx = IDX_result_data;
 	   idx < IDX_last && mrunp->block[idx].dbidx == db - dbs; ++idx)
 	{
-	 assert ((char *) mrunp->block[idx].blockaddr > db->data);
-	 assert ((char *) mrunp->block[idx].blockaddr
-		 + mrunp->block[0].blocklen <= db->data + db->memsize);
-	 markrange (mark, (char *) mrunp->block[idx].blockaddr -  db->data,
-		    mrunp->block[idx].blocklen);
+	  assert (mrunp->block[idx].blockoff >= 0);
+	  assert (mrunp->block[idx].blocklen < db->memsize);
+	  assert (mrunp->block[idx].blockoff
+		  + mrunp->block[0].blocklen <= db->memsize);
+	  markrange (mark, mrunp->block[idx].blockoff,
+		     mrunp->block[idx].blocklen);
 	}
 
       mrunp = mrunp->next;
@@ -231,8 +235,13 @@
   /* Sort the entries by their address.  */
   qsort (he, cnt, sizeof (struct hashentry *), sort_he);
 
+#define obstack_chunk_alloc xmalloc
+#define obstack_chunk_free free
+  struct obstack ob;
+  obstack_init (&ob);
+
   /* Determine the highest used address.  */
-  size_t high = sizeof (mark);
+  size_t high = nmark;
   while (high > 0 && mark[high - 1] == 0)
     --high;
 
@@ -363,8 +372,14 @@
 	 displacement.  */
       ref_t disp = off_alloc - off_free;
 
-      struct moveinfo *new_move
-	= (struct moveinfo *) alloca (sizeof (*new_move));
+      struct moveinfo *new_move;
+      if (stack_used + sizeof (*new_move) <= MAX_STACK_USE)
+	{
+	  new_move = alloca (sizeof (*new_move));
+	  stack_used += sizeof (*new_move);
+	}
+      else
+	new_move = obstack_alloc (&ob, sizeof (*new_move));
       new_move->from = db->data + off_alloc;
       new_move->to = db->data + off_free;
       new_move->size = off_allocend - off_alloc;
@@ -524,6 +539,8 @@
     free (he);
   if (mark_use_malloc)
     free (mark);
+
+  obstack_free (&ob, NULL);
 }
 
 
@@ -589,15 +606,16 @@
     }
   else
     {
-      db->head->first_free += len;
-
-      db->last_alloc_failed = false;
-
       /* Remember that we have allocated this memory.  */
       assert (idx >= 0 && idx < IDX_last);
       mem_in_flight.block[idx].dbidx = db - dbs;
       mem_in_flight.block[idx].blocklen = len;
-      mem_in_flight.block[idx].blockaddr = res;
+      mem_in_flight.block[idx].blockoff = db->head->first_free;
+
+      db->head->first_free += len;
+
+      db->last_alloc_failed = false;
+
     }
 
   pthread_mutex_unlock (&db->memlock);

Modified: trunk/libc/nscd/nscd.h
==============================================================================
--- trunk/libc/nscd/nscd.h (original)
+++ trunk/libc/nscd/nscd.h Fri Jun 20 02:26:44 2008
@@ -73,6 +73,8 @@
 
   int enabled;
   int check_file;
+  int inotify_descr;
+  int clear_cache;
   int persistent;
   int shared;
   int propagate;
@@ -197,7 +199,7 @@
   {
     int dbidx;
     nscd_ssize_t blocklen;
-    void *blockaddr;
+    nscd_ssize_t blockoff;
   } block[IDX_last];
 
   struct mem_in_flight *next;
@@ -231,7 +233,8 @@
 				      uid_t owner);
 extern int cache_add (int type, const void *key, size_t len,
 		      struct datahead *packet, bool first,
-		      struct database_dyn *table, uid_t owner);
+		      struct database_dyn *table, uid_t owner,
+		      bool prune_wakeup);
 extern time_t prune_cache (struct database_dyn *table, time_t now, int fd);
 
 /* pwdcache.c */

Modified: trunk/libc/nscd/nscd_getserv_r.c
==============================================================================
--- trunk/libc/nscd/nscd_getserv_r.c (original)
+++ trunk/libc/nscd/nscd_getserv_r.c Fri Jun 20 02:26:44 2008
@@ -53,7 +53,7 @@
   portstr[sizeof (portstr) - 1] = '\0';
   char *cp = _itoa_word (port, portstr + sizeof (portstr) - 1, 10, 0);
 
-  return nscd_getserv_r (portstr, portstr + sizeof (portstr) - cp, proto,
+  return nscd_getserv_r (cp, portstr + sizeof (portstr) - cp, proto,
 			 GETSERVBYPORT, result_buf, buf, buflen, result);
 }
 

Modified: trunk/libc/nscd/pwdcache.c
==============================================================================
--- trunk/libc/nscd/pwdcache.c (original)
+++ trunk/libc/nscd/pwdcache.c Fri Jun 20 02:26:44 2008
@@ -154,7 +154,7 @@
 	      pthread_rwlock_rdlock (&db->lock);
 
 	      (void) cache_add (req->type, key_copy, req->key_len,
-				&dataset->head, true, db, owner);
+				&dataset->head, true, db, owner, he == NULL);
 
 	      pthread_rwlock_unlock (&db->lock);
 
@@ -185,7 +185,8 @@
       n = snprintf (buf, buf_len, "%d%c%n%s", pwd->pw_uid, '\0',
 		    &key_offset, (char *) key) + 1;
 
-      written = total = (sizeof (struct dataset) + pw_name_len + pw_passwd_len
+      written = total = (offsetof (struct dataset, strdata)
+			 + pw_name_len + pw_passwd_len
 			 + pw_gecos_len + pw_dir_len + pw_shell_len);
 
       /* If we refill the cache, first assume the reconrd did not
@@ -247,16 +248,28 @@
       char *key_copy = cp + key_offset;
       assert (key_copy == (char *) rawmemchr (cp, '\0') + 1);
 
+      assert (cp == dataset->strdata + total - offsetof (struct dataset,
+							 strdata));
+
       /* Now we can determine whether on refill we have to create a new
 	 record or not.  */
       if (he != NULL)
 	{
 	  assert (fd == -1);
 
-	  if (total + n == dh->allocsize
-	      && total - offsetof (struct dataset, resp) == dh->recsize
+#if 0
+	  if (dataset->head.datasize == dh->allocsize
+	      && dataset->head.recsize == dh->recsize
 	      && memcmp (&dataset->resp, dh->data,
 			 dh->allocsize - offsetof (struct dataset, resp)) == 0)
+#else
+	  if (dataset->head.allocsize != dh->allocsize)
+	    goto nnn;
+	  if (dataset->head.recsize != dh->recsize)
+	    goto nnn;
+	  if(memcmp (&dataset->resp, dh->data,
+			 dh->allocsize - offsetof (struct dataset, resp)) == 0)
+#endif
 	    {
 	      /* The data has not changed.  We will just bump the
 		 timeout value.  Note that the new record has been
@@ -266,6 +279,7 @@
 	    }
 	  else
 	    {
+ nnn:;
 	      /* We have to create a new record.  Just allocate
 		 appropriate memory and copy it.  */
 	      struct dataset *newp
@@ -348,7 +362,7 @@
 	  if (req->type == GETPWBYUID)
 	    {
 	      if (cache_add (GETPWBYUID, cp, key_offset, &dataset->head, true,
-			     db, owner) < 0)
+			     db, owner, he == NULL) < 0)
 		goto out;
 
 	      first = false;
@@ -357,7 +371,7 @@
 	  else if (strcmp (key_copy, dataset->strdata) != 0)
 	    {
 	      if (cache_add (GETPWBYNAME, key_copy, key_len + 1,
-			     &dataset->head, true, db, owner) < 0)
+			     &dataset->head, true, db, owner, he == NULL) < 0)
 		goto out;
 
 	      first = false;
@@ -367,11 +381,12 @@
 	  if ((req->type == GETPWBYNAME || db->propagate)
 	      && __builtin_expect (cache_add (GETPWBYNAME, dataset->strdata,
 					      pw_name_len, &dataset->head,
-					      first, db, owner) == 0, 1))
+					      first, db, owner, he == NULL)
+				   == 0, 1))
 	    {
 	      if (req->type == GETPWBYNAME && db->propagate)
 		(void) cache_add (GETPWBYUID, cp, key_offset, &dataset->head,
-				  false, db, owner);
+				  false, db, owner, false);
 	    }
 
 	out:

Modified: trunk/libc/nscd/servicescache.c
==============================================================================
--- trunk/libc/nscd/servicescache.c (original)
+++ trunk/libc/nscd/servicescache.c Fri Jun 20 02:26:44 2008
@@ -137,7 +137,7 @@
 	      pthread_rwlock_rdlock (&db->lock);
 
 	      (void) cache_add (req->type, &dataset->strdata, req->key_len,
-				&dataset->head, true, db, owner);
+				&dataset->head, true, db, owner, he == NULL);
 
 	      pthread_rwlock_unlock (&db->lock);
 
@@ -173,7 +173,7 @@
 	  total += s_aliases_len[cnt];
 	}
 
-      total += (sizeof (struct dataset)
+      total += (offsetof (struct dataset, strdata)
 		+ s_name_len
 		+ s_proto_len
 		+ s_aliases_cnt * sizeof (uint32_t));
@@ -331,7 +331,7 @@
 	  pthread_rwlock_rdlock (&db->lock);
 
 	  (void) cache_add (req->type, key_copy, req->key_len,
-			    &dataset->head, true, db, owner);
+			    &dataset->head, true, db, owner, he == NULL);
 
 	  pthread_rwlock_unlock (&db->lock);
 	}

Modified: trunk/libc/posix/glob.c
==============================================================================
--- trunk/libc/posix/glob.c (original)
+++ trunk/libc/posix/glob.c Fri Jun 20 02:26:44 2008
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2002, 2003, 2004, 2005, 2006, 2007
+/* Copyright (C) 1991-2002, 2003, 2004, 2005, 2006, 2007, 2008
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -1080,8 +1080,7 @@
     {
       size_t i;
       for (i = 0; i < pglob->gl_pathc; ++i)
-	if (pglob->gl_pathv[pglob->gl_offs + i] != NULL)
-	  free (pglob->gl_pathv[pglob->gl_offs + i]);
+	free (pglob->gl_pathv[pglob->gl_offs + i]);
       free (pglob->gl_pathv);
       pglob->gl_pathv = NULL;
     }

Modified: trunk/libc/resolv/arpa/nameser_compat.h
==============================================================================
--- trunk/libc/resolv/arpa/nameser_compat.h (original)
+++ trunk/libc/resolv/arpa/nameser_compat.h Fri Jun 20 02:26:44 2008
@@ -1,6 +1,6 @@
 /* Copyright (c) 1983, 1989
  *    The Regents of the University of California.  All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
@@ -12,7 +12,7 @@
  * 4. Neither the name of the University nor the names of its contributors
  *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -161,6 +161,7 @@
 #define	T_SRV		ns_t_srv
 #define T_ATMA		ns_t_atma
 #define T_NAPTR		ns_t_naptr
+#define T_DNAME		ns_t_dname
 #define	T_TSIG		ns_t_tsig
 #define	T_IXFR		ns_t_ixfr
 #define T_AXFR		ns_t_axfr

Modified: trunk/libc/resolv/nss_dns/dns-host.c
==============================================================================
--- trunk/libc/resolv/nss_dns/dns-host.c (original)
+++ trunk/libc/resolv/nss_dns/dns-host.c Fri Jun 20 02:26:44 2008
@@ -990,6 +990,9 @@
   char *h_name = NULL;
   int h_namelen = 0;
 
+  if (ancount == 0)
+    return NSS_STATUS_NOTFOUND;
+
   while (ancount-- > 0 && cp < end_of_message && had_error == 0)
     {
       n = __ns_name_unpack (answer->buf, end_of_message, cp,
@@ -1069,12 +1072,13 @@
       if (__builtin_expect (type == T_SIG, 0)
 	  || __builtin_expect (type == T_KEY, 0)
 	  || __builtin_expect (type == T_NXT, 0)
-	  || __builtin_expect (type == T_PTR, 0))
+	  || __builtin_expect (type == T_PTR, 0)
+	  || __builtin_expect (type == T_DNAME, 0))
 	{
 	  /* We don't support DNSSEC yet.  For now, ignore the record
 	     and send a low priority message to syslog.
 
-	     We also don't expect T_PTR messages.  */
+	     We also don't expect T_PTR or T_DNAME messages.  */
 	  syslog (LOG_DEBUG | LOG_AUTH,
 		  "getaddrinfo*.gaih_getanswer: got type \"%s\"",
 		  p_type (type));
@@ -1093,11 +1097,7 @@
 
 	  if (__builtin_expect (buflen < sizeof (struct gaih_addrtuple),
 				0))
-	    {
-	      *errnop = ERANGE;
-	      *h_errnop = NETDB_INTERNAL;
-	      return NSS_STATUS_TRYAGAIN;
-	    }
+	    goto too_small;
 
 	  *pat = (struct gaih_addrtuple *) buffer;
 	  buffer += sizeof (struct gaih_addrtuple);
@@ -1164,15 +1164,24 @@
 {
   int first = 1;
 
-  enum nss_status status = gaih_getanswer_slice(answer1, anslen1, qname,
-						&pat, &buffer, &buflen,
-						errnop, h_errnop, ttlp,
-						&first);
-  if ((status == NSS_STATUS_SUCCESS || status == NSS_STATUS_NOTFOUND)
-      && answer2 != NULL)
-    status = gaih_getanswer_slice(answer2, anslen2, qname,
+  enum nss_status status = NSS_STATUS_NOTFOUND;
+
+  if (anslen1 > 0)
+    status = gaih_getanswer_slice(answer1, anslen1, qname,
 				  &pat, &buffer, &buflen,
-				  errnop, h_errnop, ttlp, &first);
+				  errnop, h_errnop, ttlp,
+				  &first);
+  if ((status == NSS_STATUS_SUCCESS || status == NSS_STATUS_NOTFOUND
+       || status == NSS_STATUS_TRYAGAIN)
+      && answer2 != NULL && anslen2 > 0)
+    {
+      enum nss_status status2 = gaih_getanswer_slice(answer2, anslen2, qname,
+						     &pat, &buffer, &buflen,
+						     errnop, h_errnop, ttlp,
+						     &first);
+      if (status != NSS_STATUS_SUCCESS)
+	status = status2;
+    }
 
   return status;
 }

Modified: trunk/libc/resolv/res_query.c
==============================================================================
--- trunk/libc/resolv/res_query.c (original)
+++ trunk/libc/resolv/res_query.c Fri Jun 20 02:26:44 2008
@@ -223,6 +223,21 @@
 	   is easy to verify that this is the same as ignoring all
 	   tests of HP2.  */
 	HEADER *hp2 = answerp2 ? (HEADER *) *answerp2 : hp;
+
+	if (n < sizeof (HEADER) && nanswerp2 != NULL
+	    && *nanswerp2 > sizeof (HEADER))
+	  {
+	    /* Special case of partial answer.  */
+	    assert (hp != hp2);
+	    hp = hp2;
+	  }
+	else if (nanswerp2 != NULL
+		 && *nanswerp2 < sizeof (HEADER) && n > sizeof (HEADER))
+	  {
+	    /* Special case of partial answer.  */
+	    assert (hp != hp2);
+	    hp2 = hp;
+	  }
 
 	if ((hp->rcode != NOERROR || ntohs(hp->ancount) == 0)
 	    && (hp2->rcode != NOERROR || ntohs(hp2->ancount) == 0)) {

Modified: trunk/libc/resolv/res_send.c
==============================================================================
--- trunk/libc/resolv/res_send.c (original)
+++ trunk/libc/resolv/res_send.c Fri Jun 20 02:26:44 2008
@@ -975,6 +975,8 @@
 	int recvresp2 = buf2 == NULL;
 	pfd[0].fd = EXT(statp).nssocks[ns];
 	pfd[0].events = POLLOUT;
+	if (resplen2 != NULL)
+	  *resplen2 = 0;
  wait:
 	if (need_recompute) {
 	recompute_resend:
@@ -999,8 +1001,13 @@
 		need_recompute = 1;
 	}
 	if (n == 0) {
-		Dprint(statp->options & RES_DEBUG, (stdout,
-						    ";; timeout sending\n"));
+		Dprint(statp->options & RES_DEBUG, (stdout, ";; timeout\n"));
+		if (recvresp1 || (buf2 != NULL && recvresp2))
+		  {
+		    *resplen2 = 1;
+		    return resplen;
+		  }
+
 		*gotsomewhere = 1;
 		return (0);
 	}
@@ -1177,6 +1184,24 @@
 				thisansp,
 				(*thisresplen > *thisanssiz)
 				? *thisanssiz : *thisresplen);
+
+			if (recvresp1 || (buf2 != NULL && recvresp2))
+			  {
+			    *resplen2 = 1;
+			    return resplen;
+			  }
+			if (buf2 != NULL)
+			  {
+			    /* We are waiting for a possible second reply.  */
+			    resplen = 1;
+			    if (hp->id == anhp->id)
+			      recvresp1 = 1;
+			    else
+			      recvresp2 = 1;
+
+			    goto wait;
+			  }
+
 		next_ns:
 			__res_iclose(statp, false);
 			/* don't retry if called from dig */

Modified: trunk/libc/scripts/soversions.awk
==============================================================================
--- trunk/libc/scripts/soversions.awk (original)
+++ trunk/libc/scripts/soversions.awk Fri Jun 20 02:26:44 2008
@@ -14,6 +14,16 @@
     sub(/@VENDOR@/, vendor, othercf);
     sub(/@OS@/, os, othercf);
     configs[othercf] = $2;
+  }
+  next;
+}
+
+$2 == "ABI" {
+  if ((config ~ thiscf) && !abiname) {
+    abiname = $3;
+    sub(/@CPU@/, cpu, abiname);
+    sub(/@VENDOR@/, vendor, abiname);
+    sub(/@OS@/, os, abiname);
   }
   next;
 }
@@ -66,6 +76,9 @@
 	}
       }
   }
+  if (abiname) {
+    print "ABI", abiname
+  }
   for (c in lines) {
     print lines[c]
   }

Modified: trunk/libc/shlib-versions
==============================================================================
--- trunk/libc/shlib-versions (original)
+++ trunk/libc/shlib-versions Fri Jun 20 02:26:44 2008
@@ -42,6 +42,11 @@
 powerpc.*-.*-.*		WORDSIZE64		powerpc64-@VENDOR@-@OS@
 sparc64.*-.*-.*		WORDSIZE32		sparc-@VENDOR@-@OS@
 sparc.*-.*-.*		WORDSIZE64		sparc64-@VENDOR@-@OS@
+
+# Configuration		ABI			Identifier for ABI data files
+# -------------		----------		-----------------------------
+sparc64.*-.*-.*		ABI			sparc64-@OS@
+sparc.*-.*-.*		ABI			sparc-@OS@
 
 # Configuration		Library=version		Earliest symbol set (optional)
 # -------------		---------------		------------------------------

Modified: trunk/libc/stdio-common/Makefile
==============================================================================
--- trunk/libc/stdio-common/Makefile (original)
+++ trunk/libc/stdio-common/Makefile Fri Jun 20 02:26:44 2008
@@ -65,7 +65,7 @@
 	 tst-sprintf tst-rndseek tst-fdopen tst-fphex \
 	 tst-popen tst-unlockedio tst-fmemopen2 tst-put-error tst-fgets \
 	 tst-fwrite bug16 bug17 tst-sprintf2 bug18 \
-	 bug19 tst-popen2 scanf14 scanf15 bug21 bug22
+	 bug19 tst-popen2 scanf14 scanf15 bug21 bug22 scanf16 scanf17
 tests-$(OPTION_EGLIBC_LOCALE_CODE) \
       += tst-sscanf tst-swprintf bug15 test-vfprintf bug14 scanf13
 tests-$(OPTION_POSIX_WIDE_CHAR_DEVICE_IO) \
@@ -123,10 +123,12 @@
 CFLAGS-errlist.c = $(fno-unit-at-a-time)
 CFLAGS-siglist.c = $(fno-unit-at-a-time)
 
-# The following is a hack since we must compile scanf15.c without any
+# The following is a hack since we must compile scanf1{5,7}.c without any
 # GNU extension.  The latter are needed, though, when internal headers
 # are used.  So made sure we see the installed headers first.
 CFLAGS-scanf15.c = -I../libio -I../stdlib -I../wcsmbs -I../time -I../string \
+		   -I../wctype
+CFLAGS-scanf17.c = -I../libio -I../stdlib -I../wcsmbs -I../time -I../string \
 		   -I../wctype
 
 # We know the test has a format string problem.

Modified: trunk/libc/stdio-common/scanf14.c
==============================================================================
--- trunk/libc/stdio-common/scanf14.c (original)
+++ trunk/libc/stdio-common/scanf14.c Fri Jun 20 02:26:44 2008
@@ -62,5 +62,58 @@
   else if (d != 5.25 || memcmp (c, " x", 2) != 0)
     FAIL ();
 
+  const char *tmpdir = getenv ("TMPDIR");
+  if (tmpdir == NULL || tmpdir[0] == '\0')
+    tmpdir = "/tmp";
+
+  char fname[strlen (tmpdir) + sizeof "/tst-scanf14.XXXXXX"];
+  sprintf (fname, "%s/tst-scanf14.XXXXXX", tmpdir);
+  if (fname == NULL)
+    FAIL ();
+
+  /* Create a temporary file.   */
+  int fd = mkstemp (fname);
+  if (fd == -1)
+    FAIL ();
+
+  FILE *fp = fdopen (fd, "w+");
+  if (fp == NULL)
+    FAIL ();
+  else
+    {
+      if (fputs (" 1.25s x", fp) == EOF)
+	FAIL ();
+      if (fseek (fp, 0, SEEK_SET) != 0)
+	FAIL ();
+      if (fscanf (fp, "%as%2c", &sp, c) != 2)
+	FAIL ();
+      else
+	{
+	  if (strcmp (sp, "1.25s") != 0 || memcmp (c, " x", 2) != 0)
+	    FAIL ();
+	  memset (sp, 'x', sizeof "1.25s");
+	  free (sp);
+	}
+
+      if (freopen (fname, "r", stdin) == NULL)
+	FAIL ();
+      else
+	{
+	  if (scanf ("%as%2c", &sp, c) != 2)
+	    FAIL ();
+	  else
+	    {
+	      if (strcmp (sp, "1.25s") != 0 || memcmp (c, " x", 2) != 0)
+		FAIL ();
+	      memset (sp, 'x', sizeof "1.25s");
+	      free (sp);
+	    }
+	}
+
+      fclose (fp);
+    }
+
+  remove (fname);
+
   return result;
 }

Modified: trunk/libc/stdio-common/scanf15.c
==============================================================================
--- trunk/libc/stdio-common/scanf15.c (original)
+++ trunk/libc/stdio-common/scanf15.c Fri Jun 20 02:26:44 2008
@@ -50,5 +50,48 @@
   else if (d != 5.25 || memcmp (c, " x", 2) != 0)
     FAIL ();
 
+  const char *tmpdir = getenv ("TMPDIR");
+  if (tmpdir == NULL || tmpdir[0] == '\0')
+    tmpdir = "/tmp";
+
+  char fname[strlen (tmpdir) + sizeof "/tst-scanf15.XXXXXX"];
+  sprintf (fname, "%s/tst-scanf15.XXXXXX", tmpdir);
+  if (fname == NULL)
+    FAIL ();
+
+  /* Create a temporary file.   */
+  int fd = mkstemp (fname);
+  if (fd == -1)
+    FAIL ();
+
+  FILE *fp = fdopen (fd, "w+");
+  if (fp == NULL)
+    FAIL ();
+  else
+    {
+      if (fputs (" 1.25s x", fp) == EOF)
+	FAIL ();
+      if (fseek (fp, 0, SEEK_SET) != 0)
+	FAIL ();
+      if (fscanf (fp, "%as%2c", &f, c) != 2)
+	FAIL ();
+      else if (f != 1.25 || memcmp (c, " x", 2) != 0)
+	FAIL ();
+
+      if (freopen (fname, "r", stdin) == NULL)
+	FAIL ();
+      else
+	{
+	  if (scanf ("%as%2c", &f, c) != 2)
+	    FAIL ();
+	  else if (f != 1.25 || memcmp (c, " x", 2) != 0)
+	    FAIL ();
+	}
+
+      fclose (fp);
+    }
+
+  remove (fname);
+
   return result;
 }

Modified: trunk/libc/string/Makefile
==============================================================================
--- trunk/libc/string/Makefile (original)
+++ trunk/libc/string/Makefile Fri Jun 20 02:26:44 2008
@@ -52,7 +52,7 @@
 
 strop-tests	:= memchr memcmp memcpy memmove mempcpy memset memccpy	\
 		   stpcpy stpncpy strcat strchr strcmp strcpy strcspn	\
-		   strlen strncmp strncpy strpbrk strrchr strspn
+		   strlen strncmp strncpy strpbrk strrchr strspn memmem
 tests		:= tester inl-tester noinl-tester testcopy test-ffs	\
 		   tst-strlen stratcliff tst-svc tst-inlcall		\
 		   bug-strncat1 bug-strspn1 bug-strpbrk1 tst-bswap	\

Modified: trunk/libc/string/endian.h
==============================================================================
--- trunk/libc/string/endian.h (original)
+++ trunk/libc/string/endian.h Fri Jun 20 02:26:44 2008
@@ -56,39 +56,41 @@
 #endif
 
 
+#ifdef __USE_BSD
 /* Conversion interfaces.  */
-#include <bits/byteswap.h>
+# include <bits/byteswap.h>
 
-#if __BYTE_ORDER == __LITTLE_ENDIAN
-# define htobe16(x) __bswap_16 (x)
-# define htole16(x) (x)
-# define be16toh(x) __bswap_16 (x)
-# define le16toh(x) (x)
+# if __BYTE_ORDER == __LITTLE_ENDIAN
+#  define htobe16(x) __bswap_16 (x)
+#  define htole16(x) (x)
+#  define be16toh(x) __bswap_16 (x)
+#  define le16toh(x) (x)
 
-# define htobe32(x) __bswap_32 (x)
-# define htole32(x) (x)
-# define be32toh(x) __bswap_32 (x)
-# define le32toh(x) (x)
+#  define htobe32(x) __bswap_32 (x)
+#  define htole32(x) (x)
+#  define be32toh(x) __bswap_32 (x)
+#  define le32toh(x) (x)
 
-# define htobe64(x) __bswap_64 (x)
-# define htole64(x) (x)
-# define be64toh(x) __bswap_64 (x)
-# define le64toh(x) (x)
-#else
-# define htobe16(x) (x)
-# define htole16(x) __bswap_16 (x)
-# define be16toh(x) (x)
-# define le16toh(x) __bswap_16 (x)
+#  define htobe64(x) __bswap_64 (x)
+#  define htole64(x) (x)
+#  define be64toh(x) __bswap_64 (x)
+#  define le64toh(x) (x)
+# else
+#  define htobe16(x) (x)
+#  define htole16(x) __bswap_16 (x)
+#  define be16toh(x) (x)
+#  define le16toh(x) __bswap_16 (x)
 
-# define htobe32(x) (x)
-# define htole32(x) __bswap_32 (x)
-# define be32toh(x) (x)
-# define le32toh(x) __bswap_32 (x)
+#  define htobe32(x) (x)
+#  define htole32(x) __bswap_32 (x)
+#  define be32toh(x) (x)
+#  define le32toh(x) __bswap_32 (x)
 
-# define htobe64(x) (x)
-# define htole64(x) __bswap_64 (x)
-# define be64toh(x) (x)
-# define le64toh(x) __bswap_64 (x)
+#  define htobe64(x) (x)
+#  define htole64(x) __bswap_64 (x)
+#  define be64toh(x) (x)
+#  define le64toh(x) __bswap_64 (x)
+# endif
 #endif
 
 #endif	/* endian.h */

Modified: trunk/libc/string/test-string.h
==============================================================================
--- trunk/libc/string/test-string.h (original)
+++ trunk/libc/string/test-string.h Fri Jun 20 02:26:44 2008
@@ -1,5 +1,5 @@
 /* Test and measure string and memory functions.
-   Copyright (C) 1999, 2002, 2004 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2002, 2004, 2008 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Written by Jakub Jelinek <jakub@xxxxxxxxxx>, 1999.
 
@@ -118,6 +118,10 @@
     }									\
   while (0)
 
+#ifndef BUF1PAGES
+# define BUF1PAGES 1
+#endif
+
 static void
 test_init (void)
 {
@@ -126,11 +130,11 @@
   if (page_size < MIN_PAGE_SIZE)
     page_size = MIN_PAGE_SIZE;
 #endif
-  buf1 = mmap (0, 2 * page_size, PROT_READ | PROT_WRITE,
+  buf1 = mmap (0, (BUF1PAGES + 1) * page_size, PROT_READ | PROT_WRITE,
 	       MAP_PRIVATE | MAP_ANON, -1, 0);
   if (buf1 == MAP_FAILED)
     error (EXIT_FAILURE, errno, "mmap failed");
-  if (mprotect (buf1 + page_size, page_size, PROT_NONE))
+  if (mprotect (buf1 + BUF1PAGES * page_size, page_size, PROT_NONE))
     error (EXIT_FAILURE, errno, "mprotect failed");
   buf2 = mmap (0, 2 * page_size, PROT_READ | PROT_WRITE,
 	       MAP_PRIVATE | MAP_ANON, -1, 0);
@@ -145,7 +149,7 @@
       srandom (seed);
     }
 
-  memset (buf1, 0xa5, page_size);
+  memset (buf1, 0xa5, BUF1PAGES * page_size);
   memset (buf2, 0x5a, page_size);
 }
 

Modified: trunk/libc/sysdeps/posix/getaddrinfo.c
==============================================================================
--- trunk/libc/sysdeps/posix/getaddrinfo.c (original)
+++ trunk/libc/sysdeps/posix/getaddrinfo.c Fri Jun 20 02:26:44 2008
@@ -660,7 +660,10 @@
 
 		  goto process_list;
 		}

[... 826 lines stripped ...]