Commit graph

233 commits

Author SHA1 Message Date
Joseph Myers eb64b6d457 Fix limits.h NL_NMAX namespace (bug 19929).
bits/xopen_lim.h (included by limits.h if __USE_XOPEN) defines
NL_NMAX, but this constant was removed in the 2008 edition of POSIX so
should not be defined in that case.  This patch duly disables that
define for __USE_XOPEN2K8.  It remains enabled for __USE_GNU to avoid
affecting sysconf (_SC_NL_NMAX), the implementation of which uses
"#ifdef NL_NMAX".

Tested for x86_64 and x86 (testsuite, and that installed stripped
shared libraries are unchanged by the patch).

	[BZ #19929]
	* include/bits/xopen_lim.h (NL_NMAX): Do not define if
	[__USE_XOPEN2K8 && !__USE_GNU].
	* conform/Makefile (test-xfail-XOPEN2K8/limits.h/conform): Remove
	variable.
2016-04-08 22:52:51 +00:00
Joseph Myers fb3227b95c Fix termios.h XCASE namespace (bug 19925).
bits/termios.h (various versions under sysdeps/unix/sysv/linux)
defines XCASE if defined __USE_MISC || defined __USE_XOPEN.  This
macro was removed in the 2001 edition of POSIX, and is not otherwise
reserved, so should not be defined for 2001 and later versions of
POSIX.  This patch fixes the conditions accordingly (leaving the macro
defined for __USE_MISC, so still in the default namespace).

Tested for x86_64 and x86 (testsuite, and that installed shared
libraries are unchanged by the patch).

	[BZ #19925]
	* sysdeps/unix/sysv/linux/alpha/bits/termios.h (XCASE): Do not
	define if [!__USE_MISC && __USE_XOPEN2K].
	* sysdeps/unix/sysv/linux/bits/termios.h (XCASE): Likewise.
	* sysdeps/unix/sysv/linux/mips/bits/termios.h (XCASE): Likewise.
	* sysdeps/unix/sysv/linux/powerpc/bits/termios.h (XCASE):
	Likewise.
	* sysdeps/unix/sysv/linux/sparc/bits/termios.h (XCASE): Likewise.
	* conform/Makefile (test-xfail-XOPEN2K/termios.h/conform): Remove
	variable.
	(test-xfail-XOPEN2K8/termios.h/conform): Likewise.
2016-04-08 18:16:09 +00:00
Marko Myllynen 48d0341cdd Make shebang interpreter directives consistent 2016-01-07 04:03:21 -05:00
Joseph Myers f7a9f785e5 Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
Joseph Myers d709042a6e Fix lgamma setting signgam for ISO C (bug 15421).
The lgamma (and likewise lgammaf, lgammal) function wrongly sets the
signgam variable even when building for strict ISO C conformance
(-std=c99 / -std=c11), although the user may define such a variable
and it's only in the implementation namespace for POSIX with XSI
extensions enabled.

Following discussions starting at
<https://sourceware.org/ml/libc-alpha/2013-04/msg00767.html> and
<https://sourceware.org/ml/libc-alpha/2015-10/msg00844.html>, it seems
that the safest approach for fixing this particular issue is for
signgam to become a weak alias for a newly exported symbol __signgam,
with the library functions only setting __signgam, at which point
static linker magic will preserve the alias for newly linked binaries
that refer to the library's signgam rather than defining their own,
while breaking the alias for programs that define their own signgam,
with new symbol versions for lgamma functions and with compat symbols
for existing binaries that set both signgam and __signgam.

This patch implements that approach for the fix.  signgam is made into
a weak alias.  The four symbols __signgam, lgamma, lgammaf, lgammal
get new symbol versions at version GLIBC_2.23, with the existing
versions of lgamma, lgammaf and lgammal becoming compat symbols.

When the compat versions are built, gamma, gammaf and gammal are
aliases for the compat versions (i.e. always set signgam); this is OK
as they are not ISO C functions, and avoids adding new symbol versions
for them unnecessarily.  When the compat versions are not built
(i.e. for static linking and for future glibc ports), gamma, gammaf
and gammal are aliases for the new versions that set __signgam.  The
ldbl-opt versions are updated accordingly.

The lgamma wrappers are adjusted so that the same source files,
included from different files with different definitions of
USE_AS_COMPAT, can build either the new versions or the compat
versions.  Similar changes are made to the ia64 versions (untested).

Tests are added that the lgamma functions do not interfere with a user
variable called signgam for ISO C, with various choices for the size
of that variable, whether it is initialized, and for static and
dynamic linking.  The conformtest whitelist entry is removed as well.

Tested for x86_64, x86, mips64 and powerpc, including looking at
objdump --dynamic-syms output to make sure the expected sets of
symbols were aliases.  Also spot-tested that a binary built with old
glibc works properly (i.e. gets signgam set) when run with new glibc.

	[BZ #15421]
	* sysdeps/ieee754/s_signgam.c (signgam): Rename to __signgam,
	initialize with 0 and define as weak alias of __signgam.
	* include/math.h [!_ISOMAC] (__signgam): Declare.
	* math/Makefile (libm-calls): Add w_lgamma_compat.
	(tests): Add test-signgam-uchar, test-signgam-uchar-init,
	test-signgam-uint, test-signgam-uint-init, test-signgam-ullong and
	test-signgam-ullong-init.
	(tests-static): Add test-signgam-uchar-static,
	test-signgam-uchar-init-static, test-signgam-uint-static,
	test-signgam-uint-init-static, test-signgam-ullong-static and
	test-signgam-ullong-init-static.
	(CFLAGS-test-signgam-uchar.c): New variable.
	(CFLAGS-test-signgam-uchar-init.c): Likewise.
	(CFLAGS-test-signgam-uchar-static.c): Likewise.
	(CFLAGS-test-signgam-uchar-init-static.c): Likewise.
	(CFLAGS-test-signgam-uint.c): Likewise.
	(CFLAGS-test-signgam-uint-init.c): Likewise.
	(CFLAGS-test-signgam-uint-static.c): Likewise.
	(CFLAGS-test-signgam-uint-init-static.c): Likewise.
	(CFLAGS-test-signgam-ullong.c): Likewise.
	(CFLAGS-test-signgam-ullong-init.c): Likewise.
	(CFLAGS-test-signgam-ullong-static.c): Likewise.
	(CFLAGS-test-signgam-ullong-init-static.c): Likewise.
	* math/Versions (libm): Add GLIBC_2.23.
	* math/lgamma-compat.h: New file.
	* math/test-signgam-main.c: Likewise.
	* math/test-signgam-uchar-init-static.c: Likewise.
	* math/test-signgam-uchar-init.c: Likewise.
	* math/test-signgam-uchar-static.c: Likewise.
	* math/test-signgam-uchar.c: Likewise.
	* math/test-signgam-uint-init-static.c: Likewise.
	* math/test-signgam-uint-init.c: Likewise.
	* math/test-signgam-uint-static.c: Likewise.
	* math/test-signgam-uint.c: Likewise.
	* math/test-signgam-ullong-init-static.c: Likewise.
	* math/test-signgam-ullong-init.c: Likewise.
	* math/test-signgam-ullong-static.c: Likewise.
	* math/test-signgam-ullong.c: Likewise.
	* math/w_lgamma.c: Rename to w_lgamma_main.c and replace by
	wrapper of w_lgamma_main.c.
	* math/w_lgamma_compat.c: New file.
	* math/w_lgamma_compatf.c: Likewise.
	* math/w_lgamma_compatl.c: Likewise.
	* math/w_lgamma_main.c: New file.  Based on w_lgamma.c.  Include
	<lgamma-compat.h>.  Condition contents on [BUILD_LGAMMA].  Support
	defining compatibility symbols.
	(__lgamma): Change to LGFUNC (__lgamma).  Use CALL_LGAMMA.
	* math/w_lgammaf.c: Rename to w_lgammaf_main.c and replace by
	wrapper of w_lgammaf_main.c.
	* math/w_lgammaf_main.c: New file.  Based on w_lgammaf.c.  Include
	<lgamma-compat.h>.  Condition contents on [BUILD_LGAMMA].  Support
	defining compatibility symbols.
	(__lgammaf): Change to LGFUNC (__lgammaf).  Use CALL_LGAMMA.
	* math/w_lgammal.c: Rename to w_lgammal_main.c and replace by
	wrapper of w_lgammal_main.c.
	* math/w_lgammal_main.c: New file.  Based on w_lgammal.c.  Include
	<lgamma-compat.h>.  Condition contents on [BUILD_LGAMMA].  Support
	defining compatibility symbols.
	(__lgammal): Change to LGFUNC (__lgammal).  Use CALL_LGAMMA.
	* sysdeps/ia64/fpu/lgamma-compat.h: New file.
	* sysdeps/ia64/fpu/w_lgamma.c: Move to ....
	* sysdeps/ia64/fpu/w_lgamma_main.c: ...here.  Include
	<lgamma-compat.h>.
	(__ieee754_lgamma): Change to LGFUNC (lgamma).  Use CALL_LGAMMA.
	(__ieee754_gamma): Define as alias.
	* sysdeps/ia64/fpu/w_lgammaf.c: Move to ....
	* sysdeps/ia64/fpu/w_lgammaf_main.c: ...here.  Include
	<lgamma-compat.h>.
	(__ieee754_lgammaf): Change to LGFUNC (lgammaf).  Use CALL_LGAMMA.
	(__ieee754_gammaf): Define as alias.
	* sysdeps/ia64/fpu/w_lgammal.c: Move to ....
	* sysdeps/ia64/fpu/w_lgammal_main.c: ...here.  Include
	<lgamma-compat.h>.
	(__ieee754_lgammal): Change to LGFUNC (lgammal).  Use CALL_LGAMMA.
	(__ieee754_gammal): Define as alias.
	* sysdeps/ieee754/ldbl-opt/w_lgamma.c: Move to ....
	* sysdeps/ieee754/ldbl-opt/w_lgamma_compat.c: ...here.  Include
	<math/w_lgamma_compat.c>.
	[LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)] (__lgammal_dbl_compat):
	Define as alias of __lgamma_compat and use in defining lgammal.
	* sysdeps/ieee754/ldbl-opt/w_lgammal.c: Move to ....
	* sysdeps/ieee754/ldbl-opt/w_lgamma_compatl.c: ...here.  Include
	<math/lgamma-compat.h> and <math/w_lgamma_compatl.c>.
	(USE_AS_COMPAT): New macro.
	(LGAMMA_OLD_VER): Undefine and redefine.
	(lgammal): Do not define here.
	(gammal): Only define here if [GAMMA_ALIAS].
	* conform/linknamespace.pl (@whitelist): Remove signgam.
	* sysdeps/nacl/libm.abilist: Update.
	* sysdeps/unix/sysv/linux/aarch64/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/alpha/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/arm/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/hppa/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/i386/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/ia64/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/m68k/coldfire/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/m68k/m680x0/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/microblaze/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/mips/mips32/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/mips/mips64/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/nios2/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libm.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libm.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/libm-le.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/libm.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-32/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-64/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/sh/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc32/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc64/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libm.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libm.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/tile/tilepro/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/64/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/x32/libm.abilist: Likewise.
2015-11-20 22:49:59 +00:00
Joseph Myers 8b126a4a2c Remove pre-GCC-4.7 conform/ test XFAILs.
Now that GCC 4.7 or later is required to build glibc, this patch
removes three conform/ test XFAILs that related to missing C11 support
in GCC 4.6.

Tested for x86_64 and x86 (conform/ tests).

	* conform/Makefile (test-xfail-ISO11/complex.h/conform): Remove
	variable.
	(test-xfail-ISO11/stdalign.h/conform): Likewise.
	(test-xfail-ISO11/stdnoreturn.h/conform): Likewise.
2015-10-27 17:13:14 +00:00
Joseph Myers caf2d83659 Use -std=c11 for C11 conform/ tests.
Now that GCC 4.7 or later is required to build glibc, this patch makes
the conformance tests use -std=c11 for C11 tests instead of -std=c1x
-D_ISOC11_SOURCE.

Tested for x86_64 and x86 (conform/ tests).

	* conform/GlibcConform.pm ($CFLAGS{"ISO11"}): Use -std=c11 instead
	of -std=c1x -D_ISOC11_SOURCE.
2015-10-27 17:11:31 +00:00
Joseph Myers a435cc46e6 Test for weak undefined symbols in linknamespace.pl.
This patch makes linknamespace.pl require weak undefined symbols to be
within the standard namespace.  (It remains the case that
linknamespace.pl does not look for definitions of such symbols or
require symbols used in those definitions to be within the standard
namespace.)

Tested for x86_64 and x86.

	* conform/linknamespace.pl: Require weak undefined symbols to be
	in the standard namespace.
	(%strong_syms): Rename to %seen_syms.
	(%strong_seen): Rename to %seen_where.
2015-09-18 00:52:07 +00:00
Joseph Myers 1f11365a75 Don't declare float / long double Bessel functions for XSI POSIX (bug 18977).
The float and long double versions of Bessel function (j0f, y1l, etc.)
are not in POSIX; only the double versions are.  This patch
accordingly limits the declarations of those functions to __USE_MISC,
and fixes the conform/ test expectations which matched the previous
incorrect declarations.

Tested for x86_64 and x86 (testsuite, and that installed stripped
shared libraries are unchanged by this patch).

	[BZ #18977]
	* math/bits/mathcalls.h
	[!__USE_MISC && __USE_XOPEN && !__MATH_DECLARING_DOUBLE] (j0): Do
	not declare.
	[!__USE_MISC && __USE_XOPEN && !__MATH_DECLARING_DOUBLE] (j1):
	Likewise.
	[!__USE_MISC && __USE_XOPEN && !__MATH_DECLARING_DOUBLE] (jn):
	Likewise.
	[!__USE_MISC && __USE_XOPEN && !__MATH_DECLARING_DOUBLE] (y0):
	Likewise.
	[!__USE_MISC && __USE_XOPEN && !__MATH_DECLARING_DOUBLE] (y1):
	Likewise.
	[!__USE_MISC && __USE_XOPEN && !__MATH_DECLARING_DOUBLE] (yn):
	Likewise.
	* conform/data/math.h-data
	[!ISO99 && !ISO11 && !POSIX && !POSIX2008] (j0f): Do not expect
	function.
	[!ISO99 && !ISO11 && !POSIX && !POSIX2008] (j1f): Likewise.
	[!ISO99 && !ISO11 && !POSIX && !POSIX2008] (jnf): Likewise.
	[!ISO99 && !ISO11 && !POSIX && !POSIX2008] (y0f): Likewise.
	[!ISO99 && !ISO11 && !POSIX && !POSIX2008] (y1f): Likewise.
	[!ISO99 && !ISO11 && !POSIX && !POSIX2008] (ynf): Likewise.
	[!ISO99 && !ISO11 && !POSIX && !POSIX2008] (j0l): Likewise.
	[!ISO99 && !ISO11 && !POSIX && !POSIX2008] (j1l): Likewise.
	[!ISO99 && !ISO11 && !POSIX && !POSIX2008] (jnl): Likewise.
	[!ISO99 && !ISO11 && !POSIX && !POSIX2008] (y0l): Likewise.
	[!ISO99 && !ISO11 && !POSIX && !POSIX2008] (y1l): Likewise.
	[!ISO99 && !ISO11 && !POSIX && !POSIX2008] (ynl): Likewise.
2015-09-16 22:04:40 +00:00
Joseph Myers de20571d40 Fix math.h, tgmath.h XSI POSIX namespace (gamma, isnan, scalb) (bug 18967).
math.h incorrectly declares various functions for XSI POSIX 2001 and
2008 editions.  gamma was removed in the 2001 edition but is still
declared, along with gammaf and gammal which were never standard
functions.  isnan is still declared as a function, along with isnanf
and isnanl which were never standard functions, although in 2001 the
function was replaced by the type-generic macro.  scalbf and scalbl
are declared although never standard, and scalb was removed in the
2008 edition but is still declared.  The scalb type-generic macro in
tgmath.h shouldn't be present for any POSIX version, since POSIX never
had such a type-generic macro.

This patch disables all those declarations in the relevant cases (as a
minimal fix, it leaves them enabled for __USE_MISC).  For the matter
of declaring scalb but not scalbf or scalbl for the 2001 edition, a
new macro __MATH_DECLARING_DOUBLE is added, defined by math.h around
includes of bits/mathcalls.h, for bits/mathcalls.h to use to test
which type's functions are being declared.

Tested for x86_64 and x86 (testsuite, and that installed stripped
shared libraries are unchanged by the patch).

	[BZ #18967]
	* math/math.h (__MATH_DECLARING_DOUBLE): New macro.  Define and
	undefine around includes of <bits/mathcalls.h>.
	* math/bits/mathcalls.h [!__USE_MISC && __USE_XOPEN2K] (isnan): Do
	not declare function.
	[!__USE_MISC && __USE_XOPEN2K] (gamma): Likewise.
	[!__USE_MISC && (!__MATH_DECLARING_DOUBLE || __USE_XOPEN2K8)]
	(scalb): Likewise.
	* math/tgmath.h [!__USE_MISC && __USE_XOPEN_EXTENDED] (scalb): Do
	not define macro.
	* conform/Makefile (test-xfail-XOPEN2K/math.h/conform): Remove
	variable.
	(test-xfail-XOPEN2K/tgmath.h/conform): Likewise.
	(test-xfail-XOPEN2K8/math.h/conform): Likewise.
	(test-xfail-XOPEN2K8/tgmath.h/conform): Likewise.
2015-09-15 22:12:40 +00:00
Andreas Schwab fddb87425a Fix spurious conform test failures 2015-07-27 16:13:55 +02:00
Mike Frysinger 3840aabcd5 conform/linknamespace: whitelist matherrf/matherrl
glibc supports the deprecated matherr hook for math error reporting.  The
conform tests take this into consideration and whitelist this symbol when
running linknamespace tests.

The ia64 libm code has long provided two additional hooks in this space:
	matherrf (for floats)
	matherrl (for long doubles)

Which causes the conform tests to fail with chains that all look like:
	[initial] __atan2 ->
	[libm.a(e_atan2.o)] __libm_error_support ->
	[libm.a(libm_error.o)] matherrf

We can't (losslessly) redirect existing usage of these funcs to matherr
because the structure passed in is different -- matherr uses a struct with
doubles while matherrf/matherrl use floats and long doubles respectively.
Plus, this has been part of the exported ABI since glibc-2.2.3, so it
doesn't feel right to change it so late.

Until we get around to obsoleting matherr entirely, whitelist these two
additional ia64 symbols.
2015-07-23 03:28:53 -04:00
Joseph Myers d6cc0b4fea conformtest: Fix pselect expectations.
conformtest expected pselect for XOPEN2K and POSIX2008 (correctly),
but not for XOPEN2K8 (wrongly).  This patch fixes the data to expect
it for XOPEN2K8 as well.

(As for all such fixes based on failures seen from the tests, there is
no guarantee that the data is fully correct for a particular standard
after the fix; headers and data may well have matching bugs.  So far
I've only reviewed ISO, ISO99, ISO11 and POSIX data in detail, though
I hope eventually to review the others.)

Tested for x86_64 and x86.

	* conform/data/sys/select.h-data [XOPEN2K8] (pselect): Expect.
	* conform/Makefile (test-xfail-XOPEN2K8/sys/select.h/conform):
	Remove variable.
	(test-xfail-XOPEN2K8/sys/time.h/conform): Likewise.
	(test-xfail-XOPEN2K8/utmpx.h/conform).
2015-06-19 20:52:44 +00:00
Joseph Myers 5675961d15 conformtest: Support xfail markers on individual assertions.
Various conformtest tests fail because of known issues, filed in
Bugzilla, that are hard to fix (requiring new features, kernel
cooperation or involving changing types in ways that may involve care
around padding when interfacing to the kernel).  Such an issue has the
effect of making the whole test for the (standard, header) pair fail,
so hiding any other issues with that header for that standard
(possibly regressions or architecture-specific issues).

This patch adds a mechanism for individual conformtest test
expectations to start with xfail-, meaning that a failure of that
particular assertion does not cause the whole test to fail at the
makefile level and so failure at the makefile level can be used to
detect other issues that are likely to be easier to fix.  This is
similar to the whitelisted symbols in the linknamespace tests, or the
marking of particular libm tests as allowing spurious or missing
exceptions, for example.  The bugs filed in Bugzilla should still be
fixed, and the xfail- markers removed at that point, but xfail-
renders the tests more useful until that happens.

Note that there is no way to add such a marker for the assertion that
a header uses only symbols in the namespace of symbols it's meant to
use.  I don't think there's any need for a way to xfail those
namespace tests other than xfailing the whole (standard, header) pair
at the makefile level, since they are generally straightforward to fix
(add appropriate conditionals on the problem definitions).

The xfails in this patch do not necessarily cover all cases of
hard-to-fix header bugs filed in Bugzilla that currently show up in
conformtest failures; there may be more yet to add for existing open
bugs.

Tested for x86_64 and x86.

	* conform/conformtest.pl ($xerrors): New variable.
	(note_error): New function.
	(compiletest): New argument $xfail.  Use not_error.
	(runtest): Likewise.
	(top level): Handle xfail- lines.  Update calls to compiletest and
	runtest.  Handle xfail- and optional- in headers listed with
	allow-header.
	* conform/data/fcntl.h-data (O_TTY_INIT): Use xfail-.
	(O_EXEC): Likewise.
	(O_SEARCH): Likewise.
	* conform/data/stropts.h-data (ioctl): Likewise.
	* conform/data/sys/ipc.h-data (ipc_perm.mode): Likewise.
	* conform/data/sys/sem.h-data (semid_ds.sem_nsems): Likewise.
	* conform/data/sys/socket.h-data (msghdr.msg_iovlen): Likewise.
	(msghdr.msg_controllen): Likewise.
	(cmsghdr.cmsg_len): Likewise.
	* conform/data/utmpx.h-data (utmpx.ut_tv): Likewise.
	* conform/Makefile (test-xfail-XPG3/sys/ipc.h/conform): Remove
	variable.
	(test-xfail-XPG3/sys/sem.h/conform): Likewise.
	(test-xfail-XPG4/stropts.h/conform): Likewise.
	(test-xfail-XPG4/sys/ipc.h/conform): Likewise.
	(test-xfail-XPG4/sys/sem.h/conform): Likewise.
	(test-xfail-XPG4/sys/socket.h/conform): Likewise.
	(test-xfail-UNIX98/stropts.h/conform): Likewise.
	(test-xfail-UNIX98/sys/ipc.h/conform): Likewise.
	(test-xfail-UNIX98/sys/sem.h/conform): Likewise.
	(test-xfail-UNIX98/sys/socket.h/conform): Likewise.
	(test-xfail-XOPEN2K/stropts.h/conform): Likewise.
	(test-xfail-XOPEN2K/sys/ipc.h/conform): Likewise.
	(test-xfail-XOPEN2K/sys/sem.h/conform): Likewise.
	(test-xfail-XOPEN2K/sys/socket.h/conform): Likewise.
	(test-xfail-XOPEN2K/utmpx.h/conform): Likewise.
	(test-xfail-POSIX2008/fcntl.h/conform): Likewise.
	(test-xfail-POSIX2008/stropts.h/conform): Likewise.
	(test-xfail-XOPEN2K8/fcntl.h/conform): Likewise.
	(test-xfail-XOPEN2K8/stropts.h/conform): Likewise.
	(test-xfail-XOPEN2K8/sys/ipc.h/conform): Likewise.
	(test-xfail-XOPEN2K8/sys/sem.h/conform): Likewise.
	(test-xfail-XOPEN2K8/sys/socket.h/conform): Likewise.
2015-06-19 20:05:41 +00:00
Joseph Myers a7a3c24632 Remove include/bits/ipc.h.
Ten conformtest failures arise from the internal header
include/bits/ipc.h failing to condition internal declarations, outside
the public namespace of headers including bits/ipc.h, on [!_ISOMAC].
As discussed in
<https://sourceware.org/ml/libc-alpha/2015-06/msg00653.html>, the
internal declarations that are actually relevant are in ipc_priv.h and
so include/bits/ipc.h should not be needed at all; this patch removes
it.  (Ten further conformtest failures for other headers including
bits/ipc.h remain because of other conformance issues in those
headers.)

Tested for x86_64 and x86 (testsuite, and that installed stripped
shared libraries are unchanged by the patch).

	* include/bits/ipc.h: Remove file.
	* conform/Makefile (test-xfail-XPG3/sys/msg.h/conform): Remove
	variable.
	(test-xfail-XPG3/sys/shm.h/conform): Likewise.
	(test-xfail-XPG4/sys/msg.h/conform): Likewise.
	(test-xfail-XPG4/sys/shm.h/conform): Likewise.
	(test-xfail-UNIX98/sys/msg.h/conform): Likewise.
	(test-xfail-UNIX98/sys/shm.h/conform): Likewise.
	(test-xfail-XOPEN2K/sys/msg.h/conform): Likewise.
	(test-xfail-XOPEN2K/sys/shm.h/conform): Likewise.
	(test-xfail-XOPEN2K8/sys/msg.h/conform): Likewise.
	(test-xfail-XOPEN2K8/sys/shm.h/conform): Likewise.
2015-06-18 23:08:15 +00:00
Joseph Myers d1ac55d890 Fix netinet/in.h MCAST_* namespace (bug 18558).
sysdeps/unix/sysv/linux/bits/in.h (as included in netinet/in.h, and
via that in netdb.h and arpa/inet.h) defines a series of MCAST_*
macros, both under __USE_MISC and then again unconditionally.  These
are not POSIX macros, nor in any of the namespaces listed in POSIX as
reserved for this header, so should not be defined unconditionally.
This patch duly removes the unconditional definitions, leaving the
ones conditional on __USE_MISC.

Tested for x86_64 and x86 (testsuite, and that installed stripped
shared libraries are unchanged by the patch).

	[BZ #18558]
	* sysdeps/unix/sysv/linux/bits/in.h (MCAST_JOIN_GROUP): Remove
	unconditional definition.
	(MCAST_BLOCK_SOURCE): Likewise.
	(MCAST_UNBLOCK_SOURCE): Likewise.
	(MCAST_LEAVE_GROUP): Likewise.
	(MCAST_JOIN_SOURCE_GROUP): Likewise.
	(MCAST_LEAVE_SOURCE_GROUP): Likewise.
	(MCAST_MSFILTER): Likewise.
	* conform/Makefile (test-xfail-XOPEN2K/arpa/inet.h/conform):
	Remove variable.
	(test-xfail-XOPEN2K/netdb.h/conform): Likewise.
	(test-xfail-XOPEN2K/netinet/in.h/conform): Likewise.
	(test-xfail-XOPEN2K8/arpa/inet.h/conform): Likewise.
	(test-xfail-XOPEN2K8/netdb.h/conform): Likewise.
	(test-xfail-XOPEN2K8/netinet/in.h/conform): Likewise.
2015-06-18 19:48:22 +00:00
Joseph Myers c362135134 Fix nice getpriority, setpriority namespace (bug 18553).
nice (XPG3) calls getpriority and setpriority (in XPG4 but not XPG3,
i.e. UX-shaded in XPG4).  This patch fixes this by making those
functions into weak aliases of __* functions and calling the __*
versions as needed.

Tested for x86_64 and x86 (testsuite, and that disassembly of
installed shared libraries is unchanged by this patch).

This completes cleaning up the unsorted linknamespace test XFAILs.

	[BZ #18553]
	* resource/getpriority.c (getpriority): Rename to __getpriority
	and define as weak alias of __getpriority.
	* resource/setpriority.c (setpriority): Rename to __setpriority
	and define as weak alias of __setpriority.
	* sysdeps/mach/hurd/getpriority.c (getpriority): Rename to
	__getpriority and define as weak alias of __getpriority.
	* sysdeps/mach/hurd/setpriority.c (setpriority): Rename to
	__setpriority and define as weak alias of __setpriority.
	* sysdeps/unix/syscalls.list (getpriority): Use __getpriority as
	strong name.
	(setpriority): Use __setpriority as strong name.
	* sysdeps/unix/sysv/linux/getpriority.c (getpriority): Rename to
	__getpriority and define as weak alias of __getpriority.
	* include/sys/resource.h (__getpriority): Declare.  Use
	libc_hidden_proto.
	(__setpriority): Likewise.
	(getpriority): Don't use libc_hidden_proto.
	(setpriority): Likewise.
	* sysdeps/posix/nice.c (nice): Call __getpriority instead of
	getpriority.  Call __setpriority instead of setpriority.
	* conform/Makefile (test-xfail-XPG3/unistd.h/linknamespace):
	Remove variable.
2015-06-17 20:22:39 +00:00
Joseph Myers abccad04b4 Fix ttyslot namespace (bug 18547).
ttyslot (XPG4) calls the non-XPG4 functions endttyent, getttyent and
setttyent, which in turn bring in references to fgets_unlocked and
getttynam.  This patch fixes this by making these functions into weak
aliases and calling the __* names as needed.

Tested for x86_64 and x86 (testsuite, and that disassembly of
installed stripped shared libraries is unchanged by the patch).

	[BZ #18547]
	* misc/getttyent.c (getttynam): Rename to __getttynam and define
	as weak alias of __getttynam.  Use prototype function definition.
	Call __setttyent, __getttyent and __endttyent instead of
	setttyent, getttyent and endttyent.
	(getttyent): Rename to __getttyent and define as weak alias of
	__getttyent.  Call __setttyent instead of setttyent.  Call
	__fgets_unlocked instead of fgets_unlocked.
	(setttyent): Rename to __setttyent and define as weak alias of
	__setttyent.
	(endttyent): Rename to __endttyent and define as weak alias of
	__endttyent.
	* include/ttyent.h (__getttyent): Declare.  Use libc_hidden_proto.
	(__setttyent): Likewise.
	(__endttyent): Likewise.
	(getttyent): Don't use libc_hidden_proto.
	(setttyent): Likewise.
	(endttyent): Likewise.
	* misc/ttyslot.c (ttyslot): Call __setttyent, __getttyent and
	__endttyent instead of setttyent, getttyent and endttyent.
	* conform/Makefile (test-xfail-XPG4/unistd.h/linknamespace):
	Remove variable.
2015-06-17 20:21:19 +00:00
Joseph Myers 0595c98494 Fix mq_notify socket, recv namespace (bug 18546).
mq_notify (in the 1996 edition of POSIX) brings in references to recv
and socket (not in POSIX until the 2001 edition).  This patch fixes
this by using __recv and __socket, exporting them from libc at version
GLIBC_PRIVATE.

Tested for x86_64 and x86 (testsuite and comparison of installed
stripped shared libraries; PLT / dynamic symbol table changes render
the comparison not particularly useful for libc).

	[BZ #18546]
	* socket/recv.c (__recv): Use libc_hidden_def.
	* socket/socket.c (__socket): Likewise.
	* sysdeps/mach/hurd/recv.c (__recv): Likewise.
	* sysdeps/mach/hurd/socket.c (__socket): Likewise.
	* sysdeps/unix/sysv/linux/generic/recv.c (__recv): Likewise.
	* sysdeps/unix/sysv/linux/recv.c (__recv): Use libc_hidden_weak.
	* sysdeps/unix/sysv/linux/socket.c (__socket): Use
	libc_hidden_def.
	* sysdeps/unix/sysv/linux/x86_64/recv.c (__recv): Use
	libc_hidden_weak.
	* include/sys/socket.h (__socket): Do not use attribute_hidden.
	Use libc_hidden_proto.
	(__recv): Likewise.
	* socket/Versions (libc): Export __recv and __socket at version
	GLIBC_PRIVATE.
	* sysdeps/unix/sysv/linux/mq_notify.c (helper_thread): Call __recv
	instead of recv.
	(init_mq_netlink): Call __socket instead of socket.
	* conform/Makefile (test-xfail-POSIX/mqueue.h/linknamespace):
	Remove variable.
2015-06-17 20:20:08 +00:00
Joseph Myers dfa2d21450 Fix mq_receive, mq_send mq_timed* namespace (bug 18545).
mq_receive calls mq_timedreceive, and mq_send calls mq_timedsend.  But
mq_receive and mq_send were in POSIX by 1996, while mq_timed* were
added in the 2001 edition of POSIX.  This patch fixes this by making
mq_timed* into weak aliases for __mq_timed* and calling the
__mq_timed* names.

Tested for x86_64 and x86 (testsuite, and that disassembly of
installed shared libraries is unchanged by the patch).

	[BZ #18545]
	* rt/mq_timedreceive.c (mq_timedreceive): Rename to
	__mq_timedreceive and define as alias of __mq_timedreceive.  Use
	hidden_weak.
	* rt/mq_timedsend.c (mq_timedsend): Rename to __mq_timedsend and
	define as alias of __mq_timedsend.  Use hidden_weak.
	* sysdeps/unix/sysv/linux/syscalls.list (mq_timedsend): Use
	__mq_timedsend as strong name.
	(mq_timedreceive): Use __mq_timedreceive as strong name.
	* include/mqueue.h (__mq_timedsend): Declare.  Use hidden_proto.
	(__mq_timedreceive): Likewise.
	* sysdeps/unix/sysv/linux/mq_receive.c (mq_receive): Call
	__mq_timedreceive instead of mq_timedreceive.
	* sysdeps/unix/sysv/linux/mq_send.c (mq_send): Call __mq_timedsend
	instead of mq_timedsend.
	* conform/Makefile (test-xfail-UNIX98/mqueue.h/linknamespace):
	Remove variable.
2015-06-17 20:19:04 +00:00
Joseph Myers 45dcd79f6e Fix swscanf vswscanf namespace (bug 18542).
swscanf (added in C90 Amendment 1, present in UNIX98) calls vswscanf
(added in C99, not in C90 Amendment 1 or UNIX98).  This patch fixes
this by using __vswscanf instead and making vswscanf into a weak
alias.

(I intend to add conform/ test support for C90 Amendment 1 - and
various other standard versions supported by glibc but not yet by
conform/ tests - at some point, once the results for currently tested
standards are cleaner.)

Tested for x86_64 and x86 (testsuite, and that installed stripped
shared libraries are unchanged by the patch).

	[BZ #18542]
	* libio/iovswscanf.c (__vswscanf): Use libc_hidden_def.
	(vswscanf): Use ldbl_weak_alias instead of ldbl_strong_alias
	* include/wchar.h (__vswscanf): Declare.  Use libc_hidden_proto.
	* libio/swscanf.c (__swscanf): Call __vswscanf instead of
	vswscanf.
	* conform/Makefile (test-xfail-UNIX98/wchar.h/linknamespace):
	Remove variable.
2015-06-17 20:15:22 +00:00
Joseph Myers eb1fae6a45 Fix getpass fflush_unlocked namespace (bug 18540).
The getpass function (XPG3 / XPG4 / UNIX98) calls fflush_unlocked (not
in any of those standards).  This patch fixes this by making
fflush_unlocked into a weak alias for __fflush_unlocked and calling
__fflush_unlocked from getpass.

Tested for x86_64 and x86 (testsuite, and that disassembly of
installed stripped shared libraries is unchanged by the patch).

	[BZ #18540]
	* libio/iofflush.c [!_IO_MTSAFE_IO] (__fflush_unlocked): Define as
	strong alias of _IO_fflush.  Use libc_hidden_def.
	* libio/iofflush_u.c (fflush_unlocked): Rename to
	__fflush_unlocked and define as weak alias of __fflush_unlocked.
	Use libc_hidden_weak.
	* include/stdio.h (__fflush_unlocked): Declare.  Use
	libc_hidden_proto.
	* misc/getpass.c (getpass): Call __fflush_unlocked instead of
	fflush_unlocked.
	* conform/Makefile (test-xfail-UNIX98/unistd.h/linknamespace):
	Remove variable.
2015-06-17 20:14:18 +00:00
Joseph Myers 68f1ba4ba4 Fix fmtmsg addseverity namespace (bug 18539).
Use of fmtmsg (XSI POSIX) brings in addseverity (non-POSIX).  This
patch fixes this by making addseverity into a weak alias for
__addseverity.

Tested for x86_64 and x86 (testsuite, and that disassembly of
installed shared libraries is unchanged by the patch).

	[BZ #18539]
	* stdlib/fmtmsg.c (addseverity): Rename to __addseverity and
	define as weak alias of __addseverity.
	* conform/Makefile (test-xfail-XPG4/fmtmsg.h/linknamespace):
	Remove variable.
	(test-xfail-UNIX98/fmtmsg.h/linknamespace): Likewise.
	(test-xfail-XOPEN2K/fmtmsg.h/linknamespace): Likewise.
	(test-xfail-XOPEN2K8/fmtmsg.h/linknamespace): Likewise.
2015-06-17 20:13:07 +00:00
Joseph Myers d051b143f7 Fix sem_* tdelete, tfind, tsearch, twalk namespace (bug 18536).
The sem_* functions bring in references to tdelete, tfind, tsearch and
twalk.  But the t* functions are XSI-shaded, while sem_* aren't.  This
patch fixes this by using __t* instead, exporting those functions from
libc at version GLIBC_PRIVATE (since sem_* are in libpthread) and
using libc_hidden_* for the benefit of calls within libc.

Tested for x86_64 and x86 (testsuite, and comparison of disassembly of
installed stripped shared libraries).  libpthread gets changes from
PLT reordering; addresses in libc change because of PLT / dynamic
symbol table changes.

	[BZ #18536]
	* misc/tsearch.c (__tsearch): Use libc_hidden_def.
	(__tfind): Likewise.
	(__tdelete): Likewise.
	(__twalk): Likewise.
	* misc/Versions (libc): Add __tdelete, __tfind, __tsearch and
	__twalk to GLIBC_PRIVATE.
	* include/search.h (__tsearch): Use libc_hidden_proto.
	(__tfind): Likewise.
	(__tdelete): Likewise.
	(__twalk): Likewise.
	* nptl/sem_close.c (sem_close): Call __twalk instead of twalk.
	Call __tdelete instead of tdelete.
	* nptl/sem_open.c (check_add_mapping): Call __tfind instead of
	tfind.  Call __tsearch instead of tsearch.
	* sysdeps/sparc/sparc32/sem_open.c (check_add_mapping): Likewise.
	* conform/Makefile (test-xfail-POSIX/semaphore.h/linknamespace):
	Remove variable.
	(test-xfail-POSIX2008/semaphore.h/linknamespace): Likewise.
2015-06-17 20:11:58 +00:00
Joseph Myers be7dc2b77e Fix syslog dprintf namespace (bug 18534).
syslog functions bring in references to dprintf, which wasn't added to
POSIX until the 2008 edition and so isn't in various standards
containing the syslog functions.  This patch fixes this by making
dprintf into a weak alias of __dprintf and using __dprintf as
appropriate.

Tested for x86_64 and x86 (testsuite, and that installed stripped
shared libraries are unchanged by the patch).

	[BZ #18534]
	* stdio-common/dprintf.c (__dprintf): Use libc_hidden_def.
	(dprintf): Define as a weak alias of __dprintf, not a strong
	alias.
	* include/stdio.h (__dprintf): Declare.  Use libc_hidden_proto.
	* misc/syslog.c (__vsyslog_chk): Call __dprintf instead of
	dprintf.
	* conform/Makefile (test-xfail-XPG4/syslog.h/linknamespace):
	Remove variable.
	(test-xfail-UNIX98/syslog.h/linknamespace): Likewise.
	(test-xfail-XOPEN2K/syslog.h/linknamespace): Likewise.
2015-06-17 20:10:50 +00:00
Joseph Myers a97e5e2557 Fix vsyslog namespace (bug 18533).
syslog functions (in POSIX) bring in the strong symbol vsyslog (not in
POSIX).  This patch fixes this by changing this symbol from a strong
alias to a weak alias.

Tested for x86_64 and x86 (testsuite, and that installed stripped
shared libraries are unchanged by the patch).  (vsyslog becomes weak
in the static libraries, which is what's needed; the particular macro
sequence in use leaves it as strong in the shared libraries, hence
those libraries being completely unchanged, but it doesn't generally
matter whether symbols exported from the shared libraries are weak or
strong.)

	[BZ #18533]
	* misc/syslog.c (vsyslog): Define as a weak alias of __vsyslog,
	not a strong alias.
	* conform/Makefile (test-xfail-XOPEN2K8/syslog.h/linknamespace):
	Remove variable.
2015-06-17 20:09:35 +00:00
Joseph Myers 17c199ee92 Fix gethostbyaddr in6addr_any, in6addr_loopback namespace (bug 18532).
gethostbyaddr brings in references to in6addr_any and thereby
in6addr_loopback, which aren't in all the standards containing
gethostbyaddr (gethostbyaddr is in XPG4 and UNIX98, in6addr_any and
in6addr_loopback are new in POSIX.1:2001).  This patch fixes this by
making those symbols into weak aliases (safe in this case, unlike for
most data symbols, because these data symbols are const).

Tested for x86_64 and x86 (testsuite, and comparison of disassembly of
installed stripped shared libraries).  Disassembly is unchanged for
x86_64; for x86, I see some changes of stack offsets, but no other
code generation changes or code size differences.

	[BZ #18532]
	* inet/in6_addr.c (in6addr_any): Rename to __in6addr_any and
	define as weak alias of __in6addr_any.  Use libc_hidden_data_weak.
	(in6addr_loopback): Rename to __in6addr_loopback and define as
	weak alias of __in6addr_loopback.  Use libc_hidden_data_weak.
	* include/netinet/in.h (__in6addr_loopback): Declare.  Use
	libc_hidden_proto.
	(__in6addr_any): Likewise.
	* inet/gethstbyad_r.c (PREPROCESS): Use __in6addr_any instead of
	in6addr_any.
	* conform/Makefile (test-xfail-XPG4/netdb.h/linknamespace): Remove
	variable.
	(test-xfail-UNIX98/netdb.h/linknamespace): Likewise.
2015-06-17 20:08:22 +00:00
Joseph Myers bf1435783d Fix linknamespace expectations for in6addr_any, in6addr_loopback.
Some linknamespace test failures turned out to be because the
variables in6addr_any and in6addr_loopback weren't listed in the lists
of extra reserved symbols for the relevant standards (only functions
are handled automatically through -aux-info, data symbols need listing
manually in list-header-symbols.pl).  This patch duly adds those
symbols to those lists (there are still failures for older standards
because of references to those symbols being brought in for standards
that didn't reserve them: bug 18532, to be fixed separately).

Tested for x86_64.

	* conform/list-header-symbols.pl (%extra_syms): Add in6addr_any
	and in6addr_loopback for XOPEN2K, XOPEN2K8 and POSIX2008.
	* conform/Makefile (test-xfail-XOPEN2K/netdb.h/linknamespace):
	Remove variable.
	(test-xfail-POSIX2008/netdb.h/linknamespace): Likewise.
	(test-xfail-XOPEN2K8/netdb.h/linknamespace): Likewise.
2015-06-14 14:32:07 +00:00
Joseph Myers 8737be8064 Fix netdb.h addrinfo namespace (bug 18529).
netdb.h declares interfaces such as getaddrinfo if __USE_POSIX,
i.e. POSIX.1:1990 or later.  However, these interfaces were new in the
2001 edition of POSIX, although the header was in XPG4 and UNIX98, so
they should not be declared for XPG4 or UNIX98.  (This produces
spurious linknamespace test failures, although there are other
failures for this header as well for the same standards so this patch
doesn't remove any XFAILs.)  This patch corrects the condition, and
the conform/ test expectations which were similarly wrong.

Tested for x86_64 and x86 (testsuite, and that installed stripped
shared libraries are unchanged by the patch).

	[BZ #18529]
	* resolv/netdb.h [__USE_POSIX]: Change condition to
	[__USE_XOPEN2K].
	* conform/data/netdb.h-data [XPG4 || UNIX98] (struct addrinfo): Do
	not expect.
	[XPG4 || UNIX98] (AI_PASSIVE): Likewise.
	[XPG4 || UNIX98] (AI_CANONNAME): Likewise.
	[XPG4 || UNIX98] (AI_NUMERICHOST): Likewise.
	[XPG4 || UNIX98] (AI_V4MAPPED): Likewise.
	[XPG4 || UNIX98] (AI_ALL): Likewise.
	[XPG4 || UNIX98] (AI_ADDRCONFIG): Likewise.
	[XPG4 || UNIX98] (AI_NUMERICSERV): Likewise.
	[XPG4 || UNIX98] (NI_NOFQDN): Likewise.
	[XPG4 || UNIX98] (NI_NUMERICHOST): Likewise.
	[XPG4 || UNIX98] (NI_NAMEREQD): Likewise.
	[XPG4 || UNIX98] (NI_NUMERICSERV): Likewise.
	[XPG4 || UNIX98] (NI_DGRAM): Likewise.
	[XPG4 || UNIX98] (EAI_AGAIN): Likewise.
	[XPG4 || UNIX98] (EAI_BADFLAGS): Likewise.
	[XPG4 || UNIX98] (EAI_FAIL): Likewise.
	[XPG4 || UNIX98] (EAI_FAMILY): Likewise.
	[XPG4 || UNIX98] (EAI_MEMORY): Likewise.
	[XPG4 || UNIX98] (EAI_NONAME): Likewise.
	[XPG4 || UNIX98] (EAI_SERVICE): Likewise.
	[XPG4 || UNIX98] (EAI_SOCKTYPE): Likewise.
	[XPG4 || UNIX98] (EAI_SYSTEM): Likewise.
	[XPG4 || UNIX98] (EAI_SYSTEM): Likewise.
	[XPG4 || UNIX98] (freeaddrinfo): Likewise.
	[XPG4 || UNIX98] (gai_strerror): Likewise.
	[XPG4 || UNIX98] (getaddrinfo): Likewise.
	[XPG4 || UNIX98] (getnameinfo): Likewise.
2015-06-12 22:35:07 +00:00
Joseph Myers b400fdefc7 Fix grp.h endgrent, getgrent namespace (bug 18528).
grp.h declares endgrent and getgrent if __USE_XOPEN2K8 (i.e. 2008
edition of POSIX, non-XSI).  However, the 2013 Technical Corrigendum
corrected the grp.h specification to XSI-shade these functions as in
previous editions (see <http://austingroupbugs.net/view.php?id=24>),
so they should not be declared for non-XSI POSIX.  This patch corrects
the conditions - using __USE_MISC || __USE_XOPEN_EXTENDED to match
setgrent - and the conform/ test expectations for this header, thereby
fixing the conform tests for this header for XPG3 (where the
expectations were wrong) and the linknamespace tests for it for
POSIX2008 (where the header bug meant it was wrongly considered a
problem for endgrent to bring in a reference to setgrent).

Tested for x86_64 and x86 (testsuite, and that installed stripped
shared libraries are unchanged by the patch).

	[BZ #18528]
	* grp/grp.h (endgrent): Condition on [__USE_MISC ||
	__USE_XOPEN_EXTENDED], not [__USE_XOPEN_EXTENDED ||
	__USE_XOPEN2K8].
	(getgrent): Likewise.
	* conform/data/grp.h-data [XPG3 || POSIX2008] (getgrent): Do not
	expect.
	[XPG3 || POSIX2008] (endgrent): Likewise.
	[XPG3] (setgrent): Likewise.
	* conform/Makefile (test-xfail-XPG3/grp.h/conform): Remove
	variable.
	(test-xfail-POSIX2008/grp.h/linknamespace): Likewise.
2015-06-12 22:29:19 +00:00
Joseph Myers 5371d99e87 Fix getlogin_r namespace (bug 18527).
Various functions in XPG4 bring in references to getlogin_r, which is
not in XPG4; this is also a bug for some older POSIX versions which
aren't yet covered by the linknamespace tests.  This patch fixes this
by making getlogin_r into a weak alias for __getlogin_r and using
__getlogin_r as needed.

Tested for x86_64 and x86 (testsuite, and that disassembly of
installed stripped shared libraries is unchanged by the patch).

	[BZ #18527]
	* login/getlogin_r.c (getlogin_r): Rename to __getlogin_r and
	define as weak alias of __getlogin_r.  Use libc_hidden_weak.
	* sysdeps/mach/hurd/getlogin_r.c (getlogin_r): Likewise.
	* sysdeps/unix/getlogin_r.c (getlogin_r): Likewise.
	* sysdeps/unix/sysv/linux/getlogin_r.c (getlogin_r): Likewise.
	* include/unistd.h (__getlogin_r): Declare.  Use
	libc_hidden_proto.
	* posix/glob.c (glob): Call __getlogin_r instead of getlogin_r.
	* conform/Makefile (test-xfail-XPG3/glob.h/linknamespace): Remove
	variable.
	(test-xfail-XPG3/wordexp.h/linknamespace): Likewise.
	(test-xfail-XPG4/glob.h/linknamespace): Likewise.
	(test-xfail-XPG4/wordexp.h/linknamespace): Likewise.
2015-06-12 20:02:30 +00:00
Joseph Myers 9714012ca0 Fix aio_* pread namespace (bug 18519).
aio_* bring in references to pread, which isn't in all the standards
containing aio_* (as a reference from one library to another, this is
a bug for dynamic as well as static linking).  This patch fixes this
by using __libc_pread instead, exporting that function from libc at
symbol version GLIBC_PRIVATE; the code, with conditionals that may
call either __pread64 or __libc_pread, becomes exactly analogous to
that elsewhere in the same file that may call either __pwrite64 or
__libc_pwrite.

Tested for x86_64 and x86 (testsuite, and comparison of disassembly of
installed shared libraries).  libc changes because of the PLT entry
for the newly exported __libc_pread; librt changes because of
assertion line numbers and PLT rearrangement; other stripped installed
shared libraries do not change.

	[BZ #18519]
	* posix/Versions (libc): Export __libc_pread at version
	GLIBC_PRIVATE.
	* sysdeps/pthread/aio_misc.c (handle_fildes_io): Call __libc_pread
	instead of pread.
	* conform/Makefile (test-xfail-POSIX/aio.h/linknamespace): Remove
	variable.
2015-06-12 17:34:11 +00:00
Joseph Myers 498c1f6a7c Fix ecvt_r, fcvt_r namespace (bug 18522).
The functions ecvt, fcvt and gcvt, in some standards, bring in
references to ecvt_r and fcvt_r, which aren't in any of those
standards.  The calls are correctly to __ecvt_r and __fcvt_r, but then
the names ecvt_r and fcvt_r are defined as strong aliases; this patch
changes them to weak aliases.

Tested for x86_64 and x86 (testsuite, and that disassembly of
installed stripped shared libraries is unchanged by the patch).

	[BZ #18522]
	* misc/efgcvt_r.c
	[LONG_DOUBLE_COMPAT (libc, GLIBC_2_0) && !LONG_DOUBLE_CVT]
	(cvt_symbol): Use weak_alias instead of strong_alias.
	[LONG_DOUBLE_COMPAT (libc, GLIBC_2_0)] (cvt_symbol): Likewise.
	* conform/Makefile (test-xfail-XPG4/stdlib.h/linknamespace):
	Remove variable.
	(test-xfail-UNIX98/stdlib.h/linknamespace): Likewise.
	(test-xfail-XOPEN2K/stdlib.h/linknamespace): Likewise.
2015-06-12 10:11:35 +00:00
Joseph Myers 9acacaa02f Fix h_errno namespace (bug 18520).
The 2008 edition of POSIX removed h_errno, but some functions still
bring in references to the h_errno external symbol.  As this symbol is
not a part of the public ABI (only __h_errno_location is), this patch
fixes this by renaming the GLIBC_PRIVATE TLS symbol to __h_errno.

Tested for x86_64 and x86 (testsuite, and comparison of installed
shared libraries).  Disassembly of all shared libraries using h_errno
changes because of the renaming (and changes to associated TLS / GOT
offsets in some cases); disassembly of libpthread on x86_64 changes
more substantially because the enlargement of .dynsym affects
subsequent addresses.

	[BZ #18520]
	* inet/herrno.c (h_errno): Rename to __h_errno.
	(__libc_h_errno): Define as alias of __h_errno not h_errno.
	* include/netdb.h [IS_IN_LIB && !IS_IN (libc)] (h_errno): Define
	to __h_errno instead of h_errno.
	* nptl/herrno.c (h_errno): Rename to __h_errno.
	(__h_errno_location): Refer to __h_errno not h_errno.
	* resolv/Versions (h_errno): Rename to __h_errno.
	* conform/Makefile (test-xfail-XOPEN2K8/grp.h/linknamespace):
	Remove variable.
	(test-xfail-XOPEN2K8/pwd.h/linknamespace): Likewise.
2015-06-12 10:10:18 +00:00
Joseph Myers 2f44ee08db Fix regcomp wcscoll, wcscmp namespace (bug 18497).
regcomp brings in references to wcscoll, which isn't in all the
standards that contain regcomp.  In turn, wcscoll brings in references
to wcscmp, also not in all those standards.  This patch fixes this by
making those functions into weak aliases of __wcscoll and __wcscmp and
calling those names instead as needed.

Tested for x86_64 and x86 (testsuite, and that disassembly of
installed shared libraries is unchanged by the patch).

	[BZ #18497]
	* wcsmbs/wcscmp.c [!WCSCMP] (WCSCMP): Define as __wcscmp instead
	of wcscmp.
	(wcscmp): Define as weak alias of WCSCMP.
	* wcsmbs/wcscoll.c (STRCOLL): Define as __wcscoll instead of
	wcscoll.
	(USE_HIDDEN_DEF): Define.
	[!USE_IN_EXTENDED_LOCALE_MODEL] (wcscoll): Define as weak alias of
	__wcscoll.  Don't use libc_hidden_weak.
	* wcsmbs/wcscoll_l.c (STRCMP): Define as __wcscmp instead of
	wcscmp.
	* sysdeps/i386/i686/multiarch/wcscmp-c.c
	[SHARED] (libc_hidden_def): Define __GI___wcscmp instead of
	__GI_wcscmp.
	(weak_alias): Undefine and redefine.
	* sysdeps/i386/i686/multiarch/wcscmp.S (wcscmp): Rename to
	__wcscmp and define as weak alias of __wcscmp.
	* sysdeps/x86_64/wcscmp.S (wcscmp): Likewise.
	* include/wchar.h (__wcscmp): Declare.  Use libc_hidden_proto.
	(__wcscoll): Likewise.
	(wcscmp): Don't use libc_hidden_proto.
	(wcscoll): Likewise.
	* posix/regcomp.c (build_range_exp): Call __wcscoll instead of
	wcscoll.
	* posix/regexec.c (check_node_accept_bytes): Likewise.
	* conform/Makefile (test-xfail-XPG3/regex.h/linknamespace): Remove
	variable.
	(test-xfail-XPG4/regex.h/linknamespace): Likewise.
	(test-xfail-POSIX/regex.h/linknamespace): Likewise.
2015-06-09 21:07:30 +00:00
Joseph Myers d3ab671c94 Fix pathconf statvfs namespace (bug 18507).
pathconf uses __statvfs64, and fpathconf uses __fstatvfs64.  On
systems using sysdeps/unix/sysv/linux/wordsize-64, __statvfs64 then
brings in the strong symbol statvfs, and __fstatvfs64 brings in the
strong symbol fstatvfs, which are not in all the standards that have
pathconf and fpathconf.  This patch fixes this by making those symbols
into weak aliases.

Tested for x86_64 and x86 (testsuite, and that disassembly of
installed shared libraries is unchanged by the patch).

	[BZ #18507]
	* sysdeps/unix/sysv/linux/fstatvfs.c (fstatvfs): Rename to
	__fstatvfs and define as weak alias of __fstatvfs.  Use
	libc_hidden_weak.
	* sysdeps/unix/sysv/linux/statvfs.c (statvs): Rename to __statvfs
	and define as weak alias of __statvfs.  Use libc_hidden_weak.
	* sysdeps/unix/sysv/linux/wordsize-64/fstatvfs.c (__fstatvfs64):
	Define as alias of __fstatvfs, not fstatvfs.
	(fstatvfs64): Likewise.
	* sysdeps/unix/sysv/linux/wordsize-64/statvfs.c (__statvfs64):
	Define as alias of __statvfs, not statvfs.
	(statvfs64): Likewise.
	* conform/Makefile (test-xfail-POSIX/unistd.h/linknamespace):
	Remove variable.
2015-06-09 19:52:01 +00:00
Joseph Myers 711f67a789 Fix open_memstream namespace (bug 18498).
open_memstream is new in the 2008 edition of POSIX.  However, the
older functions getopt, closelog and fmtmsg all bring in references to
it.  This patch fixes this in the usual way, making open_memstream
into a weak alias of __open_memstream and calling __open_memstream
from the relevant places.

Tested for x86_64 and x86 (testsuite, and that disassembly of
installed shared libraries is unchanged by the patch).  32-bit builds
produce an XPASS for conform/POSIX/unistd.h/linknamespace after this
patch (because the only cause of failure left there now is 64-bit
specific); that will disappear once the 64-bit failure is resolved and
the XFAIL removed at that time.

	[BZ #18498]
	* libio/memstream.c (open_memstream): Rename to __open_memstream
	and define as weak alias of __open_memstream.
	* include/stdio.h (__open_memstream): Declare.  Use
	libc_hidden_proto.
	(open_memstream): Don't use libc_hidden_proto.
	* misc/syslog.c (__vsyslog_chk): Call __open_memstream instead of
	open_memstream.
	* posix/getopt.c (_getopt_internal_r): Likewise.
	* conform/Makefile (test-xfail-XPG3/stdio.h/linknamespace): Remove
	variable.
	(test-xfail-XPG4/stdio.h/linknamespace): Likewise.
	(test-xfail-UNIX98/stdio.h/linknamespace): Likewise.
	(test-xfail-XOPEN2K/unistd.h/linknamespace): Likewise.
2015-06-05 23:32:46 +00:00
Joseph Myers 007f2dd122 Fix psignal, psiginfo declaration conditions (bug 18483).
signal.h declares psignal and psiginfo if __USE_XOPEN2K - that is, for
the 2001 edition of POSIX.  These functions were actually added in the
2008 edition (as indicated in the header comments).  This patch fixes
the header conditionals.  This fixes some linknamespace test failures
because psiginfo uses fmemopen, which is also new in the 2008 edition,
so before the header fix this appeared to the linknamespace tests as a
2001 function bringing in references to a 2008 function.  The problem
also appeared in conformtest header namespace test results (the
conformtest data has correct conditionals for when these functions
should be visible), but the affected headers still have other
namespace problems so this doesn't fix any of those XFAILs.

Tested for x86_64 and x86 (testsuite, and that installed stripped
shared libraries are unchanged by the patch).

	[BZ #18483]
	* signal/signal.h [__USE_XOPEN2K] (psignal): Change condition to
	[__USE_XOPEN2K8].  Remove redundant #endif.
	[__USE_XOPEN2K] (psiginfo): Change condition to [__USE_XOPEN2K8].
	Remove redundant #if.
	* conform/Makefile (test-xfail-XOPEN2K/signal.h/linknamespace):
	Remove variable.
	(test-xfail-XOPEN2K/sys/wait.h/linknamespace): Likewise.
	(test-xfail-XOPEN2K/ucontext.h/linknamespace): Likewise.
2015-06-05 21:14:16 +00:00
Joseph Myers f014e87eff Fix fnmatch strnlen namespace (bug 18470).
fnmatch brings in references to strnlen, which isn't in all the
standards that contain fnmatch (not added until the 2008 edition of
POSIX), resulting in linknamespace test failures.  (This is contrary
to glibc conventions, rather than a standards conformance issue,
because of the str* reservation.)  This patch fixes this in the usual
way, using __strnlen instead of strnlen.

Tested for x86_64 and x86 (testsuite, and that installed stripped
shared libraries are unchanged by the patch).

	[BZ #18470]
	* posix/fnmatch.c (fnmatch) [_LIBC]: Call __strnlen instead of
	strnlen.
	* conform/Makefile (test-xfail-XPG3/fnmatch.h/linknamespace):
	Remove variable.
	(test-xfail-XPG4/fnmatch.h/linknamespace): Likewise.
	(test-xfail-POSIX/fnmatch.h/linknamespace): Likewise.
	(test-xfail-POSIX/glob.h/linknamespace): Likewise.
	(test-xfail-POSIX/wordexp.h/linknamespace): Likewise.
	(test-xfail-UNIX98/fnmatch.h/linknamespace): Likewise.
	(test-xfail-UNIX98/glob.h/linknamespace): Likewise.
	(test-xfail-UNIX98/wordexp.h/linknamespace): Likewise.
	(test-xfail-XOPEN2K/fnmatch.h/linknamespace): Likewise.
	(test-xfail-XOPEN2K/glob.h/linknamespace): Likewise.
	(test-xfail-XOPEN2K/wordexp.h/linknamespace): Likewise.
2015-06-03 13:58:58 +00:00
Szabolcs Nagy a06b40cdf5 struct stat is not posix conform
On 21/05/15 05:29, Siddhesh Poyarekar wrote:
> On Wed, May 20, 2015 at 06:55:02PM +0100, Szabolcs Nagy wrote:
>> i guess it's ok for consistency if i fix struct stat64
>> too to use __USE_XOPEN2K8.
>>
>> i will run some tests and come back with a patch
>
> I also think it would be appropriate to change this code in other
> architectures (microblaze and nacl IIRC) to make all of them
> consistent.  It is a mechanical enough change IMO that all arch
> maintainer acks is not necessary.
>

here is the patch with consistent __USE_XOPEN2K8

ok to commit?

2015-05-21  Szabolcs Nagy  <szabolcs.nagy@arm.com>

	[BZ #18234]
	* conform/data/sys/stat.h-data (struct stat): Add tests for st_atim,
	st_mtim and st_ctim members.

	* sysdeps/nacl/bits/stat.h (struct stat, struct stat64): Make
	st_atim, st_ctim, st_mtim visible under __USE_XOPEN2K8 only.

	* sysdeps/unix/sysv/linux/generic/bits/stat.h (struct stat,):
	(struct stat64): Likewise.

	* sysdeps/unix/sysv/linux/ia64/bits/stat.h (struct stat,):
	(struct stat64): Likewise.

	* sysdeps/unix/sysv/linux/microblaze/bits/stat.h (struct stat,):
	(struct stat64): Likewise.
2015-05-26 22:27:24 +05:30
Joseph Myers 4e5f9259f3 Restore _POSIX2_C_VERSION definition (bug 438).
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.
2015-05-22 17:14:04 +00:00
Joseph Myers cf06a4e357 Fix pathconf basename namespace (bug 18444).
pathconf (sysdeps/unix/sysv/linux/pathconf.c) uses basename.  But
pathconf is in POSIX back to 1990 while basename is only reserved with
external linkage in those standards including XPG functions.  This
patch fixes this namespace issue in the usual way, renaming basename
to __basename and making it into a weak alias.

Tested for x86_64 and x86 (testsuite, and that disassembly of
installed shared libraries is unchanged by the patch).

	[BZ #18444]
	* string/basename.c (basename): Rename to __basename and define as
	weak alias of __basename.  Use libc_hidden_weak.
	* include/string.h (__basename): Declare.  Use libc_hidden_proto.
	* sysdeps/unix/sysv/linux/pathconf.c (distinguish_extX): Call
	__basename instead of basename.
	* conform/Makefile (test-xfail-POSIX2008/unistd.h/linknamespace):
	Remove variable.
	(test-xfail-XOPEN2K8/unistd.h/linknamespace): Likewise.
2015-05-22 17:09:36 +00:00
Joseph Myers 9d12d7652b linknamespace: whitelist re_syntax_options.
This patch adds re_syntax_options (bug 18442) to the set of symbols
that are whitelisted in the linknamespace tests because, while the
references to them are genuine bugs that should be fixed, the
involvement of data symbols makes them harder to fix than most such
bugs.

Tested for x86_64 and x86.

	* conform/linknamespace.pl (@whitelist): Add re_syntax_options.
	* conform/Makefile (test-xfail-UNIX98/regex.h/linknamespace):
	Remove variable.
	(test-xfail-XOPEN2K/regex.h/linknamespace): Likewise.
	(test-xfail-POSIX2008/regex.h/linknamespace): Likewise.
	(test-xfail-XOPEN2K8/regex.h/linknamespace): Likewise.
2015-05-21 16:24:24 +00:00
Joseph Myers f58573781c conformtest: use proper _POSIX_C_SOURCE value for POSIX.
The conform/ tests were using -D_POSIX_C_SOURCE=199912 to test "POSIX"
(1995/6).  This patch changes them to use 199506L, the proper value
from the relevant edition of POSIX.  (This doesn't make any difference
to features.h, but is the logically correct value to use.)  Tested for
x86_64.

	* conform/GlibcConform.pm ($CFLAGS{"POSIX"}): Use
	-D_POSIX_C_SOURCE=199506L.
2015-05-20 23:14:53 +00:00
Joseph Myers 38d3d5b7bd conformtest: correct POSIX expectations for locale.h.
When cleaning up conformtest expectations for POSIX for locale.h in
<https://sourceware.org/ml/libc-alpha/2012-11/msg00382.html>, I missed
that locale.h had contents defined in POSIX.2:1993 as well as
POSIX.1:1995/6.  Thus, LC_MESSAGES *should* in fact be required for
POSIX, because POSIX.2 says so; this patch adds that expectation
back.  Tested for x86_64.

	* conform/data/locale.h-data [POSIX] (LC_MESSAGES): Require.
2015-05-20 22:56:27 +00:00
Joseph Myers be8b8f1768 conformtest: clean up POSIX expectations for unistd.h.
Concluding the series of patches to clean up conformtest expectations
for "POSIX" (POSIX.1:1995/6, union with POSIX.2:1993), this patch
cleans up expectations for unistd.h.  Tested x86_64; the new XFAIL is
for missing _POSIX2_C_VERSION.

	* conform/data/unistd.h-data (_POSIX_VERSION): Require.
	(_POSIX2_C_VERSION): Require if [POSIX || XPG3 || XPG4 || UNIX98].
	Do not mention otherwise.
	[POSIX] (_XOPEN_VERSION): Do not expect.
	[POSIX] (_XOPEN_XCU_VERSION): Likewise.
	[POSIX] (_POSIX2_C_BIND): Likewise.
	[POSIX] (_POSIX2_VERSION): Likewise.
	[POSIX] (_XOPEN_XPG2): Likewise.
	[POSIX] (_XOPEN_XPG3): Likewise.
	[POSIX] (_XOPEN_XPG4): Likewise.
	[POSIX] (_XOPEN_UNIX): Likewise.
	[POSIX] (_POSIX_ADVISORY_INFO): Likewise.
	[POSIX] (_POSIX_BARRIERS): Likewise.
	[POSIX] (_POSIX_CLOCK_SELECTION): Likewise.
	[POSIX] (_POSIX_CPUTIME): Likewise.
	[POSIX] (_POSIX_MONOTONIC_CLOCK): Likewise.
	[POSIX] (_POSIX_READER_WRITER_LOCKS): Likewise.
	[POSIX] (_POSIX_SHELL): Likewise.
	[POSIX] (_POSIX_SPAWN): Likewise.
	[POSIX] (_POSIX_SPIN_LOCKS): Likewise.
	[POSIX] (_POSIX_SPORADIC_SERVER): Likewise.
	[POSIX] (_POSIX_THREAD_CPUTIME): Likewise.
	[POSIX] (_POSIX_TYPED_MEMORY_OBJECTS): Likewise.
	[POSIX] (_POSIX_THREAD_SPORADIC_SERVER): Likewise.
	[POSIX] (_XBS5_ILP32_OFF32): Likewise.
	[POSIX] (_XBS5_ILP32_OFBIG): Likewise.
	[POSIX] (_XBS5_LP64_OFF64): Likewise.
	[POSIX] (_XBS5_LPBIG_OFFBIG): Likewise.
	[POSIX] (_POSIX_TIMEOUTS): Likewise.
	[POSIX] (_POSIX2_PBS): Likewise.
	[POSIX] (_POSIX2_PBS_ACCOUNTING): Likewise.
	[POSIX] (_POSIX2_PBS_CHECKPOINT): Likewise.
	[POSIX] (_POSIX2_PBS_LOCATE): Likewise.
	[POSIX] (_POSIX2_PBS_MESSAGE): Likewise.
	[POSIX] (_POSIX2_PBS_TRACK): Likewise.
	[POSIX] (_POSIX_TIMESTAMP_RESOLUTION): Likewise.
	[POSIX] (_CS_XBS5_ILP32_OFF32_CFLAGS): Likewise.
	[POSIX] (_CS_XBS5_ILP32_OFF32_LDFLAGS): Likewise.
	[POSIX] (_CS_XBS5_ILP32_OFF32_LIBS): Likewise.
	[POSIX] (_CS_XBS5_ILP32_OFF32_LINTFLAGS): Likewise.
	[POSIX] (_CS_XBS5_ILP32_OFFBIG_CFLAGS): Likewise.
	[POSIX] (_CS_XBS5_ILP32_OFFBIG_LDFLAGS): Likewise.
	[POSIX] (_CS_XBS5_ILP32_OFFBIG_LIBS): Likewise.
	[POSIX] (_CS_XBS5_ILP32_OFFBIG_LINTFLAGS): Likewise.
	[POSIX] (_CS_XBS5_LP64_OFF64_CFLAGS): Likewise.
	[POSIX] (_CS_XBS5_LP64_OFF64_LDFLAGS): Likewise.
	[POSIX] (_CS_XBS5_LP64_OFF64_LIBS): Likewise.
	[POSIX] (_CS_XBS5_LP64_OFF64_LINTFLAGS): Likewise.
	[POSIX] (_CS_XBS5_LPBIG_OFFBIG_CFLAGS): Likewise.
	[POSIX] (_CS_XBS5_LPBIG_OFFBIG_LDFLAGS): Likewise.
	[POSIX] (_CS_XBS5_LPBIG_OFFBIG_LIBS): Likewise.
	[POSIX] (_CS_XBS5_LPBIG_OFFBIG_LINTFLAGS): Likewise.
	[POSIX] (_SC_2_C_BIND): Likewise.
	[POSIX] (_SC_2_C_VERSION): Likewise.
	[POSIX] (_SC_2_PBS): Likewise.
	[POSIX] (_SC_2_PBS_ACCOUNTING): Likewise.
	[POSIX] (_SC_2_PBS_CHECKPOINT): Likewise.
	[POSIX] (_SC_2_PBS_LOCATE): Likewise.
	[POSIX] (_SC_2_PBS_MESSAGE): Likewise.
	[POSIX] (_SC_2_PBS_TRACK): Likewise.
	[POSIX] (_SC_ATEXIT_MAX): Likewise.
	[POSIX] (_SC_BARRIERS): Likewise.
	[POSIX] (_SC_BASE): Likewise.
	[POSIX] (_SC_CLOCK_SELECTION): Likewise.
	[POSIX] (_SC_DEVICE_IO): Likewise.
	[POSIX] (_SC_DEVICE_SPECIFIC): Likewise.
	[POSIX] (_SC_DEVICE_SPECIFIC_R): Likewise.
	[POSIX] (_SC_FD_MGMT): Likewise.
	[POSIX] (_SC_FIFO): Likewise.
	[POSIX] (_SC_FILE_ATTRIBUTES): Likewise.
	[POSIX] (_SC_FILE_LOCKING): Likewise.
	[POSIX] (_SC_FILE_SYSTEM): Likewise.
	[POSIX] (_SC_IOV_MAX): Likewise.
	[POSIX] (_SC_MONOTONIC_CLOCK): Likewise.
	[POSIX] (_SC_NETWORKING): Likewise.
	[POSIX] (_SC_PAGE_SIZE): Likewise.
	[POSIX] (_SC_PASS_MAX): Likewise.
	[POSIX] (_SC_PIPE): Likewise.
	[POSIX] (_SC_READER_WRITER_LOCKS): Likewise.
	[POSIX] (_SC_REGEXP): Likewise.
	[POSIX] (_SC_SHELL): Likewise.
	[POSIX] (_SC_SIGNALS): Likewise.
	[POSIX] (_SC_SINGLE_PROCESS): Likewise.
	[POSIX] (_SC_SPIN_LOCKS): Likewise.
	[POSIX] (_SC_TYPED_MEMORY_OBJECTS): Likewise.
	[POSIX] (_SC_USER_GROUPS): Likewise.
	[POSIX] (_SC_USER_GROUPS_R): Likewise.
	[POSIX] (_SC_STREAMS): Likewise.
	[POSIX] (_SC_XBS5_ILP32_OFF32): Likewise.
	[POSIX] (_SC_XBS5_ILP32_OFFBIG): Likewise.
	[POSIX] (_SC_XBS5_LP64_OFF64): Likewise.
	[POSIX] (_SC_XBS5_LPBIG_OFFBIG): Likewise.
	[POSIX] (_SC_THREAD_ROBUST_PRIO_INHERIT): Likewise.
	[POSIX] (_SC_THREAD_ROBUST_PRIO_PROTECT): Likewise.
	[POSIX] (_PC_FILESIZEBITS): Likewise.
	[POSIX] (_PC_REC_INCR_XFER_SIZE): Likewise.
	[POSIX] (_PC_REC_MAX_XFER_SIZE): Likewise.
	[POSIX] (_PC_REC_MIN_XFER_SIZE): Likewise.
	[POSIX] (_PC_REC_XFER_ALIGN): Likewise.
	[POSIX] (uid_t): Likewise.
	[POSIX] (gid_t): Likewise.
	[POSIX] (off_t): Likewise.
	[POSIX] (pid_t): Likewise.
	[POSIX] (cuserid): Allow.
	(_SC_2_CHAR_TERM): Require constant.
	(_POSIX_ASYNCHRONOUS_IO): Remove duplicate optional-constant.
	* conform/Makefile (test-xfail-POSIX/unistd.h/conform): New
	variable.
2015-05-20 22:47:03 +00:00
Joseph Myers 8e65ea4dc0 Fix linknamespace test handling of architecture-specific st_other.
For mips16, some of the linknamespace tests were failing because
[MIPS16] annotations in readelf output were wrongly interpreted as
falling in the symbol index field, meaning symbol index values were
wrongly interpreted as symbol names and such names as 1 and 2 then
resulted in namespace test failures.

This patch fixes this by removing the annotations for such
architecture-specific st_other bits before splitting the readelf
output into fields.  Tested for x86_64 and mips16.

	* conform/linknamespace.pl (list_syms): Remove \[.*?\] before
	splitting into fields.
2015-05-12 17:09:49 +00:00
Joseph Myers 40176158f1 Fix scandir scandirat namespace (bug 17999).
The POSIX function scandir calls scandirat, which is not a POSIX
function.  This patch fixes this by making it use __scandirat and
making scandirat a weak alias.  There are no changes for scandir64 /
scandirat64 because those are both _GNU_SOURCE-only functions so no
namespace issue arises for them.

Tested for x86_64 that the disassembly of installed shared libraries
is unchanged by this patch.

	[BZ #17999]
	* dirent/scandir.c [!SCANDIR] (SCANDIRAT): Define to __scandirat
	instead of scandirat.
	* dirent/scandirat.c [!SCANDIRAT] (SCANDIRAT): Likewise.
	[!SCANDIRAT] (SCANDIRAT_WEAK_ALIAS): Define.
	[SCANDIRAT_WEAK_ALIAS] (scandirat): Define as weak alias of
	__scandirat.
	* include/dirent.h (scandirat): Do not use libc_hidden_proto.
	(__scandirat): Declare.  Use libc_hidden_proto.
	* conform/Makefile (test-xfail-POSIX2008/dirent.h/linknamespace):
	Remove variable.
	(test-xfail-XOPEN2K8/dirent.h/linknamespace): Likewise.
2015-02-19 17:18:51 +00:00
Joseph Myers 4ffb177155 Fix search.h namespace (bug 17996).
The implementation of the (XSI POSIX) functions hsearch / hcreate /
hdestroy uses hsearch_r / hcreate_r / hdestroy_r, which are not POSIX
functions.  This patch makes those into weak aliases for __*_r and
uses those names for the calls within libc.

Tested for x86_64 that the disassembly of installed shared libraries
is unchanged by this patch.

	[BZ #17996]
	* include/search.h (hcreate_r): Don't use libc_hidden_proto.
	(hdestroy_r): Likewise.
	(hsearch_r): Likewise.
	(__hcreate_r): Declare and use libc_hidden_proto.
	(__hdestroy_r): Likewise.
	(__hsearch_r): Likewise.
	* misc/hsearch.c (hsearch): Call __hsearch_r instead of hsearch_r.
	(hcreate): Call __hcreate_r instead of hcreate_r.
	(__hdestroy): Call __hdestroy_r instead of hdestroy_r.
	* misc/hsearch_r.c (hcreate_r): Rename to __hcreate_r and define
	as weak alias of __hcreate_r.
	(hdestroy_r): Rename to __hdestroy_r and define as weak alias of
	__hdestroy_r.
	(hsearch_r): Rename to __hsearch_r and define as weak alias of
	__hsearch_r.
	* conform/Makefile (test-xfail-XPG3/search.h/linknamespace):
	Remove variable.
	(test-xfail-XPG4/search.h/linknamespace): Likewise.
	(test-xfail-UNIX98/search.h/linknamespace): Likewise.
	(test-xfail-XOPEN2K/search.h/linknamespace): Likewise.
	(test-xfail-XOPEN2K8/search.h/linknamespace): Likewise.
2015-02-18 18:47:34 +00:00
Joseph Myers 1a2325c06c Fix posix_spawn getrlimit64 namespace (bug 17991).
posix_spawn (a standard POSIX function) brings in a use of getrlimit64
(not a standard POSIX function).  This patch fixes this by using
__getrlimit64 and making getrlimit64 a weak alias.

This is more complicated than some such changes because of files that
define getrlimit64 in their own way using symbol versioning after
including the main sysdeps/unix/sysv/linux/getrlimit64.c with a
getrlimit macro defined.  There are various existing patterns for such
cases in glibc; the one I've used here is that a getrlimit64 macro
disables the weak_alias / libc_hidden_weak calls, leaving it to the
including file to define the getrlimit64 name in whatever way is
appropriate.

Tested for x86_64 and x86 that installed stripped shared libraries are
unchanged by this patch.

	[BZ #17991]
	* include/sys/resource.h (__getrlimit64): Declare.  Use
	libc_hidden_proto.
	* resource/getrlimit64.c (getrlimit64): Rename to __getrlimit64
	and define as weak alias of __getrlimit64.  Use libc_hidden_weak.
	* sysdeps/posix/spawni.c (__spawni): Call __getrlimit64 instead of
	getrlimit64.
	* sysdeps/unix/sysv/linux/getrlimit64.c (getrlimit64): Rename to
	__getrlimit64.
	[!getrlimit64] (getrlimit64): Define as weak alias of
	__getrlimit64.  Use libc_hidden_weak.
	* sysdeps/unix/sysv/linux/i386/getrlimit64.c (getrlimit64): Define
	using __getrlimit64 not __new_getrlimit64.
	(__GI_getrlimit64): Likewise.
	* sysdeps/unix/sysv/linux/mips/getrlimit64.c (getrlimit64):
	Likewise.
	(__GI_getrlimit64): Likewise.
	(__old_getrlimit64): Use __getrlimit64 not __new_getrlimit64.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/syscalls.list
	(getrlimit): Add __getrlimit64 alias.
	* sysdeps/unix/sysv/linux/wordsize-64/syscalls.list (getrlimit):
	Likewise.
	* conform/Makefile (test-xfail-XOPEN2K/spawn.h/linknamespace):
	Remove variable.
	(test-xfail-POSIX2008/spawn.h/linknamespace): Likewise.
	(test-xfail-XOPEN2K8/spawn.h/linknamespace): Likewise.
2015-02-18 00:26:35 +00:00