Restore _POSIX2_C_VERSION definition (bug 438).

System Internals / glibc - Joseph Myers [codesourcery.com] - 22 May 2015 12:14 UTC

My review of conformtest expectations for POSIX showed up that the _POSIX2_C_VERSION macro, required by POSIX and XPG standards before 2001, was missing in unistd.h, having been removed on 2003-04-03 despite those standards still being supported. This patch adds it back. As it's in the implementation namespace, there's no need for it to be conditional, and other such macros aren't conditional in this header either.

Tested for x86_64 and x86 (testsuite). Note that this *does* change the installed libraries, because it affects the sysconf support (present all along) for _SC_2_C_VERSION.

[BZ #438]
- posix/unistd.h (_POSIX2_C_VERSION): New macro.
- conform/Makefile (test-xfail-POSIX/unistd.h/conform): Remove
variable.

###

diff --git a/ChangeLog b/ChangeLog
index 6a44067..131e161 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2015-05-22 Joseph Myers

+ [BZ #438]
+ * posix/unistd.h (_POSIX2_C_VERSION): New macro.
+ * conform/Makefile (test-xfail-POSIX/unistd.h/conform): Remove
+ variable.
+
[BZ #18444]
* string/basename.c (basename): Rename to __basename and define as
weak alias of __basename. Use libc_hidden_weak.
diff --git a/NEWS b/NEWS
index 56aa6d7..23fcbaa 100644
--- a/NEWS
+++ b/NEWS
@@ -9,16 +9,17 @@ Version 2.22

* The following bugs are resolved with this release:

- 4719, 6792, 13028, 13064, 14094, 14841, 14906, 15319, 15467, 15790, 15969,
- 16159, 16339, 16351, 16352, 16512, 16560, 16704, 16783, 16850, 17053,
- 17090, 17195, 17269, 17523, 17542, 17569, 17581, 17588, 17596, 17620,
- 17621, 17628, 17631, 17692, 17711, 17715, 17776, 17779, 17792, 17836,
- 17912, 17916, 17930, 17932, 17944, 17949, 17964, 17965, 17967, 17969,
- 17978, 17987, 17991, 17996, 17998, 17999, 18007, 18019, 18020, 18029,
- 18030, 18032, 18036, 18038, 18039, 18042, 18043, 18046, 18047, 18049,
- 18068, 18080, 18093, 18100, 18104, 18110, 18111, 18125, 18128, 18138,
- 18185, 18196, 18197, 18206, 18210, 18211, 18217, 18220, 18221, 18244,
- 18247, 18287, 18319, 18333, 18346, 18397, 18409, 18418, 18434, 18444.
+ 438, 4719, 6792, 13028, 13064, 14094, 14841, 14906, 15319, 15467, 15790,
+ 15969, 16159, 16339, 16351, 16352, 16512, 16560, 16704, 16783, 16850,
+ 17053, 17090, 17195, 17269, 17523, 17542, 17569, 17581, 17588, 17596,
+ 17620, 17621, 17628, 17631, 17692, 17711, 17715, 17776, 17779, 17792,
+ 17836, 17912, 17916, 17930, 17932, 17944, 17949, 17964, 17965, 17967,
+ 17969, 17978, 17987, 17991, 17996, 17998, 17999, 18007, 18019, 18020,
+ 18029, 18030, 18032, 18036, 18038, 18039, 18042, 18043, 18046, 18047,
+ 18049, 18068, 18080, 18093, 18100, 18104, 18110, 18111, 18125, 18128,
+ 18138, 18185, 18196, 18197, 18206, 18210, 18211, 18217, 18220, 18221,
+ 18244, 18247, 18287, 18319, 18333, 18346, 18397, 18409, 18418, 18434,
+ 18444.

* Cache information can be queried via sysconf() function on s390 e.g. with
_SC_LEVEL1_ICACHE_SIZE as argument.
diff --git a/conform/Makefile b/conform/Makefile
index a81ed54..27732f5 100644
--- a/conform/Makefile
+++ b/conform/Makefile
@@ -211,7 +211,6 @@ test-xfail-XPG4/termios.h/conform = yes
test-xfail-XPG4/ucontext.h/conform = yes
test-xfail-XPG4/unistd.h/conform = yes
test-xfail-XPG4/utmpx.h/conform = yes
-test-xfail-POSIX/unistd.h/conform = yes
test-xfail-POSIX/sys/wait.h/conform = yes
test-xfail-UNIX98/arpa/inet.h/conform = yes
test-xfail-UNIX98/fcntl.h/conform = yes
diff --git a/posix/unistd.h b/posix/unistd.h
index 80a5b86..1b52930 100644
--- a/posix/unistd.h
+++ b/posix/unistd.h
@@ -66,6 +66,9 @@ __BEGIN_DECLS
/* The utilities on GNU systems also correspond to this version. */
#define _POSIX2_VERSION __POSIX2_THIS_VERSION

+/* This symbol was required until the 2001 edition of POSIX. */
+#define _POSIX2_C_VERSION __POSIX2_THIS_VERSION
+
/* If defined, the implementation supports the
C Language Bindings Option. */
#define _POSIX2_C_BIND __POSIX2_THIS_VERSION

4e5f925 Restore _POSIX2_C_VERSION definition (bug 438).
ChangeLog | 5 +++++
NEWS | 21 +++++++++++----------
conform/Makefile | 1 -
posix/unistd.h | 3 +++
4 files changed, 19 insertions(+), 11 deletions(-)

Upstream: sourceware.org


  • Share