summaryrefslogtreecommitdiff
path: root/posix/confstr.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2009-02-07 08:19:29 +0000
committerUlrich Drepper <drepper@redhat.com>2009-02-07 08:19:29 +0000
commit26b62243eed34c3ce43da0ea9e469ecc38a73968 (patch)
treefc6a01de2386c131c4f96cad17ec877d2df4bf53 /posix/confstr.c
parent962edb7e689847d5eb9b94a351fd0457994227f0 (diff)
downloadglibc-26b62243eed34c3ce43da0ea9e469ecc38a73968.tar.gz
[BZ #7095]
2009-02-06 Ulrich Drepper <drepper@redhat.com> [BZ #7095] * bits/confname.h: Add SUSv7 macros for getconf environments. * bits/environments.h: Likewise. * sysdeps/unix/sysv/linux/i386/bits/environments.h: Likewise. * sysdeps/unix/sysv/linux/powerpc/bits/environments.h: Likewise. * sysdeps/unix/sysv/linux/s390/bits/environments.h: Likewise. * sysdeps/unix/sysv/linux/sparc/bits/environments.h: Likewise. * sysdeps/unix/sysv/linux/x86_64/bits/environments.h: Likewise. * posix/confstr.c: Handle SUSv5 and SUSv7 environments. * posix/getconf.c: Likewise. * posix/sysconf.c: Likewise. * sysdeps/posix/sysconf.c: Likewise. * posix/Makefile (getconf.speclist): Also collect SUSv5 and SUSv7 environments.
Diffstat (limited to 'posix/confstr.c')
-rw-r--r--posix/confstr.c182
1 files changed, 162 insertions, 20 deletions
diff --git a/posix/confstr.c b/posix/confstr.c
index 26b0fa875b..9aa4b5aebb 100644
--- a/posix/confstr.c
+++ b/posix/confstr.c
@@ -1,5 +1,4 @@
-/* Copyright (C) 1991, 1996, 1997, 2000-2002, 2003, 2004
- Free Software Foundation, Inc.
+/* Copyright (C) 1991,1996,1997,2000-2004,2009 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
@@ -46,6 +45,69 @@ confstr (name, buf, len)
}
break;
+ case _CS_V7_WIDTH_RESTRICTED_ENVS:
+ /* We have to return a newline-separated list of named of
+ programming environements in which the widths of blksize_t,
+ cc_t, mode_t, nfds_t, pid_t, ptrdiff_t, size_t, speed_t,
+ ssize_t, suseconds_t, tcflag_t, useconds_t, wchar_t, and
+ wint_t types are no greater than the width of type long.
+
+ Currently this means all environment which the system allows. */
+ {
+ char restenvs[4 * sizeof "POSIX_V7_LPBIG_OFFBIG"];
+
+ string_len = 0;
+#ifndef _POSIX_V7_ILP32_OFF32
+ if (__sysconf (_SC_V7_ILP32_OFF32) > 0)
+#endif
+#if !defined _POSIX_V7_ILP32_OFF32 || _POSIX_V7_ILP32_OFF32 > 0
+ {
+ memcpy (restenvs + string_len, "POSIX_V7_ILP32_OFF32",
+ sizeof "POSIX_V7_ILP32_OFF32" - 1);
+ string_len += sizeof "POSIX_V7_ILP32_OFF32" - 1;
+ }
+#endif
+#ifndef _POSIX_V7_ILP32_OFFBIG
+ if (__sysconf (_SC_V7_ILP32_OFFBIG) > 0)
+#endif
+#if !defined _POSIX_V7_ILP32_OFFBIG || _POSIX_V7_ILP32_OFFBIG > 0
+ {
+ if (string_len)
+ restenvs[string_len++] = '\n';
+ memcpy (restenvs + string_len, "POSIX_V7_ILP32_OFFBIG",
+ sizeof "POSIX_V7_ILP32_OFFBIG" - 1);
+ string_len += sizeof "POSIX_V7_ILP32_OFFBIG" - 1;
+ }
+#endif
+#ifndef _POSIX_V7_LP64_OFF64
+ if (__sysconf (_SC_V7_LP64_OFF64) > 0)
+#endif
+#if !defined _POSIX_V7_LP64_OFF64 || _POSIX_V7_LP64_OFF64 > 0
+ {
+ if (string_len)
+ restenvs[string_len++] = '\n';
+ memcpy (restenvs + string_len, "POSIX_V7_LP64_OFF64",
+ sizeof "POSIX_V7_LP64_OFF64" - 1);
+ string_len += sizeof "POSIX_V7_LP64_OFF64" - 1;
+ }
+#endif
+#ifndef _POSIX_V7_LPBIG_OFFBIG
+ if (__sysconf (_SC_V7_LPBIG_OFFBIG) > 0)
+#endif
+#if !defined _POSIX_V7_LPBIG_OFFBIG || _POSIX_V7_LPBIG_OFFBIG > 0
+ {
+ if (string_len)
+ restenvs[string_len++] = '\n';
+ memcpy (restenvs + string_len, "POSIX_V7_LPBIG_OFFBIG",
+ sizeof "POSIX_V7_LPBIG_OFFBIG" - 1);
+ string_len += sizeof "POSIX_V7_LPBIG_OFFBIG" - 1;
+ }
+#endif
+ restenvs[string_len++] = '\0';
+ string = restenvs;
+ }
+ break;
+
case _CS_V6_WIDTH_RESTRICTED_ENVS:
/* We have to return a newline-separated list of named of
programming environements in which the widths of blksize_t,
@@ -109,13 +171,77 @@ confstr (name, buf, len)
}
break;
+ case _CS_V5_WIDTH_RESTRICTED_ENVS:
+ /* We have to return a newline-separated list of named of
+ programming environements in which the widths of blksize_t,
+ cc_t, mode_t, nfds_t, pid_t, ptrdiff_t, size_t, speed_t,
+ ssize_t, suseconds_t, tcflag_t, useconds_t, wchar_t, and
+ wint_t types are no greater than the width of type long.
+
+ Currently this means all environment which the system allows. */
+ {
+ char restenvs[4 * sizeof "XBS5_LPBIG_OFFBIG"];
+
+ string_len = 0;
+#ifndef _XBS5_ILP32_OFF32
+ if (__sysconf (_SC_XBS5_ILP32_OFF32) > 0)
+#endif
+#if !defined _XBS5_ILP32_OFF32 || _XBS5_ILP32_OFF32 > 0
+ {
+ memcpy (restenvs + string_len, "XBS5_ILP32_OFF32",
+ sizeof "XBS5_ILP32_OFF32" - 1);
+ string_len += sizeof "XBS5_ILP32_OFF32" - 1;
+ }
+#endif
+#ifndef _XBS5_ILP32_OFFBIG
+ if (__sysconf (_SC_XBS5_ILP32_OFFBIG) > 0)
+#endif
+#if !defined _XBS5_ILP32_OFFBIG || _XBS5_ILP32_OFFBIG > 0
+ {
+ if (string_len)
+ restenvs[string_len++] = '\n';
+ memcpy (restenvs + string_len, "XBS5_ILP32_OFFBIG",
+ sizeof "XBS5_ILP32_OFFBIG" - 1);
+ string_len += sizeof "XBS5_ILP32_OFFBIG" - 1;
+ }
+#endif
+#ifndef _XBS5_LP64_OFF64
+ if (__sysconf (_SC_XBS5_LP64_OFF64) > 0)
+#endif
+#if !defined _XBS5_LP64_OFF64 || _XBS5_LP64_OFF64 > 0
+ {
+ if (string_len)
+ restenvs[string_len++] = '\n';
+ memcpy (restenvs + string_len, "XBS5_LP64_OFF64",
+ sizeof "XBS5_LP64_OFF64" - 1);
+ string_len += sizeof "XBS5_LP64_OFF64" - 1;
+ }
+#endif
+#ifndef _XBS5_LPBIG_OFFBIG
+ if (__sysconf (_SC_XBS5_LPBIG_OFFBIG) > 0)
+#endif
+#if !defined _XBS5_LPBIG_OFFBIG || _XBS5_LPBIG_OFFBIG > 0
+ {
+ if (string_len)
+ restenvs[string_len++] = '\n';
+ memcpy (restenvs + string_len, "XBS5_LPBIG_OFFBIG",
+ sizeof "XBS5_LPBIG_OFFBIG" - 1);
+ string_len += sizeof "XBS5_LPBIG_OFFBIG" - 1;
+ }
+#endif
+ restenvs[string_len++] = '\0';
+ string = restenvs;
+ }
+ break;
+
case _CS_XBS5_ILP32_OFF32_CFLAGS:
case _CS_POSIX_V6_ILP32_OFF32_CFLAGS:
+ case _CS_POSIX_V7_ILP32_OFF32_CFLAGS:
#ifdef __ILP32_OFF32_CFLAGS
-# if _POSIX_V6_ILP32_OFF32 == -1
+# if _POSIX_V7_ILP32_OFF32 == -1
# error "__ILP32_OFF32_CFLAGS should not be defined"
-# elif !defined _POSIX_V6_ILP32_OFF32
- if (__sysconf (_SC_V6_ILP32_OFF32) < 0)
+# elif !defined _POSIX_V7_ILP32_OFF32
+ if (__sysconf (_SC_V7_ILP32_OFF32) < 0)
break;
# endif
string = __ILP32_OFF32_CFLAGS;
@@ -125,11 +251,12 @@ confstr (name, buf, len)
case _CS_XBS5_ILP32_OFFBIG_CFLAGS:
case _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS:
+ case _CS_POSIX_V7_ILP32_OFFBIG_CFLAGS:
#ifdef __ILP32_OFFBIG_CFLAGS
-# if _POSIX_V6_ILP32_OFFBIG == -1
+# if _POSIX_V7_ILP32_OFFBIG == -1
# error "__ILP32_OFFBIG_CFLAGS should not be defined"
-# elif !defined _POSIX_V6_ILP32_OFFBIG
- if (__sysconf (_SC_V6_ILP32_OFFBIG) < 0)
+# elif !defined _POSIX_V7_ILP32_OFFBIG
+ if (__sysconf (_SC_V7_ILP32_OFFBIG) < 0)
break;
# endif
string = __ILP32_OFFBIG_CFLAGS;
@@ -139,11 +266,12 @@ confstr (name, buf, len)
case _CS_XBS5_LP64_OFF64_CFLAGS:
case _CS_POSIX_V6_LP64_OFF64_CFLAGS:
+ case _CS_POSIX_V7_LP64_OFF64_CFLAGS:
#ifdef __LP64_OFF64_CFLAGS
-# if _POSIX_V6_LP64_OFF64 == -1
+# if _POSIX_V7_LP64_OFF64 == -1
# error "__LP64_OFF64_CFLAGS should not be defined"
-# elif !defined _POSIX_V6_LP64_OFF64
- if (__sysconf (_SC_V6_LP64_OFF64) < 0)
+# elif !defined _POSIX_V7_LP64_OFF64
+ if (__sysconf (_SC_V7_LP64_OFF64) < 0)
break;
# endif
string = __LP64_OFF64_CFLAGS;
@@ -153,11 +281,12 @@ confstr (name, buf, len)
case _CS_XBS5_ILP32_OFF32_LDFLAGS:
case _CS_POSIX_V6_ILP32_OFF32_LDFLAGS:
+ case _CS_POSIX_V7_ILP32_OFF32_LDFLAGS:
#ifdef __ILP32_OFF32_LDFLAGS
-# if _POSIX_V6_ILP32_OFF32 == -1
+# if _POSIX_V7_ILP32_OFF32 == -1
# error "__ILP32_OFF32_LDFLAGS should not be defined"
-# elif !defined _POSIX_V6_ILP32_OFF32
- if (__sysconf (_SC_V6_ILP32_OFF32) < 0)
+# elif !defined _POSIX_V7_ILP32_OFF32
+ if (__sysconf (_SC_V7_ILP32_OFF32) < 0)
break;
# endif
string = __ILP32_OFF32_LDFLAGS;
@@ -167,11 +296,12 @@ confstr (name, buf, len)
case _CS_XBS5_ILP32_OFFBIG_LDFLAGS:
case _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS:
+ case _CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS:
#ifdef __ILP32_OFFBIG_LDFLAGS
-# if _POSIX_V6_ILP32_OFFBIG == -1
+# if _POSIX_V7_ILP32_OFFBIG == -1
# error "__ILP32_OFFBIG_LDFLAGS should not be defined"
-# elif !defined _POSIX_V6_ILP32_OFFBIG
- if (__sysconf (_SC_V6_ILP32_OFFBIG) < 0)
+# elif !defined _POSIX_V7_ILP32_OFFBIG
+ if (__sysconf (_SC_V7_ILP32_OFFBIG) < 0)
break;
# endif
string = __ILP32_OFFBIG_LDFLAGS;
@@ -181,11 +311,12 @@ confstr (name, buf, len)
case _CS_XBS5_LP64_OFF64_LDFLAGS:
case _CS_POSIX_V6_LP64_OFF64_LDFLAGS:
+ case _CS_POSIX_V7_LP64_OFF64_LDFLAGS:
#ifdef __LP64_OFF64_LDFLAGS
-# if _POSIX_V6_LP64_OFF64 == -1
+# if _POSIX_V7_LP64_OFF64 == -1
# error "__LP64_OFF64_LDFLAGS should not be defined"
-# elif !defined _POSIX_V6_LP64_OFF64
- if (__sysconf (_SC_V6_LP64_OFF64) < 0)
+# elif !defined _POSIX_V7_LP64_OFF64
+ if (__sysconf (_SC_V7_LP64_OFF64) < 0)
break;
# endif
string = __LP64_OFF64_LDFLAGS;
@@ -241,6 +372,17 @@ confstr (name, buf, len)
case _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS:
case _CS_POSIX_V6_LPBIG_OFFBIG_LIBS:
case _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS:
+
+ case _CS_POSIX_V7_ILP32_OFF32_LIBS:
+ case _CS_POSIX_V7_ILP32_OFF32_LINTFLAGS:
+ case _CS_POSIX_V7_ILP32_OFFBIG_LIBS:
+ case _CS_POSIX_V7_ILP32_OFFBIG_LINTFLAGS:
+ case _CS_POSIX_V7_LP64_OFF64_LIBS:
+ case _CS_POSIX_V7_LP64_OFF64_LINTFLAGS:
+ case _CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS:
+ case _CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS:
+ case _CS_POSIX_V7_LPBIG_OFFBIG_LIBS:
+ case _CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS:
/* GNU libc does not require special actions to use LFS functions. */
break;