about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2004-12-07 14:01:11 +0000
committerJakub Jelinek <jakub@redhat.com>2004-12-07 14:01:11 +0000
commit37756a838922d080448793aa5ab5e90c5aba78c1 (patch)
tree043efc2dbba1e4c350c65704af85bd5a628ea561
parent3b1744f208165b87fb8cd286d39b395c56257ee5 (diff)
downloadglibc-37756a838922d080448793aa5ab5e90c5aba78c1.tar.gz
glibc-37756a838922d080448793aa5ab5e90c5aba78c1.tar.xz
glibc-37756a838922d080448793aa5ab5e90c5aba78c1.zip
Updated to fedora-glibc-20041207T1331
-rw-r--r--ChangeLog105
-rw-r--r--Makeconfig2
-rw-r--r--elf/rtld.c12
-rw-r--r--fedora/branch.mk4
-rw-r--r--fedora/glibc.spec.in20
-rw-r--r--libio/fileops.c50
-rw-r--r--libio/ioseekpos.c4
-rw-r--r--linuxthreads/ChangeLog10
-rw-r--r--linuxthreads/sysdeps/unix/sysv/linux/arm/sysdep-cancel.h2
-rw-r--r--linuxthreads/sysdeps/unix/sysv/linux/arm/vfork.S4
-rw-r--r--nis/ypclnt.c5
-rw-r--r--nptl/ChangeLog17
-rw-r--r--nptl/Makefile3
-rw-r--r--nptl/sysdeps/unix/sysv/linux/i386/clone.S2
-rw-r--r--nptl/sysdeps/unix/sysv/linux/x86_64/clone.S2
-rw-r--r--nptl/tst-getpid1.c99
-rw-r--r--posix/confstr.c12
-rw-r--r--posix/regcomp.c34
-rw-r--r--posix/regex_internal.h12
-rw-r--r--posix/regexec.c99
-rw-r--r--rt/Makefile2
-rw-r--r--rt/tst-timer4.c39
-rw-r--r--rt/tst-timer5.c14
-rw-r--r--sysdeps/arm/dl-machine.h4
-rw-r--r--sysdeps/arm/strlen.S2
-rw-r--r--sysdeps/arm/sysdep.h17
-rw-r--r--sysdeps/generic/unsecvars.h3
-rw-r--r--sysdeps/unix/arm/brk.S2
-rw-r--r--sysdeps/unix/arm/fork.S2
-rw-r--r--sysdeps/unix/arm/sysdep.S4
-rw-r--r--sysdeps/unix/arm/sysdep.h2
-rw-r--r--sysdeps/unix/clock_nanosleep.c13
-rw-r--r--sysdeps/unix/sysv/linux/arm/clone.S2
-rw-r--r--sysdeps/unix/sysv/linux/arm/mmap.S4
-rw-r--r--sysdeps/unix/sysv/linux/arm/mmap64.S4
-rw-r--r--sysdeps/unix/sysv/linux/arm/socket.S4
-rw-r--r--sysdeps/unix/sysv/linux/arm/sysdep.h4
-rw-r--r--sysdeps/unix/sysv/linux/arm/vfork.S4
-rw-r--r--sysdeps/unix/sysv/linux/i386/clone.S36
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/clone.S20
-rw-r--r--time/tzset.c1
41 files changed, 457 insertions, 224 deletions
diff --git a/ChangeLog b/ChangeLog
index 5784ad4b83..f21175ea06 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,105 @@
 2004-12-01  Jakub Jelinek  <jakub@redhat.com>
 
+	* elf/rtld.c (process_envvars): Don't consider LD_SHOW_AUXV
+	and LD_DYNAMIC_WEAK if __libc_enable_secure.
+	If __libc_enable_secure, /etc/suid-debug doesn't exist and
+	program will be actually run, turn off all debugging.
+	* sysdeps/generic/unsecvars.h (UNSECURE_ENVVARS): Add LD_DEBUG,
+	LD_DYNAMIC_WEAK and LD_SHOW_AUXV.
+
+2004-12-06  Jakub Jelinek  <jakub@redhat.com>
+
+	* time/tzset.c (tzset_internal): If + or - is seen,
+	but no offset after it, reset offset to 0.  [BZ #601]
+
+2004-12-06  Ulrich Drepper  <drepper@redhat.com>
+
+	* libio/ioseekpos.c (_IO_seekpos_unlocked): Call _IO_SEEKOFF not
+	_IO_SEEKPOS, saving one indirect jump.
+
+	* libio/fileops.c (_IO_new_file_seekoff): Fix optimization of in-buffer
+	seek.  Remove dead code.
+
+2004-12-02  Jakub Jelinek  <jakub@redhat.com>
+
+	* libio/Makefile (tests): Add bug-ungetc4.
+	* libio/bug-ungetc4.c: New test.
+
+2004-12-06  Roland McGrath  <roland@redhat.com>
+
+	* sysdeps/unix/clock_nanosleep.c (clock_nanosleep): Diagnose EINVAL
+	for CLOCK_THREAD_CPUTIME_ID, not ENOTSUP.
+	Use SYSDEP_NANOSLEEP handler before validating CLOCK_ID value.
+
+	* rt/tst-timer4.c (TEST_CLOCK, TEST_CLOCK_NANOSLEEP): New macros.
+	Use them throughout in place of CLOCK_REALTIME and nanosleep.
+	(do_test) [TEST_CLOCK_MISSING]: Call this macro and if it returns
+	non-null, punt the test with a message using the string returned.
+	* rt/tst-timer5.c: New file.
+	* rt/Makefile (tests): Add it.
+
+2004-12-01  Paolo Bonzini  <bonzini@gnu.org>
+
+	* posix/regcomp.c (free_dfa_content, init_dfa): Remove
+	references to re_dfa_t's subexps field.
+	(parse_sub_exp, parse_expression): Do not use it.  Use
+	completed_bkref_map instead.
+	(create_initial_state, peek_token): Store a backreference \N
+	with opr.idx = N-1.
+	* posix/regexec.c (proceed_next_node, check_dst_limits, get_subexp):
+	Likewise.
+	(check_subexp_limits): Remove useless condition.
+	* posix/regex_internal.h (re_subexp_t): Remove.
+	(re_dfa_t): Remove subexps and subexps_alloc field, add
+	completed_bkref_map.
+
+2004-12-05  Roland McGrath  <roland@frob.com>
+
+	* Makeconfig: Comment typo fix.
+
+2004-11-30  Andreas Schwab  <schwab@suse.de>
+
+	* nis/ypclnt.c (ypprot_err): Remove unused entries.
+
+2004-11-30  Paolo Bonzini  <bonzini@gnu.org>
+
+	* posix/regexec.c (check_dst_limits_calc_pos_1): Check for
+	bkref_idx == -1, and don't recurse in that case.
+
+2004-11-30  GOTO Masanori  <gotom@debian.or.jp>
+
+	* posix/confstr.c: Enclose #error message with double quote
+	for gcc-3.3 and lower.
+
+2004-12-04  Ulrich Drepper  <drepper@redhat.com>
+
+	* sysdeps/unix/sysv/linux/i386/clone.S: Add support for NPTL where
+	the PID is stored at userlevel and needs to be reset when CLONE_THREAD
+	is not used.
+	* sysdeps/unix/sysv/linux/x86_64/clone.S: Likewise.
+
+2004-11-18  Daniel Jacobowitz  <dan@codesourcery.com>
+
+	* sysdeps/arm/sysdep.h: Define __USE_BX__ if bx is available.
+	Use it instead of __THUMB_INTERWORK__.  Make RETINSTR take
+	only a condition and a register.
+	* sysdeps/arm/dl-machine.h: Use __USE_BX__ instead of
+	__THUMB_INTERWORK__.
+	(_dl_start_user): Use BX.
+	* sysdeps/arm/strlen.S: Use DO_RET.
+	* sysdeps/unix/arm/brk.S: Likewise.
+	* sysdeps/unix/arm/fork.S: Likewise.
+	* sysdeps/unix/arm/sysdep.S: Likewise.
+	* sysdeps/unix/arm/sysdep.h: Likewise.
+	* sysdeps/unix/sysv/linux/arm/clone.S: Update uses of RETINSTR.
+	* sysdeps/unix/sysv/linux/arm/mmap.S: Likewise.
+	* sysdeps/unix/sysv/linux/arm/mmap64.S: Likewise.
+	* sysdeps/unix/sysv/linux/arm/socket.S: Likewise.
+	* sysdeps/unix/sysv/linux/arm/sysdep.h: Likewise.
+	* sysdeps/unix/sysv/linux/arm/vfork.S: Likewise.
+
+2004-12-01  Jakub Jelinek  <jakub@redhat.com>
+
 	* posix/tst-regex.c: Use defined _POSIX_CPUTIME && _POSIX_CPUTIME >= 0
 	conditionals instead of defined _POSIX_CPUTIME.
 	(main): If _POSIX_CPUTIME == 0, call sysconf to see if CPUTIME
@@ -12,11 +112,6 @@
 	_POSIX_THREAD_CPUTIME is defined to 0, return -1 for the corresponding
 	_SC_ argument.
 
-2004-12-02  Jakub Jelinek  <jakub@redhat.com>
-
-	* libio/Makefile (tests): Add bug-ungetc4.
-	* libio/bug-ungetc4.c: New test.
-
 2004-12-02  Roland McGrath  <roland@redhat.com>
 
 	* extra-lib.mk (object-suffixes-$(lib)): Add .oS when
diff --git a/Makeconfig b/Makeconfig
index ab9f806eff..3368b51e51 100644
--- a/Makeconfig
+++ b/Makeconfig
@@ -818,7 +818,7 @@ postclean-generated += soversions.mk soversions.i \
 		       shlib-versions.v shlib-versions.v.i
 
 # Generate the header containing the names of all shared libraries.
-# We use a stamp file to avoid uncessary recompilations.
+# We use a stamp file to avoid unnecessary recompilations.
 before-compile += $(common-objpfx)gnu/lib-names.h
 ifeq ($(soversions.mk-done),t)
 $(common-objpfx)gnu/lib-names.h: $(common-objpfx)gnu/lib-names.stmp; @:
diff --git a/elf/rtld.c b/elf/rtld.c
index e442aa257f..45c65af904 100644
--- a/elf/rtld.c
+++ b/elf/rtld.c
@@ -2266,7 +2266,8 @@ process_envvars (enum mode *modep)
 	case 9:
 	  /* Test whether we want to see the content of the auxiliary
 	     array passed up from the kernel.  */
-	  if (memcmp (envline, "SHOW_AUXV", 9) == 0)
+	  if (!INTUSE(__libc_enable_secure)
+	      && memcmp (envline, "SHOW_AUXV", 9) == 0)
 	    _dl_show_auxv ();
 	  break;
 
@@ -2299,7 +2300,8 @@ process_envvars (enum mode *modep)
 	      break;
 	    }
 
-	  if (memcmp (envline, "DYNAMIC_WEAK", 12) == 0)
+	  if (!INTUSE(__libc_enable_secure)
+	      && memcmp (envline, "DYNAMIC_WEAK", 12) == 0)
 	    GLRO(dl_dynamic_weak) = 1;
 	  break;
 
@@ -2373,7 +2375,11 @@ process_envvars (enum mode *modep)
       while (*nextp != '\0');
 
       if (__access ("/etc/suid-debug", F_OK) != 0)
-	unsetenv ("MALLOC_CHECK_");
+        {
+	  unsetenv ("MALLOC_CHECK_");
+	  if (mode == normal)
+	    GLRO(dl_debug_mask) = 0;
+        }
     }
   /* If we have to run the dynamic linker in debugging mode and the
      LD_DEBUG_OUTPUT environment variable is given, we write the debug
diff --git a/fedora/branch.mk b/fedora/branch.mk
index e1a6258d28..b747e0074b 100644
--- a/fedora/branch.mk
+++ b/fedora/branch.mk
@@ -1,5 +1,5 @@
 # This file is updated automatically by Makefile.
 glibc-branch := fedora
 glibc-base := HEAD
-fedora-sync-date := 2004-12-03 09:35 UTC
-fedora-sync-tag := fedora-glibc-20041203T0935
+fedora-sync-date := 2004-12-07 13:31 UTC
+fedora-sync-tag := fedora-glibc-20041207T1331
diff --git a/fedora/glibc.spec.in b/fedora/glibc.spec.in
index 6ef69cca32..9181ee2ca7 100644
--- a/fedora/glibc.spec.in
+++ b/fedora/glibc.spec.in
@@ -1,4 +1,4 @@
-%define glibcrelease 87
+%define glibcrelease 88
 %define auxarches i586 i686 athlon sparcv9 alphaev6
 %define prelinkarches noarch
 %define nptlarches i386 i686 athlon x86_64 ia64 s390 s390x sparcv9 ppc ppc64
@@ -856,7 +856,7 @@ grep -v '%{_prefix}/%{_lib}/lib.*\.a' < rpm.filelist.full |
 
 grep '%{_prefix}/bin' < rpm.filelist >> common.filelist
 grep '%{_prefix}/lib/locale' < rpm.filelist >> common.filelist
-grep '%{_prefix}/libexec' < rpm.filelist >> common.filelist
+grep '%{_prefix}/libexec/pt_chown' < rpm.filelist >> common.filelist
 grep '%{_prefix}/sbin/[^gi]' < rpm.filelist >> common.filelist
 grep '%{_prefix}/share' < rpm.filelist \
   | grep -v '%{_prefix}/share/zoneinfo' >> common.filelist
@@ -864,7 +864,7 @@ grep '%{_prefix}/share' < rpm.filelist \
 mv rpm.filelist rpm.filelist.full
 grep -v '%{_prefix}/bin' < rpm.filelist.full |
 	grep -v '%{_prefix}/lib/locale' |
-	grep -v '%{_prefix}/libexec' |
+	grep -v '%{_prefix}/libexec/pt_chown' |
 	grep -v '%{_prefix}/sbin/[^gi]' |
 	grep -v '%{_prefix}/share' > rpm.filelist
 
@@ -1187,6 +1187,7 @@ rm -f *.filelist*
 %verify(not md5 size mtime) %config(noreplace) /etc/nsswitch.conf
 %verify(not md5 size mtime) %config(noreplace) /etc/ld.so.conf
 %dir /etc/ld.so.conf.d
+%dir %{_prefix}/libexec/getconf
 %attr(0644,root,root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /etc/ld.so.cache
 %doc README NEWS INSTALL FAQ BUGS NOTES PROJECTS CONFORMANCE
 %doc COPYING COPYING.LIB README.libm LICENSES
@@ -1258,6 +1259,19 @@ rm -f *.filelist*
 %endif
 
 %changelog
+* Tue Dec  7 2004 Jakub Jelinek <jakub@redhat.com> 2.3.3-88
+- update from CVS
+  - disregard LD_SHOW_AUXV and LD_DYNAMIC_WEAK if __libc_enable_secure
+  - disregard LD_DEBUG if __libc_enable_secure in normal mode
+    if /suid-debug doesn't exist
+  - fix fseekpos after ungetc
+  - avoid reading bytes before start of buffers in regex's
+    check_dst_limits_calc_pos_1 (#142060)
+  - make getpid () working with clone/clone2 without CLONE_THREAD
+    (so far on i386/x86_64/ia64 only)
+- move %{_prefix}/libexec/getconf/* to glibc from glibc-common
+- make %{_prefix}/libexec/getconf directory owned by glibc package
+
 * Fri Dec  3 2004 Jakub Jelinek <jakub@redhat.com> 2.3.3-87
 - update from CVS
   - build libpthread_nonshared.a objects with -fPIC on s390/s390x
diff --git a/libio/fileops.c b/libio/fileops.c
index 2d787d296f..19151cf188 100644
--- a/libio/fileops.c
+++ b/libio/fileops.c
@@ -1035,54 +1035,20 @@ _IO_new_file_seekoff (fp, offset, dir, mode)
   if (fp->_offset != _IO_pos_BAD && fp->_IO_read_base != NULL
       && !_IO_in_backup (fp))
     {
-      /* Offset relative to start of main get area. */
-      _IO_off64_t rel_offset = (offset - fp->_offset
-				+ (fp->_IO_read_end - fp->_IO_read_base));
-      if (rel_offset >= 0)
+      _IO_off64_t start_offset = (fp->_offset
+				  - (fp->_IO_read_end - fp->_IO_buf_base));
+      if (offset >= start_offset && offset < fp->_offset)
 	{
-#if 0
-	  if (_IO_in_backup (fp))
-	    _IO_switch_to_main_get_area (fp);
-#endif
-	  if (rel_offset <= fp->_IO_read_end - fp->_IO_read_base)
-	    {
-	      _IO_setg (fp, fp->_IO_buf_base, fp->_IO_buf_base + rel_offset,
-			fp->_IO_read_end);
-	      _IO_setp (fp, fp->_IO_buf_base, fp->_IO_buf_base);
-	      {
-		_IO_mask_flags (fp, 0, _IO_EOF_SEEN);
-		goto resync;
-	      }
-	    }
-#ifdef TODO
-	    /* If we have streammarkers, seek forward by reading ahead. */
-	    if (_IO_have_markers (fp))
-	      {
-		int to_skip = rel_offset
-		  - (fp->_IO_read_ptr - fp->_IO_read_base);
-		if (ignore (to_skip) != to_skip)
-		  goto dumb;
-		_IO_mask_flags (fp, 0, _IO_EOF_SEEN);
-		goto resync;
-	      }
-#endif
-	}
-#ifdef TODO
-      if (rel_offset < 0 && rel_offset >= Bbase () - Bptr ())
-	{
-	  if (!_IO_in_backup (fp))
-	    _IO_switch_to_backup_area (fp);
-	  gbump (fp->_IO_read_end + rel_offset - fp->_IO_read_ptr);
+	  _IO_setg (fp, fp->_IO_buf_base,
+		    fp->_IO_buf_base + (offset - start_offset),
+		    fp->_IO_read_end);
+	  _IO_setp (fp, fp->_IO_buf_base, fp->_IO_buf_base);
+
 	  _IO_mask_flags (fp, 0, _IO_EOF_SEEN);
 	  goto resync;
 	}
-#endif
     }
 
-#ifdef TODO
-  INTUSE(_IO_unsave_markers) (fp);
-#endif
-
   if (fp->_flags & _IO_NO_READS)
     goto dumb;
 
diff --git a/libio/ioseekpos.c b/libio/ioseekpos.c
index 4683ffe6c5..cfa9ed8088 100644
--- a/libio/ioseekpos.c
+++ b/libio/ioseekpos.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1993,1997,1998,1999,2002,2003 Free Software Foundation, Inc.
+/* Copyright (C) 1993,1997-1999,2002,2003,2004 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
@@ -47,7 +47,7 @@ _IO_seekpos_unlocked (fp, pos, mode)
 	INTUSE(_IO_free_wbackup_area) (fp);
     }
 
-  return _IO_SEEKPOS (fp, pos, mode);
+  return _IO_SEEKOFF (fp, pos, 0, mode);
 }
 
 
diff --git a/linuxthreads/ChangeLog b/linuxthreads/ChangeLog
index 79e9be1874..9e34a9768e 100644
--- a/linuxthreads/ChangeLog
+++ b/linuxthreads/ChangeLog
@@ -1,3 +1,8 @@
+2004-11-18  Daniel Jacobowitz  <dan@codesourcery.com>
+
+	* sysdeps/unix/sysv/linux/arm/sysdep-cancel.h: Update RETINSTR use.
+	* sysdeps/unix/sysv/linux/arm/vfork.S: Likewise.
+
 2004-12-01  Jakub Jelinek  <jakub@redhat.com>
 
 	* sysdeps/unix/sysv/linux/bits/posix_opt.h (_POSIX_CPUTIME,
@@ -22,11 +27,6 @@
 	These are now handled by generic magic from
 	libpthread-static-only-routines being set.
 
-2004-11-04  Roland McGrath  <roland@redhat.com>
-
-	* sysdeps/pthread/getcpuclockid.c (pthread_getcpuclockid)
-	[__NR_clock_getres]: Use kernel-supplied CPU clocks if available.
-
 2004-11-27  Ulrich Drepper  <drepper@redhat.com>
 
 	* sysdeps/unix/sysv/linux/bits/posix_opt.h (_POSIX_PRIORITIZED_IO,
diff --git a/linuxthreads/sysdeps/unix/sysv/linux/arm/sysdep-cancel.h b/linuxthreads/sysdeps/unix/sysv/linux/arm/sysdep-cancel.h
index 92d8460e26..019bd54913 100644
--- a/linuxthreads/sysdeps/unix/sysv/linux/arm/sysdep-cancel.h
+++ b/linuxthreads/sysdeps/unix/sysv/linux/arm/sysdep-cancel.h
@@ -112,7 +112,7 @@ extern int __local_multiple_threads attribute_hidden;
 #   define MAYBE_SAVE_LR						\
   str lr, [sp, $-4]!;
 #   define PSEUDO_RET_MOV						\
-  RETINSTR(movcc, pc, lr);						\
+  RETINSTR(cc, lr);							\
   b PLTJMP(SYSCALL_ERROR)
 #   define PSEUDO_PROLOGUE
 #  else
diff --git a/linuxthreads/sysdeps/unix/sysv/linux/arm/vfork.S b/linuxthreads/sysdeps/unix/sysv/linux/arm/vfork.S
index 23687342d1..2708c701eb 100644
--- a/linuxthreads/sysdeps/unix/sysv/linux/arm/vfork.S
+++ b/linuxthreads/sysdeps/unix/sysv/linux/arm/vfork.S
@@ -46,7 +46,7 @@ ENTRY (__vfork)
 		
 	swi	__NR_vfork
 	cmn	a1, #4096
-	RETINSTR(movcc, pc, lr)
+	RETINSTR(cc, lr)
 
 #ifndef __ASSUME_VFORK_SYSCALL
 	/* Check if vfork syscall is known at all.  */
@@ -60,7 +60,7 @@ ENTRY (__vfork)
 	/* If we don't have vfork, fork is close enough.  */
 	swi	__NR_fork
 	cmn	a1, #4096
-	RETINSTR(movcc, pc, lr)
+	RETINSTR(cc, lr)
 #elif !defined __NR_vfork
 # error "__NR_vfork not available and __ASSUME_VFORK_SYSCALL defined"
 #endif
diff --git a/nis/ypclnt.c b/nis/ypclnt.c
index 5ad78eda00..85292b62d9 100644
--- a/nis/ypclnt.c
+++ b/nis/ypclnt.c
@@ -829,11 +829,6 @@ yperr_string (const int error)
 static const int8_t yp_2_yperr[] =
   {
 #define YP2YPERR(yp, yperr)  [YP_##yp - YP_VERS] = YPERR_##yperr
-    YP2YPERR (TRUE, SUCCESS),
-    YP2YPERR (NOMORE, NOMORE),
-    YP2YPERR (FALSE, YPERR),
-    YP2YPERR (NOMAP, MAP),
-    YP2YPERR (NODOM, DOMAIN),
     YP2YPERR (NOKEY, KEY),
     YP2YPERR (BADOP, YPERR),
     YP2YPERR (BADDB, BADDB),
diff --git a/nptl/ChangeLog b/nptl/ChangeLog
index 54554ed839..1cd8b62142 100644
--- a/nptl/ChangeLog
+++ b/nptl/ChangeLog
@@ -1,3 +1,10 @@
+2004-12-04  Ulrich Drepper  <drepper@redhat.com>
+
+	* Makefile (tests): Add tst-getpid1.
+	* tst-getpid1.c: New file.
+	* sysdeps/unix/sysv/linux/i386/clone.S: New file.
+	* sysdeps/unix/sysv/linux/x86_64/clone.S: New file.
+
 2004-12-01  Jakub Jelinek  <jakub@redhat.com>
 
 	* sysdeps/unix/sysv/linux/bits/posix_opt.h (_POSIX_CPUTIME,
@@ -22,12 +29,6 @@
 	These are now handled by generic magic from
 	libpthread-static-only-routines being set.
 
-2004-11-17  Roland McGrath  <roland@redhat.com>
-
-	* sysdeps/unix/sysv/linux/timer_create.c (timer_create): Handle
-	CLOCK_PROCESS_CPUTIME_ID and CLOCK_PROCESS_THREAD_ID specially,
-	translating to the kernel clockid_t for our own process/thread clock.
-
 2004-11-27  Ulrich Drepper  <drepper@redhat.com>
 
 	* sysdeps/unix/sysv/linux/bits/posix_opt.h (_POSIX_PRIORITIZED_IO,
@@ -118,10 +119,6 @@
 	here, before calling clone.
 	* pthread_create.c (start_thread): Don't do it here.
 
-2004-11-04  Roland McGrath  <roland@redhat.com>
-
-	* sysdeps/unix/sysv/linux/pthread_getcpuclockid.c: New file.
-
 2004-11-02  Jakub Jelinek  <jakub@redhat.com>
 
 	* sysdeps/unix/sysv/linux/smp.h: Include <errno.h>.
diff --git a/nptl/Makefile b/nptl/Makefile
index d677318d00..9eb61927e3 100644
--- a/nptl/Makefile
+++ b/nptl/Makefile
@@ -240,7 +240,8 @@ tests = tst-attr1 tst-attr2 tst-attr3 \
 	tst-sched1 \
 	tst-backtrace1 \
 	tst-oddstacklimit \
-	tst-vfork1 tst-vfork2 tst-vfork1x tst-vfork2x
+	tst-vfork1 tst-vfork2 tst-vfork1x tst-vfork2x \
+	tst-getpid1
 xtests = tst-setuid1 tst-setuid1-static
 
 # Files which must not be linked with libpthread.
diff --git a/nptl/sysdeps/unix/sysv/linux/i386/clone.S b/nptl/sysdeps/unix/sysv/linux/i386/clone.S
new file mode 100644
index 0000000000..95c17f18e4
--- /dev/null
+++ b/nptl/sysdeps/unix/sysv/linux/i386/clone.S
@@ -0,0 +1,2 @@
+#define RESET_PID
+#include <sysdeps/unix/sysv/linux/i386/clone.S>
diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/clone.S b/nptl/sysdeps/unix/sysv/linux/x86_64/clone.S
new file mode 100644
index 0000000000..dfa6adb3e2
--- /dev/null
+++ b/nptl/sysdeps/unix/sysv/linux/x86_64/clone.S
@@ -0,0 +1,2 @@
+#define RESET_PID
+#include <sysdeps/unix/sysv/linux/x86_64/clone.S>
diff --git a/nptl/tst-getpid1.c b/nptl/tst-getpid1.c
new file mode 100644
index 0000000000..9d637159c4
--- /dev/null
+++ b/nptl/tst-getpid1.c
@@ -0,0 +1,99 @@
+#include <sched.h>
+#include <signal.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+
+static int sig;
+
+static int
+f (void *a)
+{
+  puts ("in f");
+  union sigval sival;
+  sival.sival_int = getpid ();
+  printf ("pid = %d\n", sival.sival_int);
+  if (sigqueue (getppid (), sig, sival) != 0)
+    return 1;
+  return 0;
+}
+
+
+static int
+do_test (void)
+{
+  int mypid = getpid ();
+
+  sig = SIGRTMIN;
+  sigset_t ss;
+  sigemptyset (&ss);
+  sigaddset (&ss, sig);
+  if (sigprocmask (SIG_BLOCK, &ss, NULL) != 0)
+    {
+      printf ("sigprocmask failed: %m\n");
+      return 1;
+    }
+
+  char st[128 * 1024];
+  pid_t p = clone (f, st + sizeof (st), 0, 0);
+  if (p == -1)
+    {
+      printf("clone failed: %m\n");
+      return 1;
+    }
+  printf ("new thread: %d\n", (int) p);
+
+  siginfo_t si;
+  do
+    if (sigwaitinfo (&ss, &si) < 0)
+      {
+	printf("sigwaitinfo failed: %m\n");
+	kill (p, SIGKILL);
+	return 1;
+      }
+  while  (si.si_signo != sig || si.si_code != SI_QUEUE);
+
+  if (si.si_int != (int) p)
+    {
+      printf ("expected PID %d, got si_int %d\n", (int) p, si.si_int);
+      kill (p, SIGKILL);
+      return 1;
+    }
+
+  if (si.si_pid != p)
+    {
+      printf ("expected PID %d, got si_pid %d\n", (int) p, (int) si.si_pid);
+      kill (p, SIGKILL);
+      return 1;
+    }
+
+  int e;
+  if (waitpid (p, &e, __WCLONE) != p)
+    {
+      puts ("waitpid failed");
+      kill (p, SIGKILL);
+      return 1;
+    }
+  if (!WIFEXITED (e))
+    {
+      puts ("did not terminate correctly");
+      return 1;
+    }
+  if (WEXITSTATUS (e) != 0)
+    {
+      printf ("exit code %d\n", WEXITSTATUS (e));
+      return 1;
+    }
+
+  if (getpid () != mypid)
+    {
+      puts ("my PID changed");
+      return 1;
+    }
+
+  return 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/posix/confstr.c b/posix/confstr.c
index da929c25df..185b02fd8a 100644
--- a/posix/confstr.c
+++ b/posix/confstr.c
@@ -113,7 +113,7 @@ confstr (name, buf, len)
     case _CS_POSIX_V6_ILP32_OFF32_CFLAGS:
 #ifdef __ILP32_OFF32_CFLAGS
 # if _POSIX_V6_ILP32_OFF32 == -1
-#  error __ILP32_OFF32_CFLAGS should not be defined
+#  error "__ILP32_OFF32_CFLAGS should not be defined"
 # elif !defined _POSIX_V6_ILP32_OFF32
       if (__sysconf (_SC_V6_ILP32_OFF32) < 0)
         break;
@@ -127,7 +127,7 @@ confstr (name, buf, len)
     case _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS:
 #ifdef __ILP32_OFFBIG_CFLAGS
 # if _POSIX_V6_ILP32_OFFBIG == -1
-#  error __ILP32_OFFBIG_CFLAGS should not be defined
+#  error "__ILP32_OFFBIG_CFLAGS should not be defined"
 # elif !defined _POSIX_V6_ILP32_OFFBIG
       if (__sysconf (_SC_V6_ILP32_OFFBIG) < 0)
         break;
@@ -141,7 +141,7 @@ confstr (name, buf, len)
     case _CS_POSIX_V6_LP64_OFF64_CFLAGS:
 #ifdef __LP64_OFF64_CFLAGS
 # if _POSIX_V6_LP64_OFF64 == -1
-#  error __LP64_OFF64_CFLAGS should not be defined
+#  error "__LP64_OFF64_CFLAGS should not be defined"
 # elif !defined _POSIX_V6_LP64_OFF64
       if (__sysconf (_SC_V6_LP64_OFF64) < 0)
         break;
@@ -155,7 +155,7 @@ confstr (name, buf, len)
     case _CS_POSIX_V6_ILP32_OFF32_LDFLAGS:
 #ifdef __ILP32_OFF32_LDFLAGS
 # if _POSIX_V6_ILP32_OFF32 == -1
-#  error __ILP32_OFF32_LDFLAGS should not be defined
+#  error "__ILP32_OFF32_LDFLAGS should not be defined"
 # elif !defined _POSIX_V6_ILP32_OFF32
       if (__sysconf (_SC_V6_ILP32_OFF32) < 0)
         break;
@@ -169,7 +169,7 @@ confstr (name, buf, len)
     case _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS:
 #ifdef __ILP32_OFFBIG_LDFLAGS
 # if _POSIX_V6_ILP32_OFFBIG == -1
-#  error __ILP32_OFFBIG_LDFLAGS should not be defined
+#  error "__ILP32_OFFBIG_LDFLAGS should not be defined"
 # elif !defined _POSIX_V6_ILP32_OFFBIG
       if (__sysconf (_SC_V6_ILP32_OFFBIG) < 0)
         break;
@@ -183,7 +183,7 @@ confstr (name, buf, len)
     case _CS_POSIX_V6_LP64_OFF64_LDFLAGS:
 #ifdef __LP64_OFF64_LDFLAGS
 # if _POSIX_V6_LP64_OFF64 == -1
-#  error __LP64_OFF64_LDFLAGS should not be defined
+#  error "__LP64_OFF64_LDFLAGS should not be defined"
 # elif !defined _POSIX_V6_LP64_OFF64
       if (__sysconf (_SC_V6_LP64_OFF64) < 0)
         break;
diff --git a/posix/regcomp.c b/posix/regcomp.c
index 675f816f60..5de5bf725a 100644
--- a/posix/regcomp.c
+++ b/posix/regcomp.c
@@ -596,8 +596,6 @@ free_dfa_content (re_dfa_t *dfa)
 {
   int i, j;
 
-  re_free (dfa->subexps);
-
   if (dfa->nodes)
     for (i = 0; i < dfa->nodes_len; ++i)
       {
@@ -884,9 +882,6 @@ init_dfa (dfa, pat_len)
   dfa->state_table = calloc (sizeof (struct re_state_table_entry), table_size);
   dfa->state_hash_mask = table_size - 1;
 
-  dfa->subexps_alloc = 1;
-  dfa->subexps = re_malloc (re_subexp_t, dfa->subexps_alloc);
-
   dfa->mb_cur_max = MB_CUR_MAX;
 #ifdef _LIBC
   if (dfa->mb_cur_max == 6
@@ -950,8 +945,7 @@ init_dfa (dfa, pat_len)
     }
 #endif
 
-  if (BE (dfa->nodes == NULL || dfa->state_table == NULL
-	  || dfa->subexps == NULL, 0))
+  if (BE (dfa->nodes == NULL || dfa->state_table == NULL, 0))
     return REG_ESPACE;
   return REG_NOERROR;
 }
@@ -1028,7 +1022,7 @@ create_initial_state (dfa)
 	    re_token_t *clexp_node;
 	    clexp_node = dfa->nodes + init_nodes.elems[clexp_idx];
 	    if (clexp_node->type == OP_CLOSE_SUBEXP
-		&& clexp_node->opr.idx + 1 == dfa->nodes[node_idx].opr.idx)
+		&& clexp_node->opr.idx == dfa->nodes[node_idx].opr.idx)
 	      break;
 	  }
 	if (clexp_idx == init_nodes.nelem)
@@ -1837,7 +1831,7 @@ peek_token (token, input, syntax)
 	  if (!(syntax & RE_NO_BK_REFS))
 	    {
 	      token->type = OP_BACK_REF;
-	      token->opr.idx = c2 - '0';
+	      token->opr.idx = c2 - '1';
 	    }
 	  break;
 	case '<':
@@ -2295,13 +2289,12 @@ parse_expression (regexp, preg, token, syntax, nest, err)
 	return NULL;
       break;
     case OP_BACK_REF:
-      if (BE (preg->re_nsub < token->opr.idx
-	      || dfa->subexps[token->opr.idx - 1].end == -1, 0))
+      if (!BE (dfa->completed_bkref_map & (1 << token->opr.idx), 1))
 	{
 	  *err = REG_ESUBREG;
 	  return NULL;
 	}
-      dfa->used_bkref_map |= 1 << (token->opr.idx - 1);
+      dfa->used_bkref_map |= 1 << token->opr.idx;
       tree = re_dfa_add_tree_node (dfa, NULL, NULL, token);
       if (BE (tree == NULL, 0))
 	{
@@ -2472,21 +2465,6 @@ parse_sub_exp (regexp, preg, token, syntax, nest, err)
   bin_tree_t *tree, *left_par, *right_par;
   size_t cur_nsub;
   cur_nsub = preg->re_nsub++;
-  if (BE (dfa->subexps_alloc < preg->re_nsub, 0))
-    {
-      re_subexp_t *new_array;
-      dfa->subexps_alloc *= 2;
-      new_array = re_realloc (dfa->subexps, re_subexp_t, dfa->subexps_alloc);
-      if (BE (new_array == NULL, 0))
-	{
-	  dfa->subexps_alloc /= 2;
-	  *err = REG_ESPACE;
-	  return NULL;
-	}
-      dfa->subexps = new_array;
-    }
-  dfa->subexps[cur_nsub].start = dfa->nodes_len;
-  dfa->subexps[cur_nsub].end = -1;
 
   left_par = re_dfa_add_tree_node (dfa, NULL, NULL, token);
   if (BE (left_par == NULL, 0))
@@ -2512,7 +2490,7 @@ parse_sub_exp (regexp, preg, token, syntax, nest, err)
       return NULL;
     }
   right_par = re_dfa_add_tree_node (dfa, NULL, NULL, token);
-  dfa->subexps[cur_nsub].end = dfa->nodes_len;
+  dfa->completed_bkref_map |= 1 << cur_nsub;
   tree = ((tree == NULL) ? right_par
 	  : create_tree (dfa, tree, right_par, CONCAT, 0));
   tree = create_tree (dfa, left_par, tree, CONCAT, 0);
diff --git a/posix/regex_internal.h b/posix/regex_internal.h
index 703d409eb8..1345067a89 100644
--- a/posix/regex_internal.h
+++ b/posix/regex_internal.h
@@ -496,13 +496,6 @@ struct re_dfastate_t
 };
 typedef struct re_dfastate_t re_dfastate_t;
 
-typedef struct
-{
-  /* start <= node < end  */
-  int start;
-  int end;
-} re_subexp_t;
-
 struct re_state_table_entry
 {
   int num;
@@ -607,7 +600,6 @@ struct re_fail_stack_t
 
 struct re_dfa_t
 {
-  re_subexp_t *subexps;
   re_token_t *nodes;
   int nodes_alloc;
   int nodes_len;
@@ -627,13 +619,15 @@ struct re_dfa_t
   int str_tree_storage_idx;
 
   /* number of subexpressions `re_nsub' is in regex_t.  */
-  int subexps_alloc;
   unsigned int state_hash_mask;
   int states_alloc;
   int init_node;
   int nbackref; /* The number of backreference in this dfa.  */
+
   /* Bitmap expressing which backreference is used.  */
   unsigned int used_bkref_map;
+  unsigned int completed_bkref_map;
+
   unsigned int has_plural_match : 1;
   /* If this dfa has "multibyte node", which is a backreference or
      a node which can accept multibyte character or multi character
diff --git a/posix/regexec.c b/posix/regexec.c
index 5877adeb55..22b806439b 100644
--- a/posix/regexec.c
+++ b/posix/regexec.c
@@ -1260,7 +1260,7 @@ proceed_next_node (mctx, nregs, regs, pidx, node, eps_via_nodes, fs)
 #endif /* RE_ENABLE_I18N */
       if (type == OP_BACK_REF)
 	{
-	  int subexp_idx = dfa->nodes[node].opr.idx;
+	  int subexp_idx = dfa->nodes[node].opr.idx + 1;
 	  naccepted = regs[subexp_idx].rm_eo - regs[subexp_idx].rm_so;
 	  if (fs != NULL)
 	    {
@@ -1853,7 +1853,7 @@ check_dst_limits (mctx, limits, dst_node, dst_idx, src_node, src_idx)
       int subexp_idx;
       struct re_backref_cache_entry *ent;
       ent = mctx->bkref_ents + limits->elems[lim_idx];
-      subexp_idx = dfa->nodes[ent->node].opr.idx - 1;
+      subexp_idx = dfa->nodes[ent->node].opr.idx;
 
       dst_pos = check_dst_limits_calc_pos (mctx, limits->elems[lim_idx],
 					   subexp_idx, dst_node, dst_idx,
@@ -1891,49 +1891,48 @@ check_dst_limits_calc_pos_1 (mctx, boundaries, subexp_idx, from_node, bkref_idx)
       switch (dfa->nodes[node].type)
 	{
 	case OP_BACK_REF:
-	  {
-	    struct re_backref_cache_entry *ent = mctx->bkref_ents + bkref_idx;
-	    do
-	      {
-		int dst, cpos;
-
-		if (ent->node != node)
-		  continue;
-
-		if (subexp_idx <= 8 * sizeof (ent->eps_reachable_subexps_map)
-		    && (ent->eps_reachable_subexps_map
-			& (1 << (subexp_idx - 1))) == 0)
-		  continue;
+	  if (bkref_idx != -1)
+	    {
+	      struct re_backref_cache_entry *ent = mctx->bkref_ents + bkref_idx;
+	      do
+	        {
+		  int dst, cpos;
 
-		/* Recurse trying to reach the OP_OPEN_SUBEXP and
-		   OP_CLOSE_SUBEXP cases below.  But, if the
-		   destination node is the same node as the source
-		   node, don't recurse because it would cause an
-		   infinite loop: a regex that exhibits this behavior
-		   is ()\1*\1*  */
-		dst = dfa->edests[node].elems[0];
-		if (dst == from_node)
-		  {
-		    if (boundaries & 1)
-		      return -1;
-		    else /* if (boundaries & 2) */
-		      return 0;
-		  }
+		  if (ent->node != node)
+		    continue;
 
-		cpos = check_dst_limits_calc_pos_1 (mctx, boundaries,
-						    subexp_idx, dst, bkref_idx);
+		  if (subexp_idx <= 8 * sizeof (ent->eps_reachable_subexps_map)
+		      && !(ent->eps_reachable_subexps_map & (1 << subexp_idx)))
+		    continue;
 
-		if (cpos == -1 /* && (boundaries & 1) */)
-		  return -1;
+		  /* Recurse trying to reach the OP_OPEN_SUBEXP and
+		     OP_CLOSE_SUBEXP cases below.  But, if the
+		     destination node is the same node as the source
+		     node, don't recurse because it would cause an
+		     infinite loop: a regex that exhibits this behavior
+		     is ()\1*\1*  */
+		  dst = dfa->edests[node].elems[0];
+		  if (dst == from_node)
+		    {
+		      if (boundaries & 1)
+		        return -1;
+		      else /* if (boundaries & 2) */
+		        return 0;
+		    }
 
-		if (cpos == 0 && (boundaries & 2))
-		  return 0;
+		  cpos =
+		    check_dst_limits_calc_pos_1 (mctx, boundaries, subexp_idx,
+						 dst, bkref_idx);
+		  if (cpos == -1 /* && (boundaries & 1) */)
+		    return -1;
+		  if (cpos == 0 && (boundaries & 2))
+		    return 0;
 
-		ent->eps_reachable_subexps_map &= ~(1 << (subexp_idx - 1));
-	      }
-	    while (ent++->more);
-	    break;
-	  }
+		  ent->eps_reachable_subexps_map &= ~(1 << subexp_idx);
+	        }
+	      while (ent++->more);
+	    }
+	  break;
 
 	case OP_OPEN_SUBEXP:
 	  if ((boundaries & 1) && subexp_idx == dfa->nodes[node].opr.idx)
@@ -2003,7 +2002,7 @@ check_subexp_limits (dfa, dest_nodes, candidates, limits, bkref_ents, str_idx)
       if (str_idx <= ent->subexp_from || ent->str_idx < str_idx)
 	continue; /* This is unrelated limitation.  */
 
-      subexp_idx = dfa->nodes[ent->node].opr.idx - 1;
+      subexp_idx = dfa->nodes[ent->node].opr.idx;
       if (ent->subexp_to == str_idx)
 	{
 	  int ops_node = -1;
@@ -2060,16 +2059,12 @@ check_subexp_limits (dfa, dest_nodes, candidates, limits, bkref_ents, str_idx)
 		{
 		  if (subexp_idx != dfa->nodes[node].opr.idx)
 		    continue;
-		  if ((type == OP_CLOSE_SUBEXP && ent->subexp_to != str_idx)
-		      || (type == OP_OPEN_SUBEXP))
-		    {
-		      /* It is against this limitation.
-			 Remove it form the current sifted state.  */
-		      err = sub_epsilon_src_nodes (dfa, node, dest_nodes,
-						   candidates);
-		      if (BE (err != REG_NOERROR, 0))
-			return err;
-		    }
+		  /* It is against this limitation.
+		     Remove it form the current sifted state.  */
+		  err = sub_epsilon_src_nodes (dfa, node, dest_nodes,
+					       candidates);
+		  if (BE (err != REG_NOERROR, 0))
+		    return err;
 		}
 	    }
 	}
@@ -2656,7 +2651,7 @@ get_subexp (mctx, bkref_node, bkref_str_idx)
       while (entry++->more);
     }
 
-  subexp_num = dfa->nodes[bkref_node].opr.idx - 1;
+  subexp_num = dfa->nodes[bkref_node].opr.idx;
 
   /* For each sub expression  */
   for (sub_top_idx = 0; sub_top_idx < mctx->nsub_tops; ++sub_top_idx)
diff --git a/rt/Makefile b/rt/Makefile
index 29e7f847e4..407cc99897 100644
--- a/rt/Makefile
+++ b/rt/Makefile
@@ -45,7 +45,7 @@ tests := tst-shm tst-clock tst-clock_nanosleep tst-timer tst-timer2 \
 	 tst-aio tst-aio64 tst-aio2 tst-aio3 tst-aio4 tst-aio5 tst-aio6 \
 	 tst-aio7 tst-mqueue1 tst-mqueue2 tst-mqueue3 tst-mqueue4 \
 	 tst-mqueue5 tst-mqueue6 tst-mqueue7 tst-mqueue8 tst-mqueue9 \
-	 tst-timer3 tst-timer4
+	 tst-timer3 tst-timer4 tst-timer5
 
 extra-libs := librt
 extra-libs-others := $(extra-libs)
diff --git a/rt/tst-timer4.c b/rt/tst-timer4.c
index bc5d14e5b7..5bec01181d 100644
--- a/rt/tst-timer4.c
+++ b/rt/tst-timer4.c
@@ -27,6 +27,10 @@
 #if _POSIX_THREADS
 # include <pthread.h>
 
+# ifndef TEST_CLOCK
+#  define TEST_CLOCK		CLOCK_REALTIME
+# endif
+
 pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
 pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
 
@@ -40,7 +44,7 @@ static void
 thr1 (union sigval sigval)
 {
   pthread_mutex_lock (&lock);
-  thr1_err = clock_gettime (CLOCK_REALTIME, &thr1_ts);
+  thr1_err = clock_gettime (TEST_CLOCK, &thr1_ts);
   if (thr1_cnt >= 5)
     {
       struct itimerspec it = { };
@@ -86,7 +90,7 @@ thr2 (union sigval sigval)
         }
     }
   pthread_mutex_lock (&lock);
-  thr2_err = clock_gettime (CLOCK_REALTIME, &thr2_ts) | err;
+  thr2_err = clock_gettime (TEST_CLOCK, &thr2_ts) | err;
   if (thr2_cnt >= 5)
     {
       struct itimerspec it = { };
@@ -110,7 +114,7 @@ sig1_handler (int sig, siginfo_t *info, void *ctx)
   if (sig != SIGRTMIN) err |= 1 << 0;
   if (info->si_signo != SIGRTMIN) err |= 1 << 1;
   if (info->si_code != SI_TIMER) err |= 1 << 2;
-  if (clock_gettime (CLOCK_REALTIME, &sig1_ts) != 0)
+  if (clock_gettime (TEST_CLOCK, &sig1_ts) != 0)
     err |= 1 << 3;
   if (sig1_cnt >= 5)
     {
@@ -134,7 +138,7 @@ sig2_handler (int sig, siginfo_t *info, void *ctx)
   if (sig != SIGRTMIN + 1) err |= 1 << 0;
   if (info->si_signo != SIGRTMIN + 1) err |= 1 << 1;
   if (info->si_code != SI_TIMER) err |= 1 << 2;
-  if (clock_gettime (CLOCK_REALTIME, &sig2_ts) != 0)
+  if (clock_gettime (TEST_CLOCK, &sig2_ts) != 0)
     err |= 1 << 3;
   if (sig2_cnt >= 5)
     {
@@ -181,8 +185,17 @@ do_test (void)
 {
   int result = 0;
 
+#ifdef TEST_CLOCK_MISSING
+  const char *missing = TEST_CLOCK_MISSING (TEST_CLOCK);
+  if (missing != NULL)
+    {
+      printf ("%s missing, skipping test\n", missing);
+      return 0;
+    }
+#endif
+
   struct timespec ts;
-  if (clock_gettime (CLOCK_REALTIME, &ts) != 0)
+  if (clock_gettime (TEST_CLOCK, &ts) != 0)
     {
       printf ("*** clock_gettime failed: %m\n");
       result = 1;
@@ -191,7 +204,7 @@ do_test (void)
     printf ("clock_gettime returned timespec = { %ld, %ld }\n",
 	    (long) ts.tv_sec, ts.tv_nsec);
 
-  if (clock_getres (CLOCK_REALTIME, &ts) != 0)
+  if (clock_getres (TEST_CLOCK, &ts) != 0)
     {
       printf ("*** clock_getres failed: %m\n");
       result = 1;
@@ -203,7 +216,7 @@ do_test (void)
   struct sigevent ev;
   memset (&ev, 0x11, sizeof (ev));
   ev.sigev_notify = SIGEV_NONE;
-  if (timer_create (CLOCK_REALTIME, &ev, &timer_none) != 0)
+  if (timer_create (TEST_CLOCK, &ev, &timer_none) != 0)
     {
       printf ("*** timer_create for timer_none failed: %m\n");
       return 1;
@@ -220,7 +233,7 @@ do_test (void)
   ev.sigev_notify = SIGEV_SIGNAL;
   ev.sigev_signo = SIGRTMIN;
   ev.sigev_value.sival_ptr = &ev;
-  if (timer_create (CLOCK_REALTIME, &ev, &timer_sig1) != 0)
+  if (timer_create (TEST_CLOCK, &ev, &timer_sig1) != 0)
     {
       printf ("*** timer_create for timer_sig1 failed: %m\n");
       return 1;
@@ -230,7 +243,7 @@ do_test (void)
   ev.sigev_notify = SIGEV_SIGNAL;
   ev.sigev_signo = SIGRTMIN + 1;
   ev.sigev_value.sival_int = 163;
-  if (timer_create (CLOCK_REALTIME, &ev, &timer_sig2) != 0)
+  if (timer_create (TEST_CLOCK, &ev, &timer_sig2) != 0)
     {
       printf ("*** timer_create for timer_sig2 failed: %m\n");
       return 1;
@@ -241,7 +254,7 @@ do_test (void)
   ev.sigev_notify_function = thr1;
   ev.sigev_notify_attributes = NULL;
   ev.sigev_value.sival_ptr = &ev;
-  if (timer_create (CLOCK_REALTIME, &ev, &timer_thr1) != 0)
+  if (timer_create (TEST_CLOCK, &ev, &timer_thr1) != 0)
     {
       printf ("*** timer_create for timer_thr1 failed: %m\n");
       return 1;
@@ -260,7 +273,7 @@ do_test (void)
   ev.sigev_notify_function = thr2;
   ev.sigev_notify_attributes = &nattr;
   ev.sigev_value.sival_int = 111;
-  if (timer_create (CLOCK_REALTIME, &ev, &timer_thr2) != 0)
+  if (timer_create (TEST_CLOCK, &ev, &timer_thr2) != 0)
     {
       printf ("*** timer_create for timer_thr2 failed: %m\n");
       return 1;
@@ -330,7 +343,7 @@ do_test (void)
 #endif
 
   struct timespec startts;
-  if (clock_gettime (CLOCK_REALTIME, &startts) != 0)
+  if (clock_gettime (TEST_CLOCK, &startts) != 0)
     {
       printf ("*** clock_gettime failed: %m\n");
       result = 1;
@@ -482,7 +495,7 @@ do_test (void)
       result = 1;
     }
 
-  if (clock_gettime (CLOCK_REALTIME, &startts) != 0)
+  if (clock_gettime (TEST_CLOCK, &startts) != 0)
     {
       printf ("*** clock_gettime failed: %m\n");
       result = 1;
diff --git a/rt/tst-timer5.c b/rt/tst-timer5.c
new file mode 100644
index 0000000000..2683021eda
--- /dev/null
+++ b/rt/tst-timer5.c
@@ -0,0 +1,14 @@
+/* Timer test using the monotonic clock.  */
+
+#include <time.h>
+#include <unistd.h>
+
+#if defined CLOCK_MONOTONIC && defined _POSIX_MONOTONIC_CLOCK
+# define TEST_CLOCK	CLOCK_MONOTONIC
+# define TEST_CLOCK_MISSING(clock) \
+  (sysconf (_SC_MONOTONIC_CLOCK) > 0 ? NULL : #clock)
+# include "tst-timer4.c"
+#else
+# define TEST_FUNCTION	0
+# include "../test-skeleton.c"
+#endif
diff --git a/sysdeps/arm/dl-machine.h b/sysdeps/arm/dl-machine.h
index 5dfe3346f5..761f8daeaa 100644
--- a/sysdeps/arm/dl-machine.h
+++ b/sysdeps/arm/dl-machine.h
@@ -123,7 +123,7 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile)
   return lazy;
 }
 
-#if defined(__THUMB_INTERWORK__)
+#if defined(__USE_BX__)
 #define BX(x) "bx\t" #x
 #else
 #define BX(x) "mov\tpc, " #x
@@ -293,7 +293,7 @@ _dl_start_user:\n\
 	ldr	r0, .L_FINI_PROC\n\
 	add	r0, sl, r0\n\
 	@ jump to the user_s entry point\n\
-	mov	pc, r6\n\
+	" BX(r6) "\n\
 .L_GET_GOT:\n\
 	.word	_GLOBAL_OFFSET_TABLE_ - .L_GOT_GOT - 4\n\
 .L_SKIP_ARGS:\n\
diff --git a/sysdeps/arm/strlen.S b/sysdeps/arm/strlen.S
index a83c41d26a..86e16652e4 100644
--- a/sysdeps/arm/strlen.S
+++ b/sysdeps/arm/strlen.S
@@ -68,6 +68,6 @@ Llastword:				@ drop through to here once we find a
 	tstne   r2, $0x00ff0000         @ (if first three all non-zero, 4th
 	addne   r0, r0, $1              @  must be zero)
 #endif
-	RETINSTR(mov,pc,lr)
+	DO_RET(lr)
 END(strlen)
 libc_hidden_builtin_def (strlen)
diff --git a/sysdeps/arm/sysdep.h b/sysdeps/arm/sysdep.h
index cb3f105afe..8ca77a60cb 100644
--- a/sysdeps/arm/sysdep.h
+++ b/sysdeps/arm/sysdep.h
@@ -19,6 +19,11 @@
 
 #include <sysdeps/generic/sysdep.h>
 
+#if (!defined (__ARM_ARCH_2__) && !defined (__ARM_ARCH_3__) \
+     && !defined (__ARM_ARCH_3M__) && !defined (__ARM_ARCH_4__))
+# define __USE_BX__
+#endif
+
 #ifdef	__ASSEMBLER__
 
 /* Syntactic details of assembler.  */
@@ -50,20 +55,22 @@
 #ifdef __APCS_32__
 #define LOADREGS(cond, base, reglist...)\
 	ldm##cond	base,reglist
-#define RETINSTR(instr, regs...)\
-	instr	regs
-#ifdef __THUMB_INTERWORK__
+#ifdef __USE_BX__
+#define RETINSTR(cond, reg)	\
+	bx##cond	reg
 #define DO_RET(_reg)		\
 	bx _reg
 #else
+#define RETINSTR(cond, reg)	\
+	mov##cond	pc, reg
 #define DO_RET(_reg)		\
 	mov pc, _reg
 #endif
 #else  /* APCS-26 */
 #define LOADREGS(cond, base, reglist...)\
 	ldm##cond	base,reglist^
-#define RETINSTR(instr, regs...)\
-	instr##s	regs
+#define RETINSTR(cond, reg)	\
+	mov##cond##s	pc, reg
 #define DO_RET(_reg)		\
 	movs pc, _reg
 #endif
diff --git a/sysdeps/generic/unsecvars.h b/sysdeps/generic/unsecvars.h
index 8a9dd43ce9..eb77b260d8 100644
--- a/sysdeps/generic/unsecvars.h
+++ b/sysdeps/generic/unsecvars.h
@@ -5,9 +5,12 @@
   "LD_PRELOAD\0"							      \
   "LD_LIBRARY_PATH\0"							      \
   "LD_ORIGIN_PATH\0"							      \
+  "LD_DEBUG\0"								      \
   "LD_DEBUG_OUTPUT\0"							      \
   "LD_PROFILE\0"							      \
   "LD_USE_LOAD_BIAS\0"							      \
+  "LD_DYNAMIC_WEAK\0"							      \
+  "LD_SHOW_AUXV\0"							      \
   "GCONV_PATH\0"							      \
   "GETCONF_DIR\0"							      \
   "HOSTALIASES\0"							      \
diff --git a/sysdeps/unix/arm/brk.S b/sysdeps/unix/arm/brk.S
index 9e20dc6932..914e8a8bbe 100644
--- a/sysdeps/unix/arm/brk.S
+++ b/sysdeps/unix/arm/brk.S
@@ -43,7 +43,7 @@ SYSCALL__ (brk, 1)
 #endif
 	str r0, [r1]
 	mov r0, $0
-	RETINSTR(mov, pc, r14)
+	DO_RET (r14)
 #ifdef PIC
 1:	.long _GLOBAL_OFFSET_TABLE_ - 2b - 8
 _cb_addr:
diff --git a/sysdeps/unix/arm/fork.S b/sysdeps/unix/arm/fork.S
index b317b66a97..bd00c92cfe 100644
--- a/sysdeps/unix/arm/fork.S
+++ b/sysdeps/unix/arm/fork.S
@@ -27,7 +27,7 @@ SYSCALL__ (fork, 0)
 	   R0&-1==R0, and the child gets R0&0==0.  */
 	sub r1, r1, $1
 	and r0, r0, r1
-	RETINSTR(mov, pc, r14)
+	DO_RET (r14)
 PSEUDO_END (__fork)
 libc_hidden_def (__fork)
 
diff --git a/sysdeps/unix/arm/sysdep.S b/sysdeps/unix/arm/sysdep.S
index 5fc80a872e..4810805d85 100644
--- a/sysdeps/unix/arm/sysdep.S
+++ b/sysdeps/unix/arm/sysdep.S
@@ -50,7 +50,7 @@ syscall_error:
 	ldr r1, 1f
 	str r0, [r1]
 	mvn r0, $0
-	RETINSTR(mov, pc, r14)
+	DO_RET (r14)
 
 1:	.long C_SYMBOL_NAME(errno)
 #else
@@ -60,7 +60,7 @@ syscall_error:
 0:	add r2, pc, r2
 	str r0, [r1, r2]
 	mvn r0, $0
-	RETINSTR(mov, pc, r14)
+	DO_RET (r14)
 
 1:	.word _GLOBAL_OFFSET_TABLE_ - 0b - 8
 2:	.word C_SYMBOL_NAME(errno)(GOTOFF)
diff --git a/sysdeps/unix/arm/sysdep.h b/sysdeps/unix/arm/sysdep.h
index d776b45aa2..5f36272f27 100644
--- a/sysdeps/unix/arm/sysdep.h
+++ b/sysdeps/unix/arm/sysdep.h
@@ -24,7 +24,7 @@
 
 #ifdef __ASSEMBLER__
 
-#define ret		RETINSTR(mov, pc, r14)
+#define ret		DO_RET (r14)
 #define MOVE(a,b)	mov b,a
 
 #endif
diff --git a/sysdeps/unix/clock_nanosleep.c b/sysdeps/unix/clock_nanosleep.c
index 6b170fd702..248bfe1c96 100644
--- a/sysdeps/unix/clock_nanosleep.c
+++ b/sysdeps/unix/clock_nanosleep.c
@@ -1,5 +1,5 @@
 /* High-resolution sleep with the specified clock.
-   Copyright (C) 2000, 2001, 2003 Free Software Foundation, Inc.
+   Copyright (C) 2000, 2001, 2003, 2004 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
@@ -49,16 +49,19 @@ clock_nanosleep (clockid_t clock_id, int flags, const struct timespec *req,
       || __builtin_expect (req->tv_nsec, 0) >= 1000000000)
     return EINVAL;
 
+  if (clock_id == CLOCK_THREAD_CPUTIME_ID)
+    return EINVAL;		/* POSIX specifies EINVAL for this case.  */
+
+#ifdef SYSDEP_NANOSLEEP
+  SYSDEP_NANOSLEEP;
+#endif
+
   if (CPUCLOCK_P (clock_id))
     return ENOTSUP;
 
   if (INVALID_CLOCK_P (clock_id))
     return EINVAL;
 
-#ifdef SYSDEP_NANOSLEEP
-  SYSDEP_NANOSLEEP;
-#endif
-
   /* If we got an absolute time, remap it.  */
   if (flags == TIMER_ABSTIME)
     {
diff --git a/sysdeps/unix/sysv/linux/arm/clone.S b/sysdeps/unix/sysv/linux/arm/clone.S
index 1c6f7861cf..bf07fb3952 100644
--- a/sysdeps/unix/sysv/linux/arm/clone.S
+++ b/sysdeps/unix/sysv/linux/arm/clone.S
@@ -45,7 +45,7 @@ ENTRY(__clone)
 	swi	SYS_ify(clone)
 	movs	a1, a1
 	blt	PLTJMP(C_SYMBOL_NAME(__syscall_error))
-	RETINSTR(movne, pc, lr)
+	RETINSTR(ne, lr)
 
 	@ pick the function arg and call address off the stack and execute
 	ldr	r0, [sp, #4]
diff --git a/sysdeps/unix/sysv/linux/arm/mmap.S b/sysdeps/unix/sysv/linux/arm/mmap.S
index 7beba6841c..cf6f253378 100644
--- a/sysdeps/unix/sysv/linux/arm/mmap.S
+++ b/sysdeps/unix/sysv/linux/arm/mmap.S
@@ -51,7 +51,7 @@ ENTRY (__mmap)
 	ldr	r5, [sp], #4
 
 	cmn	r0, $4096
-	RETINSTR(movcc, pc, lr)
+	RETINSTR(cc, lr)
 	b	PLTJMP(syscall_error)
 
 .Linval:
@@ -83,7 +83,7 @@ ENTRY (__mmap)
 	add	sp, sp, #16
 
 	cmn	r0, $4096
-	RETINSTR(movcc, pc, lr)
+	RETINSTR(cc, lr)
 	b	PLTJMP(syscall_error);
 #endif
 
diff --git a/sysdeps/unix/sysv/linux/arm/mmap64.S b/sysdeps/unix/sysv/linux/arm/mmap64.S
index f8361b5cbf..b4b712c2f2 100644
--- a/sysdeps/unix/sysv/linux/arm/mmap64.S
+++ b/sysdeps/unix/sysv/linux/arm/mmap64.S
@@ -43,12 +43,12 @@ ENTRY (__mmap64)
 # ifdef __ASSUME_MMAP2_SYSCALL
 	ldr	r4, [sp], #4
 	ldr	r5, [sp], #4
-	RETINSTR(movcc, pc, lr)	
+	RETINSTR(cc, lr)	
 	b	PLTJMP(syscall_error)
 # else
 	ldrcc	r4, [sp], #4
 	ldrcc	r5, [sp], #4
-	RETINSTR(movcc, pc, lr)
+	RETINSTR(cc, lr)
 	cmn	r0, $ENOSYS
 	bne	.Lerror
 	/* The current kernel does not support mmap2.  Fall back to plain
diff --git a/sysdeps/unix/sysv/linux/arm/socket.S b/sysdeps/unix/sysv/linux/arm/socket.S
index 3e93ceb6d2..212a489afe 100644
--- a/sysdeps/unix/sysv/linux/arm/socket.S
+++ b/sysdeps/unix/sysv/linux/arm/socket.S
@@ -91,7 +91,7 @@ ENTRY (__socket)
 
 	/* r0 is < 0 if there was an error.  */
 	cmn r0, $124
-	RETINSTR(movcc, pc, r14)
+	RETINSTR(cc, r14)
 	b PLTJMP(SYSCALL_ERROR)
 
 #if defined NEED_CANCELLATION && defined CENABLE
@@ -114,7 +114,7 @@ ENTRY (__socket)
 
 	/* r0 is < 0 if there was an error.  */
 	cmn r0, $124
-	RETINSTR(movcc, pc, r14)
+	RETINSTR(cc, r14)
 	b PLTJMP(SYSCALL_ERROR)
 #endif
 
diff --git a/sysdeps/unix/sysv/linux/arm/sysdep.h b/sysdeps/unix/sysv/linux/arm/sysdep.h
index fda7c5b267..668aa1a2f1 100644
--- a/sysdeps/unix/sysv/linux/arm/sysdep.h
+++ b/sysdeps/unix/sysv/linux/arm/sysdep.h
@@ -54,7 +54,7 @@
     cmn r0, $4096;
 
 #define PSEUDO_RET							      \
-    RETINSTR(movcc, pc, lr);						      \
+    RETINSTR(cc, lr);							      \
     b PLTJMP(SYSCALL_ERROR)
 #undef ret
 #define ret PSEUDO_RET
@@ -71,7 +71,7 @@
     DO_CALL (syscall_name, args);
 
 #define PSEUDO_RET_NOERRNO						      \
-    RETINSTR(mov, pc, lr);
+    DO_RET (lr);
 
 #undef ret_NOERRNO
 #define ret_NOERRNO PSEUDO_RET_NOERRNO
diff --git a/sysdeps/unix/sysv/linux/arm/vfork.S b/sysdeps/unix/sysv/linux/arm/vfork.S
index bba1a548ba..9ef5114b24 100644
--- a/sysdeps/unix/sysv/linux/arm/vfork.S
+++ b/sysdeps/unix/sysv/linux/arm/vfork.S
@@ -32,7 +32,7 @@ ENTRY (__vfork)
 #ifdef __NR_vfork
 	swi	__NR_vfork
 	cmn	a1, #4096
-	RETINSTR(movcc, pc, lr)
+	RETINSTR(cc, lr)
 
 # ifdef __ASSUME_VFORK_SYSCALL
 	b	PLTJMP(C_SYMBOL_NAME(__syscall_error))
@@ -47,7 +47,7 @@ ENTRY (__vfork)
 	/* If we don't have vfork, fork is close enough.  */
 	swi	__NR_fork
 	cmn	a1, #4096
-	RETINSTR(movcc, pc, lr)
+	RETINSTR(cc, lr)
     	b	PLTJMP(C_SYMBOL_NAME(__syscall_error))
 #elif !defined __NR_vfork
 # error "__NR_vfork not available and __ASSUME_VFORK_SYSCALL defined"
diff --git a/sysdeps/unix/sysv/linux/i386/clone.S b/sysdeps/unix/sysv/linux/i386/clone.S
index 94c6a72548..acd43dfb0b 100644
--- a/sysdeps/unix/sysv/linux/i386/clone.S
+++ b/sysdeps/unix/sysv/linux/i386/clone.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996,1997,98,99,2000,02,03 Free Software Foundation, Inc.
+/* Copyright (C) 1996,1997,98,99,2000,02,03,04 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Richard Henderson (rth@tamu.edu)
 
@@ -42,6 +42,9 @@
 #define __NR_clone 120
 #define SYS_clone 120
 
+#define CLONE_VM	0x00000100
+#define CLONE_THREAD	0x00010000
+
         .text
 ENTRY (BP_SYM (__clone))
 	/* Sanity check arguments.  */
@@ -74,7 +77,9 @@ ENTRY (BP_SYM (__clone))
 	movl	%eax,8(%ecx)
 	/* Don't leak any information.  */
 	movl	$0,4(%ecx)
+#ifndef RESET_PID
 	movl	$0,(%ecx)
+#endif
 
 	/* Do the system call */
 	pushl	%ebx
@@ -85,6 +90,12 @@ ENTRY (BP_SYM (__clone))
 	movl	FLAGS+12(%esp),%ebx
 	movl	CTID+12(%esp),%edi
 	movl	$SYS_ify(clone),%eax
+
+#ifdef RESET_PID
+	/* Remember the flag value.  */
+	movl	%ebx, (%ecx)
+#endif
+
 	int	$0x80
 	popl	%edi
 	popl	%esi
@@ -98,7 +109,13 @@ L(pseudo_end):
 	ret
 
 L(thread_start):
-	subl	%ebp,%ebp	/* terminate the stack frame */
+	/* Note: %esi is zero.  */
+	movl	%esi,%ebp	/* terminate the stack frame */
+#ifdef RESET_PID
+	testl	$CLONE_THREAD, %edi
+	je	L(newpid)
+L(haspid):
+#endif
 	call	*%ebx
 #ifdef PIC
 	call	L(here)
@@ -110,6 +127,21 @@ L(here):
 	movl	$SYS_ify(exit), %eax
 	int	$0x80
 
+#ifdef RESET_PID
+	.subsection 2
+L(newpid):
+	testl	$CLONE_VM, %edi
+	movl	$-1, %eax
+	jne	L(nomoregetpid)
+	movl	$SYS_ify(getpid), %eax
+	ENTER_KERNEL
+L(nomoregetpid):
+	movl	%eax, %gs:PID
+	movl	%eax, %gs:TID
+	jmp	L(haspid)
+	.previous
+#endif
+
 PSEUDO_END (BP_SYM (__clone))
 
 weak_alias (BP_SYM (__clone), BP_SYM (clone))
diff --git a/sysdeps/unix/sysv/linux/x86_64/clone.S b/sysdeps/unix/sysv/linux/x86_64/clone.S
index d182fe2f9e..9695e1eaf8 100644
--- a/sysdeps/unix/sysv/linux/x86_64/clone.S
+++ b/sysdeps/unix/sysv/linux/x86_64/clone.S
@@ -26,6 +26,9 @@
 #include <bp-sym.h>
 #include <bp-asm.h>
 
+#define CLONE_VM	0x00000100
+#define CLONE_THREAD	0x00010000
+
 /* The userland implementation is:
    int clone (int (*fn)(void *arg), void *child_stack, int flags, void *arg),
    the kernel entry is:
@@ -80,16 +83,29 @@ ENTRY (BP_SYM (__clone))
 
 	testq	%rax,%rax
 	jl	SYSCALL_ERROR_LABEL
-	jz	thread_start
+	jz	L(thread_start)
 
 L(pseudo_end):
 	ret
 
-thread_start:
+L(thread_start):
 	/* Clear the frame pointer.  The ABI suggests this be done, to mark
 	   the outermost frame obviously.  */
 	xorq	%rbp, %rbp
 
+#ifdef RESET_PID
+	testq	$CLONE_THREAD, %rdi
+	jne	1f
+	testq	$CLONE_VM, %rdi
+	movl	$-1, %eax
+	jne	2f
+	movq	$SYS_ify(getpid), %rax
+	syscall
+2:	movl	%eax, %fs:PID
+	movl	%eax, %fs:TID
+1:
+#endif
+
 	/* Set up arguments for the function call.  */
 	popq	%rax		/* Function to call.  */
 	popq	%rdi		/* Argument.  */
diff --git a/time/tzset.c b/time/tzset.c
index 48a4e4b140..0479abb38a 100644
--- a/time/tzset.c
+++ b/time/tzset.c
@@ -240,6 +240,7 @@ tzset_internal (always, explicit)
   switch (sscanf (tz, "%hu:%hu:%hu", &hh, &mm, &ss))
     {
     default:
+      tz_rules[0].offset = 0;
       goto out;
     case 1:
       mm = 0;