]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Updated to fedora-glibc-20041126T1318 cvs/fedora-glibc-2_3_3-85
authorJakub Jelinek <jakub@redhat.com>
Fri, 26 Nov 2004 13:48:49 +0000 (13:48 +0000)
committerJakub Jelinek <jakub@redhat.com>
Fri, 26 Nov 2004 13:48:49 +0000 (13:48 +0000)
37 files changed:
ChangeLog
dlfcn/dlfcn.h
fedora/branch.mk
fedora/glibc.spec.in
linuxthreads/sysdeps/unix/sysv/linux/bits/posix_opt.h
linuxthreads/sysdeps/unix/sysv/linux/i386/bits/posix_opt.h
linuxthreads/sysdeps/unix/sysv/linux/ia64/bits/posix_opt.h
linuxthreads/sysdeps/unix/sysv/linux/x86_64/bits/posix_opt.h
nptl/ChangeLog
nptl/Makefile
nptl/Versions
nptl/allocatestack.c
nptl/pthread_setschedprio.c [new file with mode: 0644]
nptl/sysdeps/pthread/pthread.h
nptl/sysdeps/unix/sysv/linux/bits/posix_opt.h
nptl/sysdeps/unix/sysv/linux/i386/bits/posix_opt.h
nptl/sysdeps/unix/sysv/linux/ia64/bits/posix_opt.h
nptl/sysdeps/unix/sysv/linux/x86_64/bits/posix_opt.h
nptl/sysdeps/x86_64/Makefile
posix/Makefile
posix/PCRE.tests
posix/confstr.c
posix/getconf.c
posix/getconf.speclist.h [new file with mode: 0644]
posix/regcomp.c
posix/regex_internal.c
posix/regex_internal.h
stdlib/stdlib.h
sysdeps/generic/bits/environments.h
sysdeps/generic/unsecvars.h
sysdeps/posix/sysconf.c
sysdeps/unix/bsd/bsd4.4/freebsd/bits/environments.h [new file with mode: 0644]
sysdeps/unix/sysv/linux/i386/bits/environments.h [new file with mode: 0644]
sysdeps/unix/sysv/linux/powerpc/bits/environments.h [new file with mode: 0644]
sysdeps/unix/sysv/linux/s390/bits/environments.h [new file with mode: 0644]
sysdeps/unix/sysv/linux/sparc/bits/environments.h [new file with mode: 0644]
sysdeps/unix/sysv/linux/x86_64/bits/environments.h [new file with mode: 0644]

index 4240be3c811a2103acce80b11e1394762117ec5c..46387f69ffaa88b035143490dfeb9adafd6f6670 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,60 @@
+2004-11-26  Jakub Jelinek  <jakub@redhat.com>
+
+       * sysdeps/generic/unsecvars.h (UNSECURE_ENVVARS): Add GETCONF_DIR.
+
+       * posix/Makefile (generated: Add getconf.speclist.
+       ($(inst_libexecdir)/getconf): Use getconf.speclist instead of
+       getconf output.
+       ($(objpfx)getconf.speclist): New rule.
+       * posix/getconf.speclist.h: New file.
+
+2004-11-26  Jakub Jelinek  <jakub@redhat.com>
+
+       * posix/Makefile (install-others): Add $(inst_libexecdir)/getconf.
+       (CFLAGS-sysconf.c): Add -D_GETCONF_DIR.
+       (CFLAGS-getconf.c): New.
+       ($(inst_libexecdir)/getconf): New.
+       * posix/confstr.c (confstr): Use __sysconf to query specifications
+       that don't have _POSIX_V6_* macros defined.  Use __*_{C,LD}FLAGS
+       macros defined in bits/environments.h.
+       * sysdeps/posix/sysconf.c: Include stdlib.h, string.h and
+       sys/stat.h.
+       (__sysconf_check_spec): New routine.
+       (__sysconf): Use it.
+       * posix/getconf.c (specs): Change into structure array.
+       (main): If -v is not given, try to get default from
+       $(libexecdir)/getconf/default.  If specification is not
+       supported by this getconf, try to execute
+       $(libexecdir)/getconf/$(specification).
+       * sysdeps/unix/bsd/bsd4.4/freebsd/bits/environments.h: New file.
+       * sysdeps/unix/sysv/linux/s390/bits/environments.h: New file.
+       * sysdeps/unix/sysv/linux/powerpc/bits/environments.h: New file.
+       * sysdeps/unix/sysv/linux/sparc/bits/environments.h: New file.
+       * sysdeps/unix/sysv/linux/i386/bits/environments.h: New file.
+       * sysdeps/unix/sysv/linux/x86_64/bits/environments.h: New file.
+       * sysdeps/generic/bits/environments.h (__ILP32_OFFBIG_CFLAGS):
+       Define.
+
+       * stdlib/stdlib.h (setenv): Use nonnull only for second argument.
+       (unsetenv): Remove.
+
+2004-11-23  Paolo Bonzini  <bonzini@gnu.org>
+
+       * posix/regcomp.c (analyze_tree): Always call calc_epsdest.
+       (calc_inveclosure): Use re_node_set_insert_last.
+       (parse_dup_op): Lower X{1,5} to (X(X(X(XX?)?)?)?)?
+       rather than X?X?X?X?X?.
+       * posix/regex_internal.h (re_node_set_insert_last): New declaration.
+       * posix/regex_internal.c (re_node_set_insert_last): New function.
+       * posix/PCRE.tests: Add testcases.
+
+2004-11-25  Ulrich Drepper  <drepper@redhat.com>
+
+       * dlfcn/dlfcn.h: Remove nonnull attribute from dlopen.
+
+       * posix/confstr.c (confstr): Return appropriate strings for
+       _CS_LFS_LINTFLAGS, _CS_LFS64_CFLAGS, and _CS_LFS64_LINTFLAGS.
+
 2004-11-05  Maciej W. Rozycki  <macro@mips.com>
 
        * sysdeps/mips/dl-machine.h: Include <sgidefs.h>.  Use _ABIO32,
index c3943b32507cb456a80ac1fdcea400ed7c456f8c..42c25b8b633337317913bc86b66c62f6024544af 100644 (file)
@@ -54,7 +54,7 @@ __BEGIN_DECLS
 
 /* Open the shared object FILE and map it in; return a handle that can be
    passed to `dlsym' to get symbol values from it.  */
-extern void *dlopen (__const char *__file, int __mode) __THROW __nonnull ((1));
+extern void *dlopen (__const char *__file, int __mode) __THROW;
 
 /* Unmap and close a shared object opened by `dlopen'.
    The handle cannot be used again after calling `dlclose'.  */
index 689614472beb1206f84d3db04d0a59428cbd4f1b..f9802a91666f338c4abb7e7bc6fd9094f4a72fdb 100644 (file)
@@ -1,5 +1,5 @@
 # This file is updated automatically by Makefile.
 glibc-branch := fedora
 glibc-base := HEAD
-fedora-sync-date := 2004-11-24 07:41 UTC
-fedora-sync-tag := fedora-glibc-20041124T0741
+fedora-sync-date := 2004-11-26 13:18 UTC
+fedora-sync-tag := fedora-glibc-20041126T1318
index 8b496b3c5ea64aac5aad58ef726655c30b8967f6..d27fe6e4f27b74a346370fb78ac0e0307db289dd 100644 (file)
@@ -1,4 +1,4 @@
-%define glibcrelease 84
+%define glibcrelease 85
 %define auxarches i586 i686 athlon sparcv9 alphaev6
 %define prelinkarches noarch
 %define nptlarches i386 i686 athlon x86_64 ia64 s390 s390x sparcv9 ppc ppc64
@@ -98,7 +98,7 @@ Prereq: /sbin/install-info
 Obsoletes: libc-debug, libc-headers, libc-devel, linuxthreads-devel
 Obsoletes: glibc-debug
 Prereq: %{name}-headers
-Requires: %{name}-headers = %{version}, %{name} = %{version}
+Requires: %{name}-headers = %{version}-%{release}, %{name} = %{version}
 %ifarch %{ix86}
 # Earlier gcc's had atexit reference in crtendS.o, which does not
 # work with this glibc where atexit is in libc_nonshared.a
@@ -1205,6 +1205,9 @@ rm -f *.filelist*
 
 %files -f headers.filelist headers
 %defattr(-,root,root)
+%ifarch %{nptlarches}
+%{_prefix}/include/nptl
+%endif
 
 %files -f profile.filelist profile
 %defattr(-,root,root)
@@ -1231,7 +1234,6 @@ rm -f *.filelist*
 %ifarch %{nptlarches}
 %files -n nptl-devel
 %defattr(-,root,root)
-%{_prefix}/include/nptl
 %{_prefix}/%{_lib}/nptl
 %endif
 
@@ -1256,6 +1258,15 @@ rm -f *.filelist*
 %endif
 
 %changelog
+* Fri Nov 26 2004 Jakub Jelinek <jakub@redhat.com> 2.3.3-85
+- update from CVS
+  - support -v specification in getconf
+  - fix sysconf (_SC_LFS64_CFLAGS) etc.
+  - avoid thread stack aliasing issues on EM64T (#140803)
+- move %{_prefix}/include/nptl headers from nptl-devel
+  to glibc-headers, so that even NPTL specific programs
+  can be built bi-arch without problems
+
 * Wed Nov 24 2004 Jakub Jelinek <jakub@redhat.com> 2.3.3-84
 - update from CVS
   - fix memory leak in getaddrinfo if using nscd (#139559)
index 1a0f4e01428224b462eeea533f0fd1e6737606fa..6a7a8c3532902615f7aee02be3b7a7c1d64fa87a 100644 (file)
 /* The clock selection interfaces are not available.  */
 #define _POSIX_CLOCK_SELECTION -1
 
+/* Advisory information interfaces are available.  */
+#define _POSIX_ADVISORY_INFO   200112L
+
+/* Neither process nor thread sporadic server interfaces is available.  */
+#define _POSIX_SPORADIC_SERVER -1
+#define _POSIX_THREAD_SPORADIC_SERVER  -1
+
+/* trace.h is not available.  */
+#define _POSIX_TRACE   -1
+#define _POSIX_TRACE_EVENT_FILTER      -1
+#define _POSIX_TRACE_INHERIT   -1
+#define _POSIX_TRACE_LOG       -1
+
+/* Typed memory objects are not available.  */
+#define _POSIX_TYPED_MEMORY_OBJECTS    -1
+
 #endif /* posix_opt.h */
index 9c8e706d1271f841d6ca21ff2487cf333ce50030..98ea45644d9e15583beaa27e36dc8c538f74d145 100644 (file)
 /* The clock selection interfaces are not available.  */
 #define _POSIX_CLOCK_SELECTION -1
 
+/* Advisory information interfaces are available.  */
+#define _POSIX_ADVISORY_INFO   200112L
+
+/* Neither process nor thread sporadic server interfaces is available.  */
+#define _POSIX_SPORADIC_SERVER -1
+#define _POSIX_THREAD_SPORADIC_SERVER  -1
+
+/* trace.h is not available.  */
+#define _POSIX_TRACE   -1
+#define _POSIX_TRACE_EVENT_FILTER      -1
+#define _POSIX_TRACE_INHERIT   -1
+#define _POSIX_TRACE_LOG       -1
+
+/* Typed memory objects are not available.  */
+#define _POSIX_TYPED_MEMORY_OBJECTS    -1
+
 #endif /* posix_opt.h */
index 0b18959f3a303fff81f75a7fcf596b73799075df..4c32379e0e2ff5bfd643681f0c85ea2b9d2fc1eb 100644 (file)
 /* The clock selection interfaces are not available.  */
 #define _POSIX_CLOCK_SELECTION -1
 
+/* Advisory information interfaces are available.  */
+#define _POSIX_ADVISORY_INFO   200112L
+
+/* Neither process nor thread sporadic server interfaces is available.  */
+#define _POSIX_SPORADIC_SERVER -1
+#define _POSIX_THREAD_SPORADIC_SERVER  -1
+
+/* trace.h is not available.  */
+#define _POSIX_TRACE   -1
+#define _POSIX_TRACE_EVENT_FILTER      -1
+#define _POSIX_TRACE_INHERIT   -1
+#define _POSIX_TRACE_LOG       -1
+
+/* Typed memory objects are not available.  */
+#define _POSIX_TYPED_MEMORY_OBJECTS    -1
+
 #endif /* posix_opt.h */
index d4be569168f522df97c3c6a2e9a0c60462632d25..0e4b565608e572b65a0fbcb154db2b693f7a7c37 100644 (file)
 /* The clock selection interfaces are not available.  */
 #define _POSIX_CLOCK_SELECTION -1
 
+/* Advisory information interfaces are available.  */
+#define _POSIX_ADVISORY_INFO   200112L
+
+/* Neither process nor thread sporadic server interfaces is available.  */
+#define _POSIX_SPORADIC_SERVER -1
+#define _POSIX_THREAD_SPORADIC_SERVER  -1
+
+/* trace.h is not available.  */
+#define _POSIX_TRACE   -1
+#define _POSIX_TRACE_EVENT_FILTER      -1
+#define _POSIX_TRACE_INHERIT   -1
+#define _POSIX_TRACE_LOG       -1
+
+/* Typed memory objects are not available.  */
+#define _POSIX_TYPED_MEMORY_OBJECTS    -1
+
 #endif /* posix_opt.h */
index d95330d2b3118b5c43c99149d19c57428e7c3373..a0ece152970fef378a1dbdcc52fe5b06ec073ab9 100644 (file)
@@ -1,3 +1,12 @@
+2004-11-24  Ulrich Drepper  <drepper@redhat.com>
+
+       * sysdeps/x86_64/Makefile [nptl]: Define CFLAGS-pthread_create.c.
+
+       * Makefile (libpthread-routines): Add pthread_setschedprio.
+       * Versions [libpthread, GLIBC_2.3.4]: Add pthread_setschedprio.
+       * sysdeps/pthread/pthread.h: Declare pthread_setschedprio.
+       * pthread_setschedprio.c: New file.
+
 2004-11-20  Jakub Jelinek  <jakub@redhat.com>
 
        * pthread_create.c (pthread_cancel): Add PTHREAD_STATIC_FN_REQUIRE.
index 50156895bc5c7a5fe2848faca4d34866ef5aace2..7152144609f1526891bd95139c19ecb6041a0606 100644 (file)
@@ -36,6 +36,7 @@ libpthread-routines = init vars events version \
                      pthread_self pthread_equal pthread_yield \
                      pthread_getconcurrency pthread_setconcurrency \
                      pthread_getschedparam pthread_setschedparam \
+                     pthread_setschedprio \
                      pthread_attr_init pthread_attr_destroy \
                      pthread_attr_getdetachstate pthread_attr_setdetachstate \
                      pthread_attr_getguardsize pthread_attr_setguardsize \
index 7e8ac9e2719b68eab2c35440e216826d4555cae2..79bf190c3aa89bc155fe36f09827bfff40d6aba0 100644 (file)
@@ -228,6 +228,8 @@ libpthread {
     # New affinity interfaces.
     pthread_getaffinity_np; pthread_setaffinity_np;
     pthread_attr_getaffinity_np; pthread_attr_setaffinity_np;
+
+    pthread_setschedprio;
   }
 
   GLIBC_PRIVATE {
index 89a034e0ecb07a7462a1243451d1181a62a409fe..8875209a11ee576f2456a2793d587eaa67b98166 100644 (file)
@@ -417,7 +417,7 @@ allocate_stack (const struct pthread_attr *attr, struct pthread **pdp,
       pd = get_cached_stack (&size, &mem);
       if (pd == NULL)
        {
-         /* To avoid aliasing effects on a larger scale then pages we
+         /* To avoid aliasing effects on a larger scale than pages we
             adjust the allocated stack size if necessary.  This way
             allocations directly following each other will not have
             aliasing problems.  */
diff --git a/nptl/pthread_setschedprio.c b/nptl/pthread_setschedprio.c
new file mode 100644 (file)
index 0000000..063f523
--- /dev/null
@@ -0,0 +1,66 @@
+/* Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <sched.h>
+#include <string.h>
+#include <sched.h>
+#include "pthreadP.h"
+#include <lowlevellock.h>
+
+
+int
+pthread_setschedprio (threadid, prio)
+     pthread_t threadid;
+     int prio;
+{
+  struct pthread *pd = (struct pthread *) threadid;
+
+  /* Make sure the descriptor is valid.  */
+  if (INVALID_TD_P (pd))
+    /* Not a valid thread handle.  */
+    return ESRCH;
+
+  int result = 0;
+  struct sched_param param;
+  param.sched_priority = prio;
+
+  /* We have to handle cancellation in the following code since we are
+     locking another threads desriptor.  */
+  pthread_cleanup_push ((void (*) (void *)) lll_unlock_wake_cb, &pd->lock);
+
+  lll_lock (pd->lock);
+
+  /* Try to set the scheduler information.  */
+  if (__builtin_expect (sched_setparam (pd->tid, &param) == -1, 0))
+    result = errno;
+  else
+    {
+      /* We succeeded changing the kernel information.  Reflect this
+        change in the thread descriptor.  */
+      memcpy (&pd->schedparam, &param, sizeof (struct sched_param));
+      pd->flags |= ATTR_FLAG_SCHED_SET;
+    }
+
+  lll_unlock (pd->lock);
+
+  pthread_cleanup_pop (0);
+
+  return result;
+}
index 27666483d9cbccdc504d9154154ec3521e24c7b3..5046a6976baf92b82fff9c49267579a5616aac99 100644 (file)
@@ -373,6 +373,10 @@ extern int pthread_getschedparam (pthread_t __target_thread,
                                  struct sched_param *__restrict __param)
      __THROW;
 
+/* Set the scheduling priority for TARGET_THREAD.  */
+extern int pthread_setschedprio (pthread_t __target_thread, int __prio)
+     __THROW;
+
 
 #ifdef __USE_UNIX98
 /* Determine level of concurrency.  */
index b0a117a200da232c5ef96f67bc10f48693d7639a..5d84a25486446cb7cb8eb759d8dbdededea327cb 100644 (file)
 /* The clock selection interfaces are available.  */
 #define _POSIX_CLOCK_SELECTION 200112L
 
+/* Advisory information interfaces are available.  */
+#define _POSIX_ADVISORY_INFO   200112L
+
+/* Neither process nor thread sporadic server interfaces is available.  */
+#define _POSIX_SPORADIC_SERVER -1
+#define _POSIX_THREAD_SPORADIC_SERVER  -1
+
+/* trace.h is not available.  */
+#define _POSIX_TRACE   -1
+#define _POSIX_TRACE_EVENT_FILTER      -1
+#define _POSIX_TRACE_INHERIT   -1
+#define _POSIX_TRACE_LOG       -1
+
+/* Typed memory objects are not available.  */
+#define _POSIX_TYPED_MEMORY_OBJECTS    -1
+
 #endif /* posix_opt.h */
index 6c138f3ae51846d848501f982c9a7f162d4e7f76..e0f02b0544b07c58a658098ec5bf4d6d6ee6f5fe 100644 (file)
 /* The clock selection interfaces are available.  */
 #define _POSIX_CLOCK_SELECTION 200112L
 
+/* Advisory information interfaces are available.  */
+#define _POSIX_ADVISORY_INFO   200112L
+
+/* Neither process nor thread sporadic server interfaces is available.  */
+#define _POSIX_SPORADIC_SERVER -1
+#define _POSIX_THREAD_SPORADIC_SERVER  -1
+
+/* trace.h is not available.  */
+#define _POSIX_TRACE   -1
+#define _POSIX_TRACE_EVENT_FILTER      -1
+#define _POSIX_TRACE_INHERIT   -1
+#define _POSIX_TRACE_LOG       -1
+
+/* Typed memory objects are not available.  */
+#define _POSIX_TYPED_MEMORY_OBJECTS    -1
+
 #endif /* posix_opt.h */
index 2b5a3e6db8df46fef923e428c657d68d526dc9fc..07753c35359be8f0231350a812ddeae1872ee0be 100644 (file)
 /* The clock selection interfaces are available.  */
 #define _POSIX_CLOCK_SELECTION 200112L
 
+/* Advisory information interfaces are available.  */
+#define _POSIX_ADVISORY_INFO   200112L
+
+/* Neither process nor thread sporadic server interfaces is available.  */
+#define _POSIX_SPORADIC_SERVER -1
+#define _POSIX_THREAD_SPORADIC_SERVER  -1
+
+/* trace.h is not available.  */
+#define _POSIX_TRACE   -1
+#define _POSIX_TRACE_EVENT_FILTER      -1
+#define _POSIX_TRACE_INHERIT   -1
+#define _POSIX_TRACE_LOG       -1
+
+/* Typed memory objects are not available.  */
+#define _POSIX_TYPED_MEMORY_OBJECTS    -1
+
 #endif /* posix_opt.h */
index 2b5a3e6db8df46fef923e428c657d68d526dc9fc..07753c35359be8f0231350a812ddeae1872ee0be 100644 (file)
 /* The clock selection interfaces are available.  */
 #define _POSIX_CLOCK_SELECTION 200112L
 
+/* Advisory information interfaces are available.  */
+#define _POSIX_ADVISORY_INFO   200112L
+
+/* Neither process nor thread sporadic server interfaces is available.  */
+#define _POSIX_SPORADIC_SERVER -1
+#define _POSIX_THREAD_SPORADIC_SERVER  -1
+
+/* trace.h is not available.  */
+#define _POSIX_TRACE   -1
+#define _POSIX_TRACE_EVENT_FILTER      -1
+#define _POSIX_TRACE_INHERIT   -1
+#define _POSIX_TRACE_LOG       -1
+
+/* Typed memory objects are not available.  */
+#define _POSIX_TYPED_MEMORY_OBJECTS    -1
+
 #endif /* posix_opt.h */
index 24990a2b7ebd17409f56081e1f64596ec93bd384..6e24a26cde1cf66c3ec2233abfad33488f7c0d39 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+# Copyright (C) 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
 ifeq ($(subdir),csu)
 gen-as-const-headers += tcb-offsets.sym
 endif
+
+ifeq ($(subdir),nptl)
+# P4s have problems with 4M aliasing.  We disturb the allocation of stacks
+# just enough so the subsequent allocations do not use stack address
+# (mod 4M) == 0.
+CFLAGS-pthread_create.c += -DMULTI_PAGE_ALIASING=65536
+endif
index c89cfc0b41634e1e4db508795960148cc2739660..5a3534a6ad280e2df5b9ca72139cf1899f5a9ea2 100644 (file)
@@ -91,6 +91,7 @@ tests           += wordexp-test tst-exec tst-spawn
 endif
 others         := getconf
 install-bin    := getconf
+install-others := $(inst_libexecdir)/getconf
 
 before-compile := testcases.h ptestcases.h
 
@@ -101,7 +102,8 @@ generated := $(addprefix wordexp-test-result, 1 2 3 4 5 6 7 8 9 10) \
             bug-regex21-mem bug-regex21.mtrace \
             tst-rxspencer-mem tst-rxspencer.mtrace tst-getconf.out \
             tst-pcre-mem tst-pcre.mtrace tst-boost-mem tst-boost.mtrace \
-            bug-ga2.mtrace bug-ga2-mem bug-glob2.mtrace bug-glob2-mem
+            bug-ga2.mtrace bug-ga2-mem bug-glob2.mtrace bug-glob2-mem \
+            getconf.speclist
 
 include ../Rules
 
@@ -138,7 +140,7 @@ CFLAGS-waitid.c = -fexceptions
 CFLAGS-waitpid.c = -fexceptions -fasynchronous-unwind-tables
 CFLAGS-getopt.c = -fexceptions
 CFLAGS-wordexp.c = -fexceptions
-CFLAGS-sysconf.c = -fexceptions
+CFLAGS-sysconf.c = -fexceptions -DGETCONF_DIR='"$(libexecdir)/getconf"'
 CFLAGS-pathconf.c = -fexceptions
 CFLAGS-fpathconf.c = -fexceptions
 CFLAGS-spawn.c = -fexceptions
@@ -147,6 +149,7 @@ CFLAGS-spawni.c = -fexceptions
 CFLAGS-pause.c = -fexceptions
 CFLAGS-glob.c = $(uses-callbacks) -fexceptions
 CFLAGS-glob64.c = $(uses-callbacks) -fexceptions
+CFLAGS-getconf.c = -DGETCONF_DIR='"$(libexecdir)/getconf"'
 
 tstgetopt-ARGS = -a -b -cfoobar --required foobar --optional=bazbug \
                --none random --col --color --colour
@@ -260,3 +263,17 @@ bug-glob2-ENV = MALLOC_TRACE=$(objpfx)bug-glob2.mtrace
 
 $(objpfx)bug-glob2-mem: $(objpfx)bug-glob2.out
        $(common-objpfx)malloc/mtrace $(objpfx)bug-glob2.mtrace > $@
+
+$(inst_libexecdir)/getconf: $(objpfx)getconf $(objpfx)getconf.speclist FORCE
+       $(addprefix $(..)./scripts/mkinstalldirs ,\
+                   $(filter-out $(wildcard $@),$@))
+       for spec in `cat $(objpfx)getconf.speclist`; do \
+         $(INSTALL_PROGRAM) $< $@/$$spec.new; \
+         mv -f $@/$$spec.new $@/$$spec; \
+       done
+
+$(objpfx)getconf.speclist: getconf.speclist.h
+       $(CC) -E $(CFLAGS) $(CPPFLAGS) $< \
+         | sed -n -e '/START_OF_STRINGS/,$${/_POSIX_V6_/{s/^[^"]*"//;s/".*$$//;p}}' \
+         > $@.new
+       mv -f $@.new $@
index 7ea5b9e70c2818dee14a80065a4b660f3a160bac..0fb9cadafc91ddf39a42d048956ec9263634f579 100644 (file)
@@ -2365,3 +2365,22 @@ No match
  0: bc123bc
  1: bc
  2: bc
+
+/^a{2,5}$/
+    aa
+ 0: aa
+    aaa
+ 0: aaa
+    aaaa
+ 0: aaaa
+    aaaaa
+ 0: aaaaa
+    *** Failers
+No match
+    a
+No match
+    b
+No match
+    aaaaab
+No match
+    aaaaaa
index 212ec72311b6f5719e599eb4efb6978caa92241a..6b0dcf0c200524a4aa65683b42a3c8cda2dc09fa 100644 (file)
@@ -1,4 +1,5 @@
-/* Copyright (C) 1991,96,97,2000-2002, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1996, 1997, 2000-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
@@ -32,8 +33,8 @@ confstr (name, buf, len)
      char *buf;
      size_t len;
 {
-  const char *string;
-  size_t string_len;
+  const char *string = "";
+  size_t string_len = 1;
 
   switch (name)
     {
@@ -54,66 +55,175 @@ confstr (name, buf, len)
 
         Currently this means all environment which the system allows.  */
       {
-       static const char restenvs[] =
-#if _POSIX_V6_ILP32_OFF32 > 0
-       "_POSIX_V6_ILP32_OFF32"
+       char restenvs[4 * sizeof "_POSIX_V6_LPBIG_OFFBIG"];
+
+       string_len = 0;
+#ifndef _POSIX_V6_ILP32_OFF32
+        if (__sysconf (_SC_V6_ILP32_OFF32) > 0)
 #endif
-#if _POSIX_V6_ILP32_OFFBIG > 0
-# if _POSIX_V6_ILP32_OFF32 > 0
-       "\n"
-# endif
-       "_POSIX_V6_ILP32_OFFBIG"
+#if !defined _POSIX_V6_ILP32_OFF32 || _POSIX_V6_ILP32_OFF32 > 0
+          {
+            memcpy (restenvs + string_len, "_POSIX_V6_ILP32_OFF32",
+                    sizeof "_POSIX_V6_ILP32_OFF32" - 1);
+            string_len += sizeof "_POSIX_V6_ILP32_OFF32" - 1;
+          }
 #endif
-#if _POSIX_V6_LP64_OFF64 > 0
-# if _POSIX_V6_ILP32_OFF32 > 0 || _POSIX_V6_ILP32_OFFBIG > 0
-       "\n"
-# endif
-       "_POSIX_V6_LP64_OFF64"
+#ifndef _POSIX_V6_ILP32_OFFBIG
+        if (__sysconf (_SC_V6_ILP32_OFFBIG) > 0)
 #endif
-#if _POSIX_V6_LPBIG_OFFBIG > 0
-# if _POSIX_V6_ILP32_OFF32 > 0 || _POSIX_V6_ILP32_OFFBIG > 0 \
-     || _POSIX_V6_LP64_OFF64 > 0
-       "\n"
-# endif
-       "_POSIX_V6_LPBIG_OFFBIG"
+#if !defined _POSIX_V6_ILP32_OFFBIG || _POSIX_V6_ILP32_OFFBIG > 0
+          {
+            if (string_len)
+              restenvs[string_len++] = '\n';
+            memcpy (restenvs + string_len, "_POSIX_V6_ILP32_OFFBIG",
+                    sizeof "_POSIX_V6_ILP32_OFFBIG" - 1);
+            string_len += sizeof "_POSIX_V6_ILP32_OFFBIG" - 1;
+          }
+#endif
+#ifndef _POSIX_V6_LP64_OFF64
+        if (__sysconf (_SC_V6_LP64_OFF64) > 0)
+#endif
+#if !defined _POSIX_V6_LP64_OFF64 || _POSIX_V6_LP64_OFF64 > 0
+          {
+            if (string_len)
+              restenvs[string_len++] = '\n';
+            memcpy (restenvs + string_len, "_POSIX_V6_LP64_OFF64",
+                    sizeof "_POSIX_V6_LP64_OFF64" - 1);
+            string_len += sizeof "_POSIX_V6_LP64_OFF64" - 1;
+          }
+#endif
+#ifndef _POSIX_V6_LPBIG_OFFBIG
+        if (__sysconf (_SC_V6_LPBIG_OFFBIG) > 0)
+#endif
+#if !defined _POSIX_V6_LPBIG_OFFBIG || _POSIX_V6_LPBIG_OFFBIG > 0
+          {
+            if (string_len)
+              restenvs[string_len++] = '\n';
+            memcpy (restenvs + string_len, "_POSIX_V6_LPBIG_OFFBIG",
+                    sizeof "_POSIX_V6_LPBIG_OFFBIG" - 1);
+            string_len += sizeof "_POSIX_V6_LPBIG_OFFBIG" - 1;
+          }
 #endif
-         ;
+        restenvs[string_len++] = '\0';
        string = restenvs;
-       string_len = sizeof (restenvs);
       }
       break;
 
+    case _CS_XBS5_ILP32_OFF32_CFLAGS:
+    case _CS_POSIX_V6_ILP32_OFF32_CFLAGS:
+#ifdef __ILP32_OFF32_CFLAGS
+# if _POSIX_V6_ILP32_OFF32 == -1
+#  error __ILP32_OFF32_CFLAGS shouldn't be defined
+# elif !defined _POSIX_V6_ILP32_OFF32
+      if (__sysconf (_SC_V6_ILP32_OFF32) < 0)
+        break;
+# endif
+      string = __ILP32_OFF32_CFLAGS;
+      string_len = sizeof (__ILP32_OFF32_CFLAGS);
+#endif
+      break;
+
     case _CS_XBS5_ILP32_OFFBIG_CFLAGS:
     case _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS:
-    case _CS_LFS_CFLAGS:
-#if _XBS5_LP64_OFF64 == -1 && _XBS5_LPBIG_OFFBIG == -1 && _XBS5_ILP32_OFFBIG == 1
-      /* Signal that we want the new ABI.  */
-      {
-       static const char file_offset[] = "-D_FILE_OFFSET_BITS=64";
-       string = file_offset;
-       string_len = sizeof (file_offset);
-      }
+#ifdef __ILP32_OFFBIG_CFLAGS
+# if _POSIX_V6_ILP32_OFFBIG == -1
+#  error __ILP32_OFFBIG_CFLAGS shouldn't be defined
+# elif !defined _POSIX_V6_ILP32_OFFBIG
+      if (__sysconf (_SC_V6_ILP32_OFFBIG) < 0)
+        break;
+# endif
+      string = __ILP32_OFFBIG_CFLAGS;
+      string_len = sizeof (__ILP32_OFFBIG_CFLAGS);
+#endif
+      break;
+
+    case _CS_XBS5_LP64_OFF64_CFLAGS:
+    case _CS_POSIX_V6_LP64_OFF64_CFLAGS:
+#ifdef __LP64_OFF64_CFLAGS
+# if _POSIX_V6_LP64_OFF64 == -1
+#  error __LP64_OFF64_CFLAGS shouldn't be defined
+# elif !defined _POSIX_V6_LP64_OFF64
+      if (__sysconf (_SC_V6_LP64_OFF64) < 0)
+        break;
+# endif
+      string = __LP64_OFF64_CFLAGS;
+      string_len = sizeof (__LP64_OFF64_CFLAGS);
+#endif
       break;
+
+    case _CS_XBS5_ILP32_OFF32_LDFLAGS:
+    case _CS_POSIX_V6_ILP32_OFF32_LDFLAGS:
+#ifdef __ILP32_OFF32_LDFLAGS
+# if _POSIX_V6_ILP32_OFF32 == -1
+#  error __ILP32_OFF32_LDFLAGS shouldn't be defined
+# elif !defined _POSIX_V6_ILP32_OFF32
+      if (__sysconf (_SC_V6_ILP32_OFF32) < 0)
+        break;
+# endif
+      string = __ILP32_OFF32_LDFLAGS;
+      string_len = sizeof (__ILP32_OFF32_LDFLAGS);
 #endif
-      /* FALLTHROUGH */
+      break;
 
+    case _CS_XBS5_ILP32_OFFBIG_LDFLAGS:
+    case _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS:
+#ifdef __ILP32_OFFBIG_LDFLAGS
+# if _POSIX_V6_ILP32_OFFBIG == -1
+#  error __ILP32_OFFBIG_LDFLAGS shouldn't be defined
+# elif !defined _POSIX_V6_ILP32_OFFBIG
+      if (__sysconf (_SC_V6_ILP32_OFFBIG) < 0)
+        break;
+# endif
+      string = __ILP32_OFFBIG_LDFLAGS;
+      string_len = sizeof (__ILP32_OFFBIG_LDFLAGS);
+#endif
+      break;
+
+    case _CS_XBS5_LP64_OFF64_LDFLAGS:
+    case _CS_POSIX_V6_LP64_OFF64_LDFLAGS:
+#ifdef __LP64_OFF64_LDFLAGS
+# if _POSIX_V6_LP64_OFF64 == -1
+#  error __LP64_OFF64_LDFLAGS shouldn't be defined
+# elif !defined _POSIX_V6_LP64_OFF64
+      if (__sysconf (_SC_V6_LP64_OFF64) < 0)
+        break;
+# endif
+      string = __LP64_OFF64_LDFLAGS;
+      string_len = sizeof (__LP64_OFF64_LDFLAGS);
+#endif
+      break;
+
+    case _CS_LFS_CFLAGS:
     case _CS_LFS_LINTFLAGS:
+#if _POSIX_V6_ILP32_OFF32 == 1 && _POSIX_V6_ILP32_OFFBIG == 1
+# define __LFS_CFLAGS "-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
+      /* Signal that we want the new ABI.  */
+      string = __LFS_CFLAGS;
+      string_len = sizeof (__LFS_CFLAGS);
+#endif
+      break;
+
     case _CS_LFS_LDFLAGS:
     case _CS_LFS_LIBS:
+      /* No special libraries or linker flags needed.  */
+      break;
+
     case _CS_LFS64_CFLAGS:
     case _CS_LFS64_LINTFLAGS:
+#define __LFS64_CFLAGS "-D_LARGEFILE64_SOURCE"
+      string = __LFS64_CFLAGS;
+      string_len = sizeof (__LFS64_CFLAGS);
+      break;
+
     case _CS_LFS64_LDFLAGS:
     case _CS_LFS64_LIBS:
+      /* No special libraries or linker flags needed.  */
+      break;
 
-    case _CS_XBS5_ILP32_OFF32_CFLAGS:
-    case _CS_XBS5_ILP32_OFF32_LDFLAGS:
     case _CS_XBS5_ILP32_OFF32_LIBS:
     case _CS_XBS5_ILP32_OFF32_LINTFLAGS:
-    case _CS_XBS5_ILP32_OFFBIG_LDFLAGS:
     case _CS_XBS5_ILP32_OFFBIG_LIBS:
     case _CS_XBS5_ILP32_OFFBIG_LINTFLAGS:
-    case _CS_XBS5_LP64_OFF64_CFLAGS:
-    case _CS_XBS5_LP64_OFF64_LDFLAGS:
     case _CS_XBS5_LP64_OFF64_LIBS:
     case _CS_XBS5_LP64_OFF64_LINTFLAGS:
     case _CS_XBS5_LPBIG_OFFBIG_CFLAGS:
@@ -121,15 +231,10 @@ confstr (name, buf, len)
     case _CS_XBS5_LPBIG_OFFBIG_LIBS:
     case _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS:
 
-    case _CS_POSIX_V6_ILP32_OFF32_CFLAGS:
-    case _CS_POSIX_V6_ILP32_OFF32_LDFLAGS:
     case _CS_POSIX_V6_ILP32_OFF32_LIBS:
     case _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS:
-    case _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS:
     case _CS_POSIX_V6_ILP32_OFFBIG_LIBS:
     case _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS:
-    case _CS_POSIX_V6_LP64_OFF64_CFLAGS:
-    case _CS_POSIX_V6_LP64_OFF64_LDFLAGS:
     case _CS_POSIX_V6_LP64_OFF64_LIBS:
     case _CS_POSIX_V6_LP64_OFF64_LINTFLAGS:
     case _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS:
@@ -137,8 +242,6 @@ confstr (name, buf, len)
     case _CS_POSIX_V6_LPBIG_OFFBIG_LIBS:
     case _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS:
       /* GNU libc does not require special actions to use LFS functions.  */
-      string = "";
-      string_len = 1;
       break;
 
     case _CS_GNU_LIBC_VERSION:
index 2f68003ff3ab15c84d9fac0b46010c7e23141c52..6175dfec26c40e738aa218e94807ea77e4bef7e5 100644 (file)
@@ -917,12 +917,12 @@ static const struct conf vars[] =
   };
 
 
-static const char *specs[] =
+static struct { const char *name; int num; } specs[] =
   {
-    "POSIX_V6_ILP32_OFF32",
-    "POSIX_V6_ILP32_OFFBIG",
-    "POSIX_V6_LP64_OFF64",
-    "POSIX_V6_LPBIG_OFFBIG"
+    { "POSIX_V6_ILP32_OFF32", _SC_V6_ILP32_OFF32 },
+    { "POSIX_V6_ILP32_OFFBIG", _SC_V6_ILP32_OFFBIG },
+    { "POSIX_V6_LP64_OFF64", _SC_V6_LP64_OFF64 },
+    { "POSIX_V6_LPBIG_OFFBIG", _SC_V6_LPBIG_OFFBIG }
   };
 static const int nspecs = sizeof (specs) / sizeof (specs[0]);
 
@@ -963,11 +963,14 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\
       return 0;
     }
 
+  const char *getconf_dir = getenv ("GETCONF_DIR") ?: GETCONF_DIR;
+  size_t getconf_dirlen = strlen (getconf_dir);
+
+  const char *spec = NULL;
+  char buf[sizeof "POSIX_V6_LPBIG_OFFBIG"];
+  char *argv0 = argv[0];
   if (argc > 1 && strncmp (argv[1], "-v", 2) == 0)
     {
-      const char *spec;
-      int i;
-
       if (argv[1][2] == '\0')
        {
          if (argc < 3)
@@ -983,18 +986,62 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\
          argv += 1;
          argc += 1;
        }
+    }
+  else
+    {
+      char default_name[getconf_dirlen + sizeof "/default"];
+      memcpy (mempcpy (default_name, getconf_dir, getconf_dirlen),
+              "/default", sizeof "/default");
+      int len = readlink (default_name, buf, sizeof buf - 1);
+      if (len > 0)
+       {
+         buf[len] = '\0';
+         spec = buf;
+       }
+    }
 
-      /* Check for the specifications we know.  This is simple in the
-        moment.  */
+  /* Check for the specifications we know.  */
+  if (spec != NULL)
+    {
+      int i;
       for (i = 0; i < nspecs; ++i)
-       if (strcmp (spec, specs[i]) == 0)
+       if (strcmp (spec, specs[i].name) == 0)
          break;
 
       if (i == nspecs)
        error (2, 0, _("unknown specification \"%s\""), spec);
 
-      /* And now we forget the specification.  We don't do anything different
-        with or without it.  */
+      switch (specs[i].num)
+       {
+#ifndef _POSIX_V6_ILP32_OFF32
+         case _SC_V6_ILP32_OFF32:
+#endif
+#ifndef _POSIX_V6_ILP32_OFFBIG
+         case _SC_V6_ILP32_OFFBIG:
+#endif
+#ifndef _POSIX_V6_LP64_OFF64
+         case _SC_V6_LP64_OFF64:
+#endif
+#ifndef _POSIX_V6_LPBIG_OFFBIG
+         case _SC_V6_LPBIG_OFFBIG:
+#endif
+           {
+             const char *args[argc + 3];
+             size_t spec_len = strlen (spec);
+             char getconf_name[getconf_dirlen + 2 + spec_len + 1];
+             memcpy (mempcpy (mempcpy (getconf_name, getconf_dir,
+                                       getconf_dirlen),
+                               "/_", 2), spec, spec_len + 1);
+             args[0] = argv0;
+             args[1] = "-v";
+             args[2] = spec;
+             memcpy (&args[3], &argv[1], argc * sizeof (argv[1]));
+             execv (getconf_name, (char * const *) args);
+             error (4, errno, _("Couldn't execute %s"), getconf_name);
+           }
+         default:
+           break;
+       }
     }
 
   if (argc < 2 || argc > 3)
diff --git a/posix/getconf.speclist.h b/posix/getconf.speclist.h
new file mode 100644 (file)
index 0000000..943c0de
--- /dev/null
@@ -0,0 +1,15 @@
+#include <unistd.h>
+const char *START_OF_STRINGS =
+#if _POSIX_V6_ILP32_OFF32 == 1
+"_POSIX_V6_ILP32_OFF32"
+#endif
+#if _POSIX_V6_ILP32_OFFBIG == 1
+"_POSIX_V6_ILP32_OFFBIG"
+#endif
+#if _POSIX_V6_LP64_OFF64 == 1
+"_POSIX_V6_LP64_OFF64"
+#endif
+#if _POSIX_V6_LPBIG_OFFBIG == 1
+"_POSIX_V6_LPBIG_OFFBIG"
+#endif
+"";
index dafad9bd0c9791bb4080e69053d693ad87f45a86..675f816f60c2bc68e55d74f85f278d4db5de4f6c 100644 (file)
@@ -1269,8 +1269,8 @@ analyze_tree (dfa, node)
     calc_first (dfa, node);
   if (node->next == -1)
     calc_next (dfa, node);
-  if (node->eclosure.nelem == 0)
-    calc_epsdest (dfa, node);
+  calc_epsdest (dfa, node);
+
   /* Calculate "first" etc. for the left child.  */
   if (node->left != NULL)
     {
@@ -1626,7 +1626,7 @@ calc_inveclosure (dfa)
       for (idx = 0; idx < dfa->eclosures[src].nelem; ++idx)
        {
          dest = dfa->eclosures[src].elems[idx];
-         re_node_set_insert (dfa->inveclosures + dest, src);
+         re_node_set_insert_last (dfa->inveclosures + dest, src);
        }
     }
 }
@@ -2538,7 +2538,7 @@ parse_dup_op (elem, regexp, dfa, token, syntax, err)
      reg_errcode_t *err;
 {
   re_token_t dup_token;
-  bin_tree_t *tree = NULL;
+  bin_tree_t *tree = NULL, *old_tree = NULL;
   int i, start, end, start_idx = re_string_cur_idx (regexp);
   re_token_t start_token = *token;
 
@@ -2598,12 +2598,14 @@ parse_dup_op (elem, regexp, dfa, token, syntax, err)
       end = (token->type == OP_DUP_QUESTION) ? 1 : -1;
     }
 
+  fetch_token (token, regexp, syntax);
+
   /* Treat "<re>{0}*" etc. as "<re>{0}".  */
-  if (BE (elem == NULL, 0))
-    start = end = 0;
+  if (BE (elem == NULL || (start == 0 && end == 0), 0))
+    return NULL;
 
   /* Extract "<re>{n,m}" to "<re><re>...<re><re>{0,<m-n>}".  */
-  else if (BE (start > 0, 0))
+  if (BE (start > 0, 0))
     {
       tree = elem;
       for (i = 2; i <= start; ++i)
@@ -2613,52 +2615,41 @@ parse_dup_op (elem, regexp, dfa, token, syntax, err)
          if (BE (elem == NULL || tree == NULL, 0))
            goto parse_dup_op_espace;
        }
-    }
 
-  if (BE (end != start, 1))
-    {
-      dup_token.type = (end == -1 ? OP_DUP_ASTERISK : OP_DUP_QUESTION);
-      if (BE (start > 0, 0))
-       {
-          elem = duplicate_tree (elem, dfa);
-          if (BE (elem == NULL, 0))
-           goto parse_dup_op_espace;
+      if (start == end)
+       return tree;
 
-          /* This subexpression will be marked as optional, so that
-             empty matches do not touch the registers.  */
-          mark_opt_subexp (elem, dfa);
+      /* Duplicate ELEM before it is marked optional.  */
+      elem = duplicate_tree (elem, dfa);
+      old_tree = tree;
+    }
+  else
+    old_tree = NULL;
 
-          /* Prepare the tree with the modifier.  */
-          elem = re_dfa_add_tree_node (dfa, elem, NULL, &dup_token);
-          tree = create_tree (dfa, tree, elem, CONCAT, 0);
-       }
-      else
-       {
-         /* We do not need to duplicate the tree because we have not
-            created it yet.  */
-          mark_opt_subexp (elem, dfa);
-          tree = elem = re_dfa_add_tree_node (dfa, elem, NULL, &dup_token);
-       }
+  mark_opt_subexp (elem, dfa);
+  dup_token.type = (end == -1 ? OP_DUP_ASTERISK : OP_DUP_QUESTION);
+  tree = re_dfa_add_tree_node (dfa, elem, NULL, &dup_token);
+  if (BE (tree == NULL, 0))
+    goto parse_dup_op_espace;
 
+  /* This loop is actually executed only when end != -1,
+     to rewrite <re>{0,n} as (<re>(<re>...<re>?)?)?...  We have
+     already created the start+1-th copy.  */
+  for (i = start + 2; i <= end; ++i)
+    {
+      elem = duplicate_tree (elem, dfa);
+      tree = create_tree (dfa, tree, elem, CONCAT, 0);
       if (BE (elem == NULL || tree == NULL, 0))
         goto parse_dup_op_espace;
 
-      /* This loop is actually executed only when end != -1,
-         to rewrite <re>{0,n} as <re>?<re>?<re>?...  We have
-         already created the start+1-th copy.  */
-      for (i = start + 2; i <= end; ++i)
-        {
-          elem = duplicate_tree (elem, dfa);
-          tree = create_tree (dfa, tree, elem, CONCAT, 0);
-          if (BE (elem == NULL || tree == NULL, 0))
-           {
-             *err = REG_ESPACE;
-             return NULL;
-           }
-        }
+      tree = re_dfa_add_tree_node (dfa, tree, NULL, &dup_token);
+      if (BE (tree == NULL, 0))
+        goto parse_dup_op_espace;
     }
 
-  fetch_token (token, regexp, syntax);
+  if (old_tree)
+    tree = create_tree (dfa, old_tree, tree, CONCAT, 0);
+
   return tree;
 
  parse_dup_op_espace:
index bb1d73d9a0157b363a38980ecab185c40b8a7265..cb439e5d7c3e75ae539b077399cab8d54c7f3338 100644 (file)
@@ -1250,6 +1250,31 @@ re_node_set_insert (set, elem)
   return 1;
 }
 
+/* Insert the new element ELEM to the re_node_set* SET.
+   SET should not already have any element greater than or equal to ELEM.
+   Return -1 if an error is occured, return 1 otherwise.  */
+
+static int
+re_node_set_insert_last (set, elem)
+     re_node_set *set;
+     int elem;
+{
+  /* Realloc if we need.  */
+  if (set->alloc == set->nelem)
+    {
+      int *new_array;
+      set->alloc = (set->alloc + 1) * 2;
+      new_array = re_realloc (set->elems, int, set->alloc);
+      if (BE (new_array == NULL, 0))
+       return -1;
+      set->elems = new_array;
+    }
+
+  /* Insert the new element.  */
+  set->elems[set->nelem++] = elem;
+  return 1;
+}
+
 /* Compare two node sets SET1 and SET2.
    return 1 if SET1 and SET2 are equivalent, return 0 otherwise.  */
 
index a778032d77994f1dd2e32ad7ff4021c4d769ebf8..703d409eb85cecec3874aec185ad3dcd06173c8c 100644 (file)
@@ -668,6 +668,8 @@ static reg_errcode_t re_node_set_init_union (re_node_set *dest,
 static reg_errcode_t re_node_set_merge (re_node_set *dest,
                                        const re_node_set *src) internal_function;
 static int re_node_set_insert (re_node_set *set, int elem) internal_function;
+static int re_node_set_insert_last (re_node_set *set,
+                                   int elem) internal_function;
 static int re_node_set_compare (const re_node_set *set1,
                                const re_node_set *set2) internal_function;
 static int re_node_set_contains (const re_node_set *set, int elem) internal_function;
index e4f79369a6d9578cfe1f66fd33d80c543a0c58dd..4ef32ac782f549d56ae49e89412f7e599880153f 100644 (file)
@@ -669,10 +669,10 @@ extern int putenv (char *__string) __THROW __nonnull ((1));
 /* Set NAME to VALUE in the environment.
    If REPLACE is nonzero, overwrite an existing value.  */
 extern int setenv (__const char *__name, __const char *__value, int __replace)
-     __THROW __nonnull ((1, 2));
+     __THROW __nonnull ((2));
 
 /* Remove the variable NAME from the environment.  */
-extern int unsetenv (__const char *__name) __THROW __nonnull ((1));
+extern int unsetenv (__const char *__name) __THROW;
 #endif
 
 #ifdef __USE_MISC
index c3829927bc2cd00527f5570be039460344b3c0c6..4617dc45f24fbdabad70d5dd33ef5c26fe9c9b45 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999, 2001 Free Software Foundation, Inc.
+/* Copyright (C) 1999, 2001, 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
@@ -72,4 +72,7 @@
 # define _XBS5_LP64_OFF64      -1
 # define _XBS5_LPBIG_OFFBIG    -1
 
+/* CFLAGS.  */
+#define __ILP32_OFFBIG_CFLAGS   "-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
+
 #endif /* __WORDSIZE == 32 */
index 88fba19b2312248b8de19da8a25342dab7a9d91f..8a9dd43ce9f7d296def879f399fab20844e87a44 100644 (file)
@@ -9,6 +9,7 @@
   "LD_PROFILE\0"                                                             \
   "LD_USE_LOAD_BIAS\0"                                                       \
   "GCONV_PATH\0"                                                             \
+  "GETCONF_DIR\0"                                                            \
   "HOSTALIASES\0"                                                            \
   "LOCALDOMAIN\0"                                                            \
   "LOCPATH\0"                                                                \
index d1286a06fe12ecb8635fc637eaf27163877fb034..de81c2120bd89d6c259b5f69058a3b6f41c955ee 100644 (file)
 #include <pwd.h>
 #include <stddef.h>
 #include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
 #include <time.h>
 #include <unistd.h>
 #include <sys/param.h>
+#include <sys/stat.h>
 #include <sys/sysinfo.h>
 #include <sys/types.h>
 #include <regex.h>
 
 
+static long int __sysconf_check_spec (const char *spec);
+
+
 /* Get the value of the system variable NAME.  */
 long int
 __sysconf (name)
@@ -781,50 +787,50 @@ __sysconf (name)
 #ifdef _XBS5_ILP32_OFF32
       return _XBS5_ILP32_OFF32;
 #else
-      return -1;
+      return __sysconf_check_spec ("ILP32_OFF32");
 #endif
     case _SC_XBS5_ILP32_OFFBIG:
 #ifdef _XBS5_ILP32_OFFBIG
       return _XBS5_ILP32_OFFBIG;
 #else
-      return -1;
+      return __sysconf_check_spec ("ILP32_OFFBIG");
 #endif
     case _SC_XBS5_LP64_OFF64:
 #ifdef _XBS5_LP64_OFF64
       return _XBS5_LP64_OFF64;
 #else
-      return -1;
+      return __sysconf_check_spec ("LP64_OFF64");
 #endif
     case _SC_XBS5_LPBIG_OFFBIG:
 #ifdef _XBS5_LPBIG_OFFBIG
       return _XBS5_LPBIG_OFFBIG;
 #else
-      return -1;
+      return __sysconf_check_spec ("LPBIG_OFFBIG");
 #endif
 
     case _SC_V6_ILP32_OFF32:
 #ifdef _POSIX_V6_ILP32_OFF32
       return _POSIX_V6_ILP32_OFF32;
 #else
-      return -1;
+      return __sysconf_check_spec ("ILP32_OFF32");
 #endif
     case _SC_V6_ILP32_OFFBIG:
 #ifdef _POSIX_V6_ILP32_OFFBIG
       return _POSIX_V6_ILP32_OFFBIG;
 #else
-      return -1;
+      return __sysconf_check_spec ("ILP32_OFFBIG");
 #endif
     case _SC_V6_LP64_OFF64:
 #ifdef _POSIX_V6_LP64_OFF64
       return _POSIX_V6_LP64_OFF64;
 #else
-      return -1;
+      return __sysconf_check_spec ("LP64_OFF64");
 #endif
     case _SC_V6_LPBIG_OFFBIG:
 #ifdef _POSIX_V6_LPBIG_OFFBIG
       return _POSIX_V6_LPBIG_OFFBIG;
 #else
-      return -1;
+      return __sysconf_check_spec ("LPBIG_OFFBIG");
 #endif
 
     case _SC_XOPEN_LEGACY:
@@ -1189,3 +1195,24 @@ __sysconf (name)
 #undef __sysconf
 weak_alias (__sysconf, sysconf)
 libc_hidden_def (__sysconf)
+
+static long int
+__sysconf_check_spec (const char *spec)
+{
+  int save_errno = errno;
+
+  const char *getconf_dir = __secure_getenv ("GETCONF_DIR") ?: GETCONF_DIR;
+  size_t getconf_dirlen = strlen (getconf_dir);
+  size_t speclen = strlen (spec);
+
+  char name[getconf_dirlen + sizeof ("/_POSIX_V6_") + speclen];
+  memcpy (mempcpy (mempcpy (name, getconf_dir, getconf_dirlen),
+                  "/_POSIX_V6_", sizeof ("/_POSIX_V6_") - 1),
+         spec, speclen + 1);
+
+  struct stat64 st;
+  long int ret = __xstat64 (_STAT_VER, name, &st) >= 0 ? 1 : -1;
+
+  __set_errno (save_errno);
+  return ret;
+}
diff --git a/sysdeps/unix/bsd/bsd4.4/freebsd/bits/environments.h b/sysdeps/unix/bsd/bsd4.4/freebsd/bits/environments.h
new file mode 100644 (file)
index 0000000..92112b5
--- /dev/null
@@ -0,0 +1,72 @@
+/* Copyright (C) 1999, 2001, 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
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#ifndef _UNISTD_H
+# error "Never include this file directly.  Use <unistd.h> instead"
+#endif
+
+#include <bits/wordsize.h>
+
+/* This header should define the following symbols under the described
+   situations.  A value `1' means that the model is always supported,
+   `-1' means it is never supported.  Undefined means it cannot be
+   statically decided.
+
+   _POSIX_V6_ILP32_OFF32   32bit int, long, pointers, and off_t type
+   _POSIX_V6_ILP32_OFFBIG  32bit int, long, and pointers and larger off_t type
+
+   _POSIX_V6_LP64_OFF32           64bit long and pointers and 32bit off_t type
+   _POSIX_V6_LPBIG_OFFBIG  64bit long and pointers and large off_t type
+
+   The macros _XBS5_ILP32_OFF32, _XBS5_ILP32_OFFBIG, _XBS5_LP64_OFF32, and
+   _XBS5_LPBIG_OFFBIG were used in previous versions of the Unix standard
+   and are available only for compatibility.
+*/
+
+#if __WORDSIZE == 64
+
+/* We can never provide environments with 32-bit wide pointers.  */
+# define _POSIX_V6_ILP32_OFF32 -1
+# define _POSIX_V6_ILP32_OFFBIG        -1
+# define _XBS5_ILP32_OFF32     -1
+# define _XBS5_ILP32_OFFBIG    -1
+/* We also have no use (for now) for an environment with bigger pointers
+   and offsets.  */
+# define _POSIX_V6_LPBIG_OFFBIG        -1
+# define _XBS5_LPBIG_OFFBIG    -1
+
+/* By default we have 64-bit wide `long int', pointers and `off_t'.  */
+# define _POSIX_V6_LP64_OFF64  1
+# define _XBS5_LP64_OFF64      1
+
+#else /* __WORDSIZE == 32 */
+
+/* By default we have 32-bit wide `int', `long int', pointers
+   and 64-bit `off_t'.  */
+# define _POSIX_V6_ILP32_OFF32 -1
+# define _POSIX_V6_ILP32_OFFBIG        1
+# define _XBS5_ILP32_OFF32     -1
+# define _XBS5_ILP32_OFFBIG    1
+
+/* We can never provide environments with 64-bit wide pointers.  */
+# define _POSIX_V6_LP64_OFF64  -1
+# define _POSIX_V6_LPBIG_OFFBIG        -1
+# define _XBS5_LP64_OFF64      -1
+# define _XBS5_LPBIG_OFFBIG    -1
+
+#endif /* __WORDSIZE == 32 */
diff --git a/sysdeps/unix/sysv/linux/i386/bits/environments.h b/sysdeps/unix/sysv/linux/i386/bits/environments.h
new file mode 100644 (file)
index 0000000..16f7732
--- /dev/null
@@ -0,0 +1,62 @@
+/* Copyright (C) 1999, 2001, 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
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#ifndef _UNISTD_H
+# error "Never include this file directly.  Use <unistd.h> instead"
+#endif
+
+/* This header should define the following symbols under the described
+   situations.  A value `1' means that the model is always supported,
+   `-1' means it is never supported.  Undefined means it cannot be
+   statically decided.
+
+   _POSIX_V6_ILP32_OFF32   32bit int, long, pointers, and off_t type
+   _POSIX_V6_ILP32_OFFBIG  32bit int, long, and pointers and larger off_t type
+
+   _POSIX_V6_LP64_OFF32           64bit long and pointers and 32bit off_t type
+   _POSIX_V6_LPBIG_OFFBIG  64bit long and pointers and large off_t type
+
+   The macros _XBS5_ILP32_OFF32, _XBS5_ILP32_OFFBIG, _XBS5_LP64_OFF32, and
+   _XBS5_LPBIG_OFFBIG were used in previous versions of the Unix standard
+   and are available only for compatibility.
+*/
+
+/* By default we have 32-bit wide `int', `long int', pointers and `off_t'
+   and all platforms support LFS.  */
+#define _POSIX_V6_ILP32_OFF32  1
+#define _POSIX_V6_ILP32_OFFBIG 1
+#define _XBS5_ILP32_OFF32      1
+#define _XBS5_ILP32_OFFBIG     1
+
+/* We optionally provide an environment with the above size but an 64-bit
+   side `off_t'.  Therefore we don't define _XBS5_ILP32_OFFBIG.  */
+
+/* Environments with 64-bit wide pointers can be provided,
+   so these macros aren't defined:
+   # undef _POSIX_V6_LP64_OFF64
+   # undef _POSIX_V6_LPBIG_OFFBIG
+   # undef _XBS5_LP64_OFF64
+   # undef _XBS5_LPBIG_OFFBIG
+   and sysconf tests for it at runtime.  */
+
+#define __ILP32_OFF32_CFLAGS   "-m32"
+#define __ILP32_OFFBIG_CFLAGS  "-m32 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
+#define __ILP32_OFF32_LDFLAGS  "-m32"
+#define __ILP32_OFFBIG_LDFLAGS "-m32"
+#define __LP64_OFF64_CFLAGS    "-m64"
+#define __LP64_OFF64_LDFLAGS   "-m64"
diff --git a/sysdeps/unix/sysv/linux/powerpc/bits/environments.h b/sysdeps/unix/sysv/linux/powerpc/bits/environments.h
new file mode 100644 (file)
index 0000000..a51a564
--- /dev/null
@@ -0,0 +1,87 @@
+/* Copyright (C) 1999, 2001, 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
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#ifndef _UNISTD_H
+# error "Never include this file directly.  Use <unistd.h> instead"
+#endif
+
+#include <bits/wordsize.h>
+
+/* This header should define the following symbols under the described
+   situations.  A value `1' means that the model is always supported,
+   `-1' means it is never supported.  Undefined means it cannot be
+   statically decided.
+
+   _POSIX_V6_ILP32_OFF32   32bit int, long, pointers, and off_t type
+   _POSIX_V6_ILP32_OFFBIG  32bit int, long, and pointers and larger off_t type
+
+   _POSIX_V6_LP64_OFF32           64bit long and pointers and 32bit off_t type
+   _POSIX_V6_LPBIG_OFFBIG  64bit long and pointers and large off_t type
+
+   The macros _XBS5_ILP32_OFF32, _XBS5_ILP32_OFFBIG, _XBS5_LP64_OFF32, and
+   _XBS5_LPBIG_OFFBIG were used in previous versions of the Unix standard
+   and are available only for compatibility.
+*/
+
+#if __WORDSIZE == 64
+
+/* Environments with 32-bit wide pointers are optionally provided.
+   Therefore following macros aren't defined:
+   # undef _POSIX_V6_ILP32_OFF32
+   # undef _POSIX_V6_ILP32_OFFBIG
+   # undef _XBS5_ILP32_OFF32
+   # undef _XBS5_ILP32_OFFBIG
+   and users need to check at runtime.  */
+
+/* We also have no use (for now) for an environment with bigger pointers
+   and offsets.  */
+# define _POSIX_V6_LPBIG_OFFBIG        -1
+# define _XBS5_LPBIG_OFFBIG    -1
+
+/* By default we have 64-bit wide `long int', pointers and `off_t'.  */
+# define _POSIX_V6_LP64_OFF64  1
+# define _XBS5_LP64_OFF64      1
+
+#else /* __WORDSIZE == 32 */
+
+/* By default we have 32-bit wide `int', `long int', pointers and `off_t'
+   and all platforms support LFS.  */
+# define _POSIX_V6_ILP32_OFF32 1
+# define _POSIX_V6_ILP32_OFFBIG        1
+# define _XBS5_ILP32_OFF32     1
+# define _XBS5_ILP32_OFFBIG    1
+
+/* We optionally provide an environment with the above size but an 64-bit
+   side `off_t'.  Therefore we don't define _XBS5_ILP32_OFFBIG.  */
+
+/* Environments with 64-bit wide pointers can be provided,
+   so these macros aren't defined:
+   # undef _POSIX_V6_LP64_OFF64
+   # undef _POSIX_V6_LPBIG_OFFBIG
+   # undef _XBS5_LP64_OFF64
+   # undef _XBS5_LPBIG_OFFBIG
+   and sysconf tests for it at runtime.  */
+
+#endif /* __WORDSIZE == 32 */
+
+#define __ILP32_OFF32_CFLAGS   "-m32"
+#define __ILP32_OFFBIG_CFLAGS  "-m32 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
+#define __ILP32_OFF32_LDFLAGS  "-m32"
+#define __ILP32_OFFBIG_LDFLAGS "-m32"
+#define __LP64_OFF64_CFLAGS    "-m64"
+#define __LP64_OFF64_LDFLAGS   "-m64"
diff --git a/sysdeps/unix/sysv/linux/s390/bits/environments.h b/sysdeps/unix/sysv/linux/s390/bits/environments.h
new file mode 100644 (file)
index 0000000..713d21c
--- /dev/null
@@ -0,0 +1,87 @@
+/* Copyright (C) 1999, 2001, 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
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#ifndef _UNISTD_H
+# error "Never include this file directly.  Use <unistd.h> instead"
+#endif
+
+#include <bits/wordsize.h>
+
+/* This header should define the following symbols under the described
+   situations.  A value `1' means that the model is always supported,
+   `-1' means it is never supported.  Undefined means it cannot be
+   statically decided.
+
+   _POSIX_V6_ILP32_OFF32   32bit int, long, pointers, and off_t type
+   _POSIX_V6_ILP32_OFFBIG  32bit int, long, and pointers and larger off_t type
+
+   _POSIX_V6_LP64_OFF32           64bit long and pointers and 32bit off_t type
+   _POSIX_V6_LPBIG_OFFBIG  64bit long and pointers and large off_t type
+
+   The macros _XBS5_ILP32_OFF32, _XBS5_ILP32_OFFBIG, _XBS5_LP64_OFF32, and
+   _XBS5_LPBIG_OFFBIG were used in previous versions of the Unix standard
+   and are available only for compatibility.
+*/
+
+#if __WORDSIZE == 64
+
+/* Environments with 32-bit wide pointers are optionally provided.
+   Therefore following macros aren't defined:
+   # undef _POSIX_V6_ILP32_OFF32
+   # undef _POSIX_V6_ILP32_OFFBIG
+   # undef _XBS5_ILP32_OFF32
+   # undef _XBS5_ILP32_OFFBIG
+   and users need to check at runtime.  */
+
+/* We also have no use (for now) for an environment with bigger pointers
+   and offsets.  */
+# define _POSIX_V6_LPBIG_OFFBIG        -1
+# define _XBS5_LPBIG_OFFBIG    -1
+
+/* By default we have 64-bit wide `long int', pointers and `off_t'.  */
+# define _POSIX_V6_LP64_OFF64  1
+# define _XBS5_LP64_OFF64      1
+
+#else /* __WORDSIZE == 32 */
+
+/* By default we have 32-bit wide `int', `long int', pointers and `off_t'
+   and all platforms support LFS.  */
+# define _POSIX_V6_ILP32_OFF32 1
+# define _POSIX_V6_ILP32_OFFBIG        1
+# define _XBS5_ILP32_OFF32     1
+# define _XBS5_ILP32_OFFBIG    1
+
+/* We optionally provide an environment with the above size but an 64-bit
+   side `off_t'.  Therefore we don't define _XBS5_ILP32_OFFBIG.  */
+
+/* Environments with 64-bit wide pointers can be provided,
+   so these macros aren't defined:
+   # undef _POSIX_V6_LP64_OFF64
+   # undef _POSIX_V6_LPBIG_OFFBIG
+   # undef _XBS5_LP64_OFF64
+   # undef _XBS5_LPBIG_OFFBIG
+   and sysconf tests for it at runtime.  */
+
+#endif /* __WORDSIZE == 32 */
+
+#define __ILP32_OFF32_CFLAGS   "-m31"
+#define __ILP32_OFFBIG_CFLAGS  "-m31 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
+#define __ILP32_OFF32_LDFLAGS  "-m31"
+#define __ILP32_OFFBIG_LDFLAGS "-m31"
+#define __LP64_OFF64_CFLAGS    "-m64"
+#define __LP64_OFF64_LDFLAGS   "-m64"
diff --git a/sysdeps/unix/sysv/linux/sparc/bits/environments.h b/sysdeps/unix/sysv/linux/sparc/bits/environments.h
new file mode 100644 (file)
index 0000000..a51a564
--- /dev/null
@@ -0,0 +1,87 @@
+/* Copyright (C) 1999, 2001, 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
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#ifndef _UNISTD_H
+# error "Never include this file directly.  Use <unistd.h> instead"
+#endif
+
+#include <bits/wordsize.h>
+
+/* This header should define the following symbols under the described
+   situations.  A value `1' means that the model is always supported,
+   `-1' means it is never supported.  Undefined means it cannot be
+   statically decided.
+
+   _POSIX_V6_ILP32_OFF32   32bit int, long, pointers, and off_t type
+   _POSIX_V6_ILP32_OFFBIG  32bit int, long, and pointers and larger off_t type
+
+   _POSIX_V6_LP64_OFF32           64bit long and pointers and 32bit off_t type
+   _POSIX_V6_LPBIG_OFFBIG  64bit long and pointers and large off_t type
+
+   The macros _XBS5_ILP32_OFF32, _XBS5_ILP32_OFFBIG, _XBS5_LP64_OFF32, and
+   _XBS5_LPBIG_OFFBIG were used in previous versions of the Unix standard
+   and are available only for compatibility.
+*/
+
+#if __WORDSIZE == 64
+
+/* Environments with 32-bit wide pointers are optionally provided.
+   Therefore following macros aren't defined:
+   # undef _POSIX_V6_ILP32_OFF32
+   # undef _POSIX_V6_ILP32_OFFBIG
+   # undef _XBS5_ILP32_OFF32
+   # undef _XBS5_ILP32_OFFBIG
+   and users need to check at runtime.  */
+
+/* We also have no use (for now) for an environment with bigger pointers
+   and offsets.  */
+# define _POSIX_V6_LPBIG_OFFBIG        -1
+# define _XBS5_LPBIG_OFFBIG    -1
+
+/* By default we have 64-bit wide `long int', pointers and `off_t'.  */
+# define _POSIX_V6_LP64_OFF64  1
+# define _XBS5_LP64_OFF64      1
+
+#else /* __WORDSIZE == 32 */
+
+/* By default we have 32-bit wide `int', `long int', pointers and `off_t'
+   and all platforms support LFS.  */
+# define _POSIX_V6_ILP32_OFF32 1
+# define _POSIX_V6_ILP32_OFFBIG        1
+# define _XBS5_ILP32_OFF32     1
+# define _XBS5_ILP32_OFFBIG    1
+
+/* We optionally provide an environment with the above size but an 64-bit
+   side `off_t'.  Therefore we don't define _XBS5_ILP32_OFFBIG.  */
+
+/* Environments with 64-bit wide pointers can be provided,
+   so these macros aren't defined:
+   # undef _POSIX_V6_LP64_OFF64
+   # undef _POSIX_V6_LPBIG_OFFBIG
+   # undef _XBS5_LP64_OFF64
+   # undef _XBS5_LPBIG_OFFBIG
+   and sysconf tests for it at runtime.  */
+
+#endif /* __WORDSIZE == 32 */
+
+#define __ILP32_OFF32_CFLAGS   "-m32"
+#define __ILP32_OFFBIG_CFLAGS  "-m32 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
+#define __ILP32_OFF32_LDFLAGS  "-m32"
+#define __ILP32_OFFBIG_LDFLAGS "-m32"
+#define __LP64_OFF64_CFLAGS    "-m64"
+#define __LP64_OFF64_LDFLAGS   "-m64"
diff --git a/sysdeps/unix/sysv/linux/x86_64/bits/environments.h b/sysdeps/unix/sysv/linux/x86_64/bits/environments.h
new file mode 100644 (file)
index 0000000..a51a564
--- /dev/null
@@ -0,0 +1,87 @@
+/* Copyright (C) 1999, 2001, 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
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#ifndef _UNISTD_H
+# error "Never include this file directly.  Use <unistd.h> instead"
+#endif
+
+#include <bits/wordsize.h>
+
+/* This header should define the following symbols under the described
+   situations.  A value `1' means that the model is always supported,
+   `-1' means it is never supported.  Undefined means it cannot be
+   statically decided.
+
+   _POSIX_V6_ILP32_OFF32   32bit int, long, pointers, and off_t type
+   _POSIX_V6_ILP32_OFFBIG  32bit int, long, and pointers and larger off_t type
+
+   _POSIX_V6_LP64_OFF32           64bit long and pointers and 32bit off_t type
+   _POSIX_V6_LPBIG_OFFBIG  64bit long and pointers and large off_t type
+
+   The macros _XBS5_ILP32_OFF32, _XBS5_ILP32_OFFBIG, _XBS5_LP64_OFF32, and
+   _XBS5_LPBIG_OFFBIG were used in previous versions of the Unix standard
+   and are available only for compatibility.
+*/
+
+#if __WORDSIZE == 64
+
+/* Environments with 32-bit wide pointers are optionally provided.
+   Therefore following macros aren't defined:
+   # undef _POSIX_V6_ILP32_OFF32
+   # undef _POSIX_V6_ILP32_OFFBIG
+   # undef _XBS5_ILP32_OFF32
+   # undef _XBS5_ILP32_OFFBIG
+   and users need to check at runtime.  */
+
+/* We also have no use (for now) for an environment with bigger pointers
+   and offsets.  */
+# define _POSIX_V6_LPBIG_OFFBIG        -1
+# define _XBS5_LPBIG_OFFBIG    -1
+
+/* By default we have 64-bit wide `long int', pointers and `off_t'.  */
+# define _POSIX_V6_LP64_OFF64  1
+# define _XBS5_LP64_OFF64      1
+
+#else /* __WORDSIZE == 32 */
+
+/* By default we have 32-bit wide `int', `long int', pointers and `off_t'
+   and all platforms support LFS.  */
+# define _POSIX_V6_ILP32_OFF32 1
+# define _POSIX_V6_ILP32_OFFBIG        1
+# define _XBS5_ILP32_OFF32     1
+# define _XBS5_ILP32_OFFBIG    1
+
+/* We optionally provide an environment with the above size but an 64-bit
+   side `off_t'.  Therefore we don't define _XBS5_ILP32_OFFBIG.  */
+
+/* Environments with 64-bit wide pointers can be provided,
+   so these macros aren't defined:
+   # undef _POSIX_V6_LP64_OFF64
+   # undef _POSIX_V6_LPBIG_OFFBIG
+   # undef _XBS5_LP64_OFF64
+   # undef _XBS5_LPBIG_OFFBIG
+   and sysconf tests for it at runtime.  */
+
+#endif /* __WORDSIZE == 32 */
+
+#define __ILP32_OFF32_CFLAGS   "-m32"
+#define __ILP32_OFFBIG_CFLAGS  "-m32 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
+#define __ILP32_OFF32_LDFLAGS  "-m32"
+#define __ILP32_OFFBIG_LDFLAGS "-m32"
+#define __LP64_OFF64_CFLAGS    "-m64"
+#define __LP64_OFF64_LDFLAGS   "-m64"