]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Updated to fedora-glibc-20041207T1331
authorJakub Jelinek <jakub@redhat.com>
Tue, 7 Dec 2004 14:01:11 +0000 (14:01 +0000)
committerJakub Jelinek <jakub@redhat.com>
Tue, 7 Dec 2004 14:01:11 +0000 (14:01 +0000)
41 files changed:
ChangeLog
Makeconfig
elf/rtld.c
fedora/branch.mk
fedora/glibc.spec.in
libio/fileops.c
libio/ioseekpos.c
linuxthreads/ChangeLog
linuxthreads/sysdeps/unix/sysv/linux/arm/sysdep-cancel.h
linuxthreads/sysdeps/unix/sysv/linux/arm/vfork.S
nis/ypclnt.c
nptl/ChangeLog
nptl/Makefile
nptl/sysdeps/unix/sysv/linux/i386/clone.S [new file with mode: 0644]
nptl/sysdeps/unix/sysv/linux/x86_64/clone.S [new file with mode: 0644]
nptl/tst-getpid1.c [new file with mode: 0644]
posix/confstr.c
posix/regcomp.c
posix/regex_internal.h
posix/regexec.c
rt/Makefile
rt/tst-timer4.c
rt/tst-timer5.c [new file with mode: 0644]
sysdeps/arm/dl-machine.h
sysdeps/arm/strlen.S
sysdeps/arm/sysdep.h
sysdeps/generic/unsecvars.h
sysdeps/unix/arm/brk.S
sysdeps/unix/arm/fork.S
sysdeps/unix/arm/sysdep.S
sysdeps/unix/arm/sysdep.h
sysdeps/unix/clock_nanosleep.c
sysdeps/unix/sysv/linux/arm/clone.S
sysdeps/unix/sysv/linux/arm/mmap.S
sysdeps/unix/sysv/linux/arm/mmap64.S
sysdeps/unix/sysv/linux/arm/socket.S
sysdeps/unix/sysv/linux/arm/sysdep.h
sysdeps/unix/sysv/linux/arm/vfork.S
sysdeps/unix/sysv/linux/i386/clone.S
sysdeps/unix/sysv/linux/x86_64/clone.S
time/tzset.c

index 5784ad4b8388068bb7d802770a6680a9f28ea377..f21175ea063943ac8a1d708f8f976c06df156e13 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,103 @@
+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
        _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
index ab9f806eff6e8366d54b3303dcb93fb07283147e..3368b51e51ba46d3e1224704e0a0179326af9b2f 100644 (file)
@@ -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; @:
index e442aa257f41f487877efe3570551fccc9d5f882..45c65af9047b6a29db95534bc042f4dee008da06 100644 (file)
@@ -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
index e1a6258d28e11f99d633c435113350a1f0522dc8..b747e0074b37de1553c6cb3d336f1ab8f9aaff07 100644 (file)
@@ -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
index 6ef69cca3200590be3d5105aaaf4490e5c79aaf0..9181ee2ca79882f356182da3805e2f1e1cf26567 100644 (file)
@@ -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
index 2d787d296f966d3ac199f79bd4bb7d8b05c987cb..19151cf188b7a4520fe96af18eb4c4c9854277e1 100644 (file)
@@ -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;
 
index 4683ffe6c55834c9b31f73415200593a2d21ab5a..cfa9ed8088bb37fe393e49285dc0a15afdce4b67 100644 (file)
@@ -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);
 }
 
 
index 79e9be1874035e3aa5ab67bb86ba21b9e325259f..9e34a9768e05a0c9f6a240e1b4d43bfb7d4c47e1 100644 (file)
@@ -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,
        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,
index 92d8460e26b516391b8e06a094729da0e0517d59..019bd549139725cc17c9f8c1d44d64b691b7b0a5 100644 (file)
@@ -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
index 23687342d1e63dedc4198b9e7545871f25cc2029..2708c701eb206290960e1dcb00359b1a39de1d2b 100644 (file)
@@ -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
index 5ad78eda003dc74b0789f41755572e36ca7c9bee..85292b62d9acf853c9b15cf1d81267c9b3687bfa 100644 (file)
@@ -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),
index 54554ed83978e9a381a39c8af6530877673c5596..1cd8b6214247c5b3e0f1f4879793dc9c17a576bd 100644 (file)
@@ -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,
        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,
        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>.
index d677318d007eff753b72ec8c33e23460d3c39c7e..9eb61927e3bed0a6807b4751b4841cedc3ef10eb 100644 (file)
@@ -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 (file)
index 0000000..95c17f1
--- /dev/null
@@ -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 (file)
index 0000000..dfa6adb
--- /dev/null
@@ -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 (file)
index 0000000..9d63715
--- /dev/null
@@ -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"
index da929c25dfd790b8cffbdbcdb024079286aeeccc..185b02fd8ae962ef0a0f039066afa7a0e44504da 100644 (file)
@@ -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;
index 675f816f60c2bc68e55d74f85f278d4db5de4f6c..5de5bf725ac66f00400d9d82d6e03b449618ff97 100644 (file)
@@ -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);
index 703d409eb85cecec3874aec185ad3dcd06173c8c..1345067a8920378c7f7811b3ea7728b6bb13e9b4 100644 (file)
@@ -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
index 5877adeb557352e00d564f423fa81a7bbef89401..22b806439be97b7608923eb23d665c80628626a7 100644 (file)
@@ -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)
index 29e7f847e4e7bc207842352cff6678256fb7bd03..407cc99897a63eca09fa10de02bb7e4b55ef4a5c 100644 (file)
@@ -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)
index bc5d14e5b77038ecba9652e13425637f35a17f68..5bec01181da1c33fba3c66321e57634ec044352d 100644 (file)
 #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 (file)
index 0000000..2683021
--- /dev/null
@@ -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
index 5dfe3346f55c8897b1186481e79fdaa898d261dc..761f8daeaabe75e002285c9f9e429c7200c291d6 100644 (file)
@@ -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\
index a83c41d26af5b030241b8f19dc8bfcb78c322fb4..86e16652e41b385d6069daa82a3bf2567afffa05 100644 (file)
@@ -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)
index cb3f105afe4a235204c122ede70ae8b468dcc164..8ca77a60cbea921a03b077a3af115a6abcf2af99 100644 (file)
 
 #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.  */
 #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
index 8a9dd43ce9f7d296def879f399fab20844e87a44..eb77b260d875bf5b3f7992c522754e46be50e808 100644 (file)
@@ -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"                                                            \
index 9e20dc6932698f5a6af48cae3b0ab2702c73430b..914e8a8bbe36d58ae8a239a6dc34f777ae8dea61 100644 (file)
@@ -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:
index b317b66a976c712a90c335038cd09903b7a16b25..bd00c92cfe5c7ab3ff860deab3dc5b4b030a0218 100644 (file)
@@ -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)
 
index 5fc80a872eb7ddd02b609b578530f60861e584e8..4810805d856b421bf951ea0173c4a0e4af150e3a 100644 (file)
@@ -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)
index d776b45aa2cbaed08f283d588883a0f43906f10e..5f36272f27e6a3f8547546c367f13728ac869f5b 100644 (file)
@@ -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
index 6b170fd702f0f2cf7cbcf4c059ec5cc1d5cab6c8..248bfe1c966b9e5d2737bd510480ef4e9e04ce37 100644 (file)
@@ -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)
     {
index 1c6f7861cfafa448b54dbc192ce49b5186ccd5d2..bf07fb39528812f0e02a0402e1f1243747200daf 100644 (file)
@@ -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]
index 7beba6841ce73362ae09229c52b00ae9c6f1eb9b..cf6f253378cc6fb882547df2fb4c6a3c2b18cde4 100644 (file)
@@ -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
 
index f8361b5cbf6831d537f84cc23830bc4d5ec5f2c6..b4b712c2f28c472eb246a6f856cbb535c7c781ed 100644 (file)
@@ -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
index 3e93ceb6d20949503518f06af6eaf27802644e5c..212a489afedbba5b3f09fd9a9af85df192cd3428 100644 (file)
@@ -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
 
index fda7c5b26706e977096bc27ca843c0b4e10c1435..668aa1a2f18f26a591908e4f24f3a6da8aac0509 100644 (file)
@@ -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
index bba1a548ba81405c00ff544189674ec28c0df812..9ef5114b244ec964df3c1e2fe5d391007d22f846 100644 (file)
@@ -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"
index 94c6a72548f64d1274c8f3f76021e9d184484533..acd43dfb0bca169c627cf45c990643ec4eb0a422 100644 (file)
@@ -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))
index d182fe2f9ea59e99fd3ee627d08896165ac85bc2..9695e1eaf877cae5705ff2df7ad36b1ff87a9c59 100644 (file)
@@ -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.  */
index 48a4e4b140482a3025e2840a8a896b74794f7cd1..0479abb38a4ffc7e9160193a9c32b675227264b2 100644 (file)
@@ -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;