tech-userlevel archive

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

[PATCH] Programming Environment constants for confstr()



Implement a few constants, that are required by confstr() according to the 
latest POSIX manuals. Includes getconf() modification.

- heikki



diff --git a/lib/libc/gen/confstr.c b/lib/libc/gen/confstr.c
index 51efdb1..3e1e2d5 100644
--- a/lib/libc/gen/confstr.c
+++ b/lib/libc/gen/confstr.c
@@ -90,6 +90,25 @@ confstr(name, buf, len)
                        free(p);
                }
                return tlen + 1;
+       /*
+        * POSIX Programming Environment stuff
+        */
+       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_OFFBIG_CFLAGS:
+       case _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS:
+       case _CS_POSIX_V6_ILP32_OFFBIG_LIBS:
+       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_LPBIG_OFFBIG_CFLAGS:
+       case _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS:
+       case _CS_POSIX_V6_LPBIG_OFFBIG_LIBS:
+       case _CS_POSIX_V6_WIDTH_RESTRICTED_ENVS:
+               if (len != 0 && buf != NULL)
+                       (void)strcpy(buf, "\0");
+               return 1;
        default:
                errno = EINVAL;
                return 0;
diff --git a/sys/sys/unistd.h b/sys/sys/unistd.h
index 4b79d5c..3ac3489 100644
--- a/sys/sys/unistd.h
+++ b/sys/sys/unistd.h
@@ -241,4 +241,18 @@
 /* configurable system strings */
 #define        _CS_PATH                 1
 
+#define _CS_POSIX_V6_ILP32_OFF32_CFLAGS                 2
+#define _CS_POSIX_V6_ILP32_OFF32_LDFLAGS        3
+#define _CS_POSIX_V6_ILP32_OFF32_LIBS           4
+#define _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS        5
+#define _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS       6
+#define _CS_POSIX_V6_ILP32_OFFBIG_LIBS          7
+#define _CS_POSIX_V6_LP64_OFF64_CFLAGS          8
+#define _CS_POSIX_V6_LP64_OFF64_LDFLAGS                 9
+#define _CS_POSIX_V6_LP64_OFF64_LIBS           10
+#define _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS       11
+#define _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS      12
+#define _CS_POSIX_V6_LPBIG_OFFBIG_LIBS         13
+#define _CS_POSIX_V6_WIDTH_RESTRICTED_ENVS     14
+
 #endif /* !_SYS_UNISTD_H_ */
diff --git a/usr.bin/getconf/getconf.c b/usr.bin/getconf/getconf.c
index 3a4241f..8f4dc43 100644
--- a/usr.bin/getconf/getconf.c
+++ b/usr.bin/getconf/getconf.c
@@ -59,6 +59,34 @@ static const struct conf_variable conf_table[] =
 {
   { "PATH",                    CONFSTR,        _CS_PATH                },
 
+  /* Programming Environment Values */
+  { "POSIX_V6_ILP32_OFF32_CFLAGS",     CONFSTR,
+    _CS_POSIX_V6_ILP32_OFF32_CFLAGS },
+  { "POSIX_V6_ILP32_OFF32_LDFLAGS",    CONFSTR,
+    _CS_POSIX_V6_ILP32_OFF32_LDFLAGS },
+  { "POSIX_V6_ILP32_OFF32_LIBS",       CONFSTR,
+    _CS_POSIX_V6_ILP32_OFF32_LIBS },
+  { "POSIX_V6_ILP32_OFFBIG_CFLAGS",    CONFSTR,
+    _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS },
+  { "POSIX_V6_ILP32_OFFBIG_LDFLAGS",   CONFSTR,
+    _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS },
+  { "POSIX_V6_ILP32_OFFBIG_LIBS",      CONFSTR,
+    _CS_POSIX_V6_ILP32_OFFBIG_LIBS },
+  { "POSIX_V6_LP64_OFF64_CFLAGS",      CONFSTR,
+    _CS_POSIX_V6_LP64_OFF64_CFLAGS },
+  { "POSIX_V6_LP64_OFF64_LDFLAGS",     CONFSTR,
+    _CS_POSIX_V6_LP64_OFF64_LDFLAGS },
+  { "POSIX_V6_LP64_OFF64_LIBS",                CONFSTR,
+    _CS_POSIX_V6_LP64_OFF64_LIBS },
+  { "POSIX_V6_LP64_OFF64_LIBS",                CONFSTR,
+    _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS },
+  { "POSIX_V6_LP64_OFF64_LDFLAGS",     CONFSTR,
+    _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS },
+  { "POSIX_V6_LP64_OFF64_LIBS",                CONFSTR,
+    _CS_POSIX_V6_LPBIG_OFFBIG_LIBS },
+  { "POSIX_V6_WIDTH_RESTRICTED_ENVS",  CONFSTR,
+    _CS_POSIX_V6_WIDTH_RESTRICTED_ENVS },
+
   /* Utility Limit Minimum Values */
   { "POSIX2_BC_BASE_MAX",      CONSTANT,       _POSIX2_BC_BASE_MAX     },
   { "POSIX2_BC_DIM_MAX",       CONSTANT,       _POSIX2_BC_DIM_MAX      },


Home | Main Index | Thread Index | Old Index