Commit Graph

339 Commits

Author SHA1 Message Date
Joseph Myers 6da85a0daf conformtest: Correct signal.h expectations for XPG4 / XPG42.
Various of the signal.h conform/ failures for XPG4 and XPG42 are
actually the result of incorrect test expectations rather than header
bugs.  This patch fixes the expectations to accord with those
standards (this does not however allow any XFAILs to be removed, as
some header bugs remain).  Note for anyone comparing with the
standards: corrigendum U013/16 removes the mention of a sigmask
function in signal.h (C435 lists such a function in the definition of
signal.h, but without any actual specification for the function
itself), so sigmask is not included in the expectations.

Tested for x86_64.

	* conform/data/signal.h-data (sa_sigaction): Do not expect for
	[XPG4].
	(SA_SIGINFO): Likewise.
	(SA_ONSTACK): Likewise.
	(SA_RESETHAND): Likewise.
	(SA_RESTART): Likewise.
	(SA_NOCLDWAIT): Likewise.
	(SA_NODEFER): Likewise.
	(SS_ONSTACK): Likewise.
	(SS_DISABLE): Likewise.
	(MINSIGSTKSZ): Likewise.
	(SIGSTKSZ): Likewise.
	(ucontext_t): Likewise.
	(stack_t): Likewise.
	(struct sigstack): Likewise.
	(SI_USER): Do not expect for [XPG4 || XPG42].
	(SI_QUEUE): Likewise.
	(SI_TIMER): Likewise.
	(SI_ASYNCIO): Likewise.
	(SI_MESGQ): Likewise.
	(bsd_signal): Do not expect for [XPG4].
	(killpg): Likewise.
	(sigaltstack): Likewise.
	(sighold): Likewise.
	(sigignore): Likewise.
	(siginterrupt): Likewise.
	(sigpause): Likewise.
	(sigrelse): Likewise.
	(sigset): Likewise.
	(sigwait): Do not expect for [XPG4 || XPG42].
2017-06-01 17:17:43 +00:00
Joseph Myers 666c0c5efa Fix sigstack namespace (bug 21511).
The sigstack function was removed in the 2001 edition of POSIX, and
the sigstack structure in the 2008 edition.  signal.h wrongly includes
those declarations even for newer POSIX versions.  This patch fixes
the conditions, and conform/ expectations, accordingly.

This patch makes the minimum change to when these declarations are
present, leaving them visible for __USE_MISC as they would previously
have been visible by default.  Arguably these legacy declarations
should only be visible when an old standard is specifically requested,
but implementing that would require arranging for the various sigstack
implementations to be able to see the struct sigstack type despite it
not being in _GNU_SOURCE in that case.

Tested for x86_64.

	[BZ #21511]
	* signal/signal.h: Include <bits/types/struct_sigstack.h> only if
	[(__USE_XOPEN_EXTENDED && !__USE_XOPEN2K8) || __USE_MISC].
	(sigstack): Declare only if [(__USE_XOPEN_EXTENDED &&
	!__USE_XOPEN2K) || __USE_MISC].
	* conform/data/signal.h-data (struct sigstack): Expect type only
	if [!XOPEN2K8 && !POSIX2008].
	(sigstack): Expect function only if [XPG42 || UNIX98].
2017-05-23 16:47:29 +00:00
Joseph Myers 176804300b Fix network headers stdint.h namespace (bug 21455).
conform/ namespace tests of arpa/inet.h, netdb.h and netinet/in.h fail
for UNIX98 and XPG42 because of inclusion of stdint.h, which defines
macros not permitted in those headers for those standards.  UNIX98
allows them to include inttypes.h, but (predating C99) has restricted
inttypes.h contents (not yet tested in the conform/ tests) not
including those macros; XPG4.2 has no such permission and no
inttypes.h / stdint.h at all.

This patch rearranges the headers to avoid this issue.  intN_t
definitions move to bits/stdint-intn.h, and uintN_t definitions to
bits/stdint-uintn.h.  (These are not bits/types/ headers because they
each define four types.  They are separate rather than just a single
header because sys/types.h defines intN_t but u_intN_t rather than
uintN_t - and while sys/types.h could define uintN_t because of the
POSIX reservation of *_t, existing practice there is largely to
condition types on appropriate feature test macros, and indeed there
is at least one open bug report (14553) about a type that's not
so-conditioned, so maybe types there should actually have conditions
added where appropriate.)  The affected network headers are then made
to include bits/stdint-uintn.h instead of stdint.h.  This allows six
XFAILs to be removed.

This doesn't do anything about inttypes.h defining more than it should
for UNIX98, but we don't have conformtest expectations for that case
at present (and my inclination is that a fix for that should be as
local as possible - affecting only inttypes.h, not stdint.h, only for
the case of __USE_UNIX98 && !__USE_ISOC99).

Tested for x86_64.

	[BZ #21455]
	* bits/stdint-intn.h: New file.
	* bits/stdint-uintn.h: Likewise.
	* stdlib/Makefile (headers): Add bits/stdint-intn.h and
	bits/stdint-uintn.h.
	* inet/netinet/in.h: Include <bits/stdint-uintn.h> instead of
	<stdint.h>.
	* posix/sys/types.h: Include <bits/stdint-intn.h>.
	(__int8_t_defined): Do not define here.
	(int8_t): Likewise.
	(int16_t): Likewise.
	(int32_t): Likewise.
	(int64_t): Likewise.
	[__GNUC_PREREQ (2, 7)] (__intN_t): Likewise.
	* resolv/netdb.h: Include <bits/stdint-uintn.h> instead of
	<stdint.h>.
	* include/netdb.h [_ISOMAC]: Do not include <stdint.h>.
	* sysdeps/generic/stdint.h: Include <bits/stdint-intn.h> and
	<bits/stdint-uintn.h>.
	(int8_t): Do not define here.
	(int16_t): Likewise.
	(int32_t): Likewise.
	(int64_t): Likewise.
	(uint8_t): Likewise.
	(uint16_t): Likewise.
	(uint32_t): Likewise.
	(uint64_t): Likewise.
	* conform/Makefile (test-xfail-XPG42/arpa/inet.h/conform): Remove
	variable.
	(test-xfail-XPG42/netdb.h/conform): Likewise.
	(test-xfail-XPG42/netinet/in.h/conform): Likewise.
	(test-xfail-UNIX98/arpa/inet.h/conform): Likewise.
	(test-xfail-UNIX98/netdb.h/conform): Likewise.
	(test-xfail-UNIX98/netinet/in.h/conform): Likewise.
2017-05-04 20:36:42 +00:00
Joseph Myers 085e07db22 conformtest: Allow time.h inclusion from semaphore.h for XOPEN2K.
POSIX.1:2001 added sem_timedwait, but said nothing about defining
struct timespec in semaphore.h.  The 2008 edition added a
corresponding permission to include <time.h> from <semaphore.h>.
Since this is the normal POSIX approach in such cases, it seems
appropriate to consider this a bug fix, and so this patch makes the
conform/ tests allow that inclusion for POSIX.1:2001 as well.

Tested for x86_64.

	* conform/data/semaphore.h-data [XOPEN2K] (time.h): Allow header
	inclusion.
	* conform/Makefile (test-xfail-XOPEN2K/semaphore.h/conform):
	Remove.
2017-04-28 16:52:16 +00:00
Joseph Myers 0516e24d18 conformtest: Fix XPG standard naming.
The conform/ tests test -D_XOPEN_SOURCE under the name "XPG3", and
-D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED under the name "XPG4".

That naming is misleading.  _XOPEN_SOURCE_EXTENDED actually means
XPG4.2, including UX-shaded interfaces.  _XOPEN_SOURCE actually means
XPG4, or XPG4.2 without UX-shaded interfaces.  (Prior XPG versions
also used _XOPEN_SOURCE, but without any versioning of the values of
the macro, so XPG4.2 without UX-shaded interfaces is the only sensible
set of interfaces for glibc to expose given _XOPEN_SOURCE=1 without
_XOPEN_SOURCE_EXTENDED defined.)

This patch fixes the naming in the conform/ tests, so that what is now
called XPG4 is changed to XPG42, and what is now called XPG3 is
changed to XPG4.

Tested for x86_64 (and verified the complete set of expectations is
unchanged by the patch beyond the intended renaming).

	* conform/GlibcConform.pm (XPG4): Rename standard to XPG42.
	(XPG3): Rename standard to XPG4.
	* conform/Makefile: Likewise.
	* conform/list-header-symbols.pl: Likewise.
	* conform/data/aio.h-data: Likewise.
	* conform/data/arpa/inet.h-data: Likewise.
	* conform/data/complex.h-data: Likewise.
	* conform/data/ctype.h-data: Likewise.
	* conform/data/dlfcn.h-data: Likewise.
	* conform/data/fcntl.h-data: Likewise.
	* conform/data/fenv.h-data: Likewise.
	* conform/data/float.h-data: Likewise.
	* conform/data/fmtmsg.h-data: Likewise.
	* conform/data/ftw.h-data: Likewise.
	* conform/data/grp.h-data: Likewise.
	* conform/data/inttypes.h-data: Likewise.
	* conform/data/iso646.h-data: Likewise.
	* conform/data/langinfo.h-data: Likewise.
	* conform/data/libgen.h-data: Likewise.
	* conform/data/limits.h-data: Likewise.
	* conform/data/locale.h-data: Likewise.
	* conform/data/math.h-data: Likewise.
	* conform/data/mqueue.h-data: Likewise.
	* conform/data/ndbm.h-data: Likewise.
	* conform/data/net/if.h-data: Likewise.
	* conform/data/netdb.h-data: Likewise.
	* conform/data/netinet/in.h-data: Likewise.
	* conform/data/poll.h-data: Likewise.
	* conform/data/pthread.h-data: Likewise.
	* conform/data/pwd.h-data: Likewise.
	* conform/data/sched.h-data: Likewise.
	* conform/data/search.h-data: Likewise.
	* conform/data/semaphore.h-data: Likewise.
	* conform/data/signal.h-data: Likewise.
	* conform/data/spawn.h-data: Likewise.
	* conform/data/stdbool.h-data: Likewise.
	* conform/data/stdint.h-data: Likewise.
	* conform/data/stdio.h-data: Likewise.
	* conform/data/stdlib.h-data: Likewise.
	* conform/data/string.h-data: Likewise.
	* conform/data/strings.h-data: Likewise.
	* conform/data/stropts.h-data: Likewise.
	* conform/data/sys/mman.h-data: Likewise.
	* conform/data/sys/resource.h-data: Likewise.
	* conform/data/sys/select.h-data: Likewise.
	* conform/data/sys/socket.h-data: Likewise.
	* conform/data/sys/stat.h-data: Likewise.
	* conform/data/sys/statvfs.h-data: Likewise.
	* conform/data/sys/time.h-data: Likewise.
	* conform/data/sys/timeb.h-data: Likewise.
	* conform/data/sys/types.h-data: Likewise.
	* conform/data/sys/uio.h-data: Likewise.
	* conform/data/sys/un.h-data: Likewise.
	* conform/data/sys/wait.h-data: Likewise.
	* conform/data/syslog.h-data: Likewise.
	* conform/data/termios.h-data: Likewise.
	* conform/data/tgmath.h-data: Likewise.
	* conform/data/time.h-data: Likewise.
	* conform/data/ucontext.h-data: Likewise.
	* conform/data/unistd.h-data: Likewise.
	* conform/data/utmpx.h-data: Likewise.
	* conform/data/varargs.h-data: Likewise.
	* conform/data/wchar.h-data: Likewise.
	* conform/data/wctype.h-data: Likewise.
2017-04-27 20:29:35 +00:00
Joseph Myers 9fe3c80c7c Fix sys/socket.h namespace issues from sys/uio.h inclusion (bug 21426).
sys/socket.h includes sys/uio.h to get the definition of the iovec
structure.

POSIX allows sys/socket.h to make all sys/uio.h symbols visible.
However, all of sys/uio.h is XSI-shaded, so for non-XSI POSIX this
results in conformtest failures (for sys/socket.h and other headers
that include it):

    Namespace violation: "UIO_MAXIOV"
    Namespace violation: "readv"
    Namespace violation: "writev"

Now, there is some ambiguity in POSIX about what namespace
reservations apply in this case - see
http://austingroupbugs.net/view.php?id=1127 - but glibc convention
would still avoid declaring readv and writev, for example, for feature
test macros that don't include them (if only headers from the relevant
standard are included), even if such declarations are permitted, so
there is a bug here according to glibc conventions.

This patch moves the struct iovec definition to a new
bits/types/struct_iovec.h header and includes that from sys/socket.h
instead of including the whole of sys/uio.h.  This fixes the namespace
issue; however, three files in glibc that were relying on the implicit
inclusion needed to be updated to include sys/uio.h explicitly.  So
there is a question of whether sys/socket.h should continue to include
sys/uio.h under some conditions, such as __USE_XOPEN or __USE_MISC or
__USE_XOPEN || __USE_MISC, for greater compatibility with code that
(wrongly) expects this optional inclusion to be present there.  (I
think the three affected files in glibc should still have explicit
sys/uio.h inclusions added in any case, however.)

Tested for x86_64.

	[BZ #21426]
	* misc/bits/types/struct_iovec.h: New file.
	* misc/Makefile (headers): Add bits/types/struct_iovec.h.
	* include/bits/types/struct_iovec.h: New file.
	* bits/uio.h (struct iovec): Replace by inclusion of
	<bits/types/struct_iovec.h>.
	* sysdeps/unix/sysv/linux/bits/uio.h (struct iovec): Likewise.
	* socket/sys/socket.h: Include <bits/types/struct_iovec.h> instead
	of <sys/uio.h>.
	* nptl/tst-cancel4.c: Include <sys/uio.h>
	* posix/test-errno.c: Likewise.
	* support/resolv_test.c: Likewise.
	* conform/Makefile (test-xfail-POSIX2008/arpa/inet.h/conform):
	Remove.
	(test-xfail-POSIX2008/netdb.h/conform): Likewise.
	(test-xfail-POSIX2008/netinet/in.h/conform): Likewise.
	(test-xfail-POSIX2008/sys/socket.h/conform): Likewise.
2017-04-25 17:52:47 +00:00
Joseph Myers 3fa6e4872d conformtest: Allow *_t in sys/socket.h.
The conformtest expectations in sys/socket.h are missing the standard
POSIX allowance for all headers to define *_t names.  For XSI standard
versions that allowance comes in via the permission to include
<sys/uio.h> (for which the expectations properly allow *_t), but for
non-XSI POSIX nothing brings in that allowance and spurious namespace
failures occur.  This patch adds the required permission to the
expectations to remove the spurious failures (by itself this does not
allow any XFAILs to be removed).

Tested for x86_64.

	* conform/data/sys/socket.h-data (*_t): Allow.
2017-04-25 16:00:28 +00:00
Joseph Myers 62f71aad7e conformtest: Enable tests when cross compiling.
This patch enables the compilation part of the conformtest tests (the
vast bulk of them) when cross compiling, so making it easy to run them
across many configurations with build-many-glibcs.py.

Tested with build-many-glibcs.py.

	* conform/Makefile (tests-special): Do not make addition of
	$(conformtest-header-tests) conditional on [$(cross-compiling) = no].
	(generated): Do not make addition of $(conformtest-header-base)
	conditional on [$(cross-compiling) = no].
2017-04-18 23:51:35 +00:00
Joseph Myers 76b2c32a16 conformtest: Add x32 XFAILs for mq_attr element types (bug 21279).
POSIX specifies long as the type of elements of struct mq_attr.  For
x32, they are __syscall_slong_t (i.e. long long).  This patch XFAILs
the corresponding tests for x32 in the conformtest expectations (the
bug should not be closed without an actual fix).

Tested with build-many-glibcs.py.

	[BZ #21279]
	* sysdeps/unix/sysv/linux/x86_64/x32/Makefile
	[$(subdir) = conform] (conformtest-xfail-conds): Update comment.
	* conform/data/mqueue.h-data (mq_attr.mq_flags): XFAIL for
	x86_64-x32-linux.
	(mq_attr.mq_maxmsg): Likewise.
	(mq_attr.mq_msgsize): Likewise.
	(mq_attr.mq_curmsgs): Likewise.
2017-03-20 21:30:28 +00:00
Joseph Myers 112039611c conformtest: Add mips XFAIL for struct stat st_rdev type (bug 21278).
MIPS o32 struct stat has the wrong type of st_rdev.  This patch XFAILs
that test in the conformtest expectations for this case (the bug
should not be closed without an actual fix, however).

Tested with build-many-glibcs.py.

	[BZ #21278]
	* sysdeps/unix/sysv/linux/mips/mips32/Makefile
	[$(subdir) = conform] (conformtest-xfail-conds): Update comment.
	* conform/data/sys/stat.h-data (stat.st_rdev): XFAIL for
	mips-o32-linux.
2017-03-20 21:28:16 +00:00
Joseph Myers 345118d7f5 conformtest: XFAIL tv_nsec tests for x32 (bug 16437).
This patch XFAILs the conformtest tv_nsec tests for x32 so that the
incorrect type does not potentially hide other failures.  As this is
not a fix for the bug, it should remain open in Bugzilla.

Tested (compilation only) with build-many-glibcs.py.

	[BZ #16437]
	* sysdeps/unix/sysv/linux/x86_64/x32/Makefile
	[$(subdir) = conform] (conformtest-xfail-conds): New variable.
	* conform/data/signal.h-data (timespec.tv_nsec): XFAIL for
	x86_64-x32-linux.
	* conform/data/sys/select.h-data (timespec.tv_nsec): Likewise.
	* conform/data/sys/stat.h-data (timespec.tv_nsec): Likewise.
	* conform/data/time.h-data (timespec.tv_nsec): Likewise.
2017-03-18 00:24:13 +00:00
Joseph Myers 22b72f356d conformtest: Handle conditional XFAILs with allow-header.
This patch fixes the conformtest handling of headers listed in
allow-header to process xfail[cond]- in the expectations for those
headers.

Tested with build-many-glibcs.py.

	* conform/conformtest.pl: Handle xfail[cond]- in header mentioned
	with allow-header.
2017-03-18 00:16:05 +00:00
Joseph Myers 0cb521871b conformtest: Add mips XFAIL for struct stat st_dev type (bug 17786).
As noted in bug 17786, MIPS o32 struct stat has the wrong type of
st_dev.  This patch XFAILs that test in the conformtest expectations
for this case (the test still fails after the patch because there's
also a similar issue for st_rdev that needs reporting and XFAILing
separately, and the bug should not be closed without an actual fix,
not just XFAILing).

Tested for mips with build-many-glibcs.py.

	[BZ #17786]
	* sysdeps/unix/sysv/linux/mips/mips32/Makefile: New file.
	* conform/data/sys/stat.h-data (stat.st_dev): XFAIL for
	mips-o32-linux.
2017-03-17 02:54:59 +00:00
Joseph Myers bb5cc234e1 conformtest: Add alpha XFAIL for struct netent n_net type (bug 21260).
As noted in bug 21260, sysdeps/unix/sysv/linux/alpha/bits/netdb.h
defines struct netent with n_net of type unsigned long instead of the
correct uint32_t.  This patch XFAILs that test in the conformtest
expectations for alpha.  (This is not a fix for the bug, and it should
not be closed without an actual fix.)

Tested for alpha with build-many-glibcs.py.

	[BZ #21260]
	* sysdeps/unix/sysv/linux/alpha/Makefile
	[$(subdir) = conform] (conformtest-xfail-conds): New variable.
2017-03-17 02:42:16 +00:00
Joseph Myers c33eac51f4 conformtest: Skip execution tests when cross-compiling.
This patch makes conformtest skip execution tests when
cross-compiling, as an interim step towards running most of these
tests (presently disabled) in that case.  It omits the (obvious)
Makefile change to actually enable the conformtest tests when
cross-compiling, as there are still enough failures seen with
build-many-glibcs.py that I'd like to get the results cleaner before
enabling these tests.

Tested for x86_64, and with the tests actually enabled for
cross-compilation with build-many-glibcs.py.

	* conform/conformtest.pl ($cross): New variable.
	(--cross): New command-line option.
	(runtest): Skip test execution when cross-compiling.
	* conform/Makefile (conformtest-cross): New variable.
	($(conformtest-header-tests)): Pass $(conformtest-cross) to
	conformtest.pl.
2017-03-17 01:21:10 +00:00
Joseph Myers 33c02810c5 conformtest: Support system-specific XFAILs.
conformtest has an internal XFAIL mechanism to allow failures of
individual expectations to be ignored, so that known hard-to-fix
failures (e.g. those affecting ABIs or requiring kernel changes) do
not cause the overall tests to FAIL and so hide other failures from
the same (header, standard) pair.

Various such bugs are system-specific, so this patch adds a mechanism
to allow system-specific XFAILs.  A system-independent XFAIL is
achieved by putting "xfail-" at the start of the relevant expectation
in the *-data files.  A system-specific XFAIL instead uses
"xfail[cond]-", where "cond" is a condition listed in
conformtest-xfail-conds in a sysdeps makefile (so one for x32 might
set conformtest-xfail-conds = x86_64-x32-linux, for example, and then
an expectation for tv_nsec's type could use
xfail[x86_64-x32-linux]-).  The actual names are arbitrary, just
needing to match between the makefiles and the expectations, and if
necessary you can use "xfail[cond1|cond2]-" for a test that is
expected to fail under multiple conditions.  As with
system-independent XFAILs, I think system-specific ones should have a
bug filed in Bugzilla and a comment referencing that bug.

Tested for x86_64, including with test expectations and makefiles
changed to use the new facility.

	* conform/conformtest.pl ($xfail_str): New variable.
	(--xfail=): New command-line option.
	(top level): Handle expectations starting xfail[cond]-.
	* conform/Makefile (conformtest-xfail): New variable.
	($(conformtest-header-tests)): Pass $(conformtest-xfail) to
	conformtest.pl.
2017-03-17 01:08:27 +00:00
Joseph Myers 0fbca26c39 conformtest: Make more tests into compilation tests.
The conformtest header tests test some things through compilation
tests and others through execution tests.  This patch makes more of
the tests into compilation tests, using _Static_assert (note: for
float.h tests on floating-point values this is depending on a GNU
extension, that those assertions are allowed in the absence of
-pedantic although they aren't strictly integer constant expressions).
The remaining execution tests are for values of things listed as
"symbol" (in fact no such things have a value expectation listed) and
for values of macros defined as string constants (three such values
listed in total).

This is intended as preparation for enabling the vast bulk of the
tests to run for cross compilation.  (Even the few remaining execution
tests ought in principle to run for cross compilation when a test
wrapper is defined, but that's more complicated.  The existing
execution tests for native builds in fact are linked and run with an
existing installed libc that's required to exist to link against,
rather than with the newly built libc; only the new headers are used.)

Tested for x86_64.

	* conform/conformtest.pl: Use compilation instead of execution
	tests for testing values of constants and usability in #if.
2017-03-16 17:51:23 +00:00
Andreas Schwab 4283b38725 Fix missing test dependency 2017-02-01 17:40:56 +01:00
Joseph Myers bfff8b1bec Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
Joseph Myers 85d3192140 Enable linknamespace testing for libdl and libcrypt.
When I set up linknamespace testing, the lists of libraries that might
contain functions from various standards were based on the -l options
POSIX says may be required to find certain functions with the c99
utility.

glibc has some POSIX functions in the libdl and libcrypt libraries,
not mentioned in the definition of the c99 utility (so an
implementation of that utility using glibc would need to use -ldl
-lcrypt automatically).  This patch adds those libraries to the ones
considered in linknamespace testing for relevant standards.  (The
crypt functions are XSI only, present in XPG3 and above; the libdl
ones were added in UNIX98, then moved from XSI to BASE in the 2008
edition of POSIX.)

	* conform/Makefile (linknamespace-libs): Rename to
	linknamespace-libs-thr.
	(linknamespace-libs-posix): New variable.
	(linknamespace-libs-xsi): Likewise.
	(linknamespace-libs-XPG3): Include libcrypt.a.
	(linknamespace-libs-XPG4): Use $(linknamespace-libs-XPG3).
	(linknamespace-libs-POSIX): Use $(linknamespace-libs-thr).
	(linknamespace-libs-UNIX98): Use $(linknamespace-libs-xsi).
	(linknamespace-libs-XOPEN2K): Likewise.
	(linknamespace-libs-XOPEN2K8): Likewise.
	(linknamespace-libs-POSIX2008): Use $(linknamespace-libs-posix).
2016-11-16 22:47:57 +00:00
Joseph Myers 6c50bb532b Fix linknamespace parallel test failures.
Having found that with my script to build many glibc variants I could
reproduce the linknamespace test failures in parallel builds (that
various people had previously reported but I hadn't seen myself), I
investigated those failures further.  This patch adds a missing
dependency to those tests.

Tested for x86_64, including the configuration where I saw those
failures and where I don't see them with this patch.

	* conform/Makefile ($(linknamespace-header-tests)): Also depend on
	$(linknamespace-symlists-tests).
2016-11-03 22:47:02 +00:00
Aurelien Jarno 6d5336211d conform tests: call perl with '-I.'
Historically perl includes the current directory in the module search
path. Over the time this has been considered as a security issue and
the recent vulnerabilities [1] made people to reconsider this behaviour.
It is almost sure that this will be removed in the future [2], possibly
for the 5.26 release, although this is not yet firmly decided.

Debian has decided to backport the patches [3], so the perl binary in
unstable do not have '.' in @INC anymore.

This behaviour is used in the conform perl scripts to include the
GlibcConform module. This patch fixes that by calling perl with '-I.'.
This is not a security issue in this case as make ensures that the
current directory is $(srcdir)/conform/ when the scripts are called.
Passing the full path would do exactly the same.

[1] CVE-2016-1238 CVE-2016-6185
[2] https://rt.perl.org/Public/Bug/Display.html?id=127810
[3] https://lists.debian.org/debian-devel-announce/2016/08/msg00013.html

Changelog:
	* conform/Makefile (conformtest-header-tests): Pass -I. to $(PERL).
	(linknamespace-symlists-tests): Likewise.
	(linknamespace-header-tests): Likewise.
2016-09-05 22:53:22 +02:00
Adhemerval Zanella 78880cc185 Revert {send,sendm,recv,recvm}msg conformance changes
After some discussion in libc-alpha about this POSIX compliance fix, I see
that GLIBC should indeed revert back to previous definition of msghdr and
cmsghdr and implementation of sendmsg, recvmsg, sendmmsg, recvmmsg due some
reasons:

 * The possible issue where the syscalls wrapper add the compatibility
   layer is quite limited in scope and range.  And kernel current
   also add some limits to the values on the internal msghdr and
   cmsghdr fields:

     - msghdr::msg_iovlen larger than UIO_MAXIOV (1024) returns
       EMSGSIZE.
     - msghdr::msg_controllen larger than INT_MAX returns ENOBUFS.

 * There is a small performance hit for recvmsg/sendmsg/recmmsg which
   is neglectable, but it is a big hit for sendmmsg since now instead
   of calling the syscall for the packed structure, GLIBC is calling
   multiple sendmsg.  This defeat the very existence of the syscall.

 * It currently breaks libsanitizer build on GCC [1] (I fixed on compiler-rt).
   However the fix is incomplete because it does add any runtime check
   since libsanitizer currently does not have any facility to intercept
   symbols with multiple version [2].

   This, along with incorret dlsym/dlvsym return for versioned symbol due
   another bug [3], makes hard to interpose versioned symbols.

   Also, current approach of fixing GCC PR#71445 leads to half-baked
   solutions without versioned symbol interposing.

This patch basically reverts commits 2f0dc39029, 222c2d7f43,
af7f7c7ec8.  I decided to not revert abf29edd4a (Adjust
kernel-features.h defaults for recvmsg and sendmsg) mainly because it
does not really address the POSIX compliance original issue and also
adds some cleanups.

Tested on x86, i386, s390, s390x, aarch64, and powerpc64le.

[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71445
[2] https://github.com/google/sanitizers/issues/628
[3] https://sourceware.org/bugzilla/show_bug.cgi?id=14932

	* conform/data/sys/socket.h-data (msghdr.msg_iovlen): Add xfail-.
	(msghdr.msg_controllen): Likewise.
	(cmsghdr.cmsg_len): Likewise.
	* nptl/Makefile (libpthread-routines): Remove ptw-oldrecvmsg and
	ptw-oldsendmsg.
	(CFLAGS-oldrecvmsg.c): Remove rule.
	(CFLAGS-oldsendmsg.c): Likewise.
	(CFLAGS-recvmsg.c): Add rule.
	(CFLAGS-sendmsg.c): Likewise.
	* sysdeps/unix/sysv/linux/Makefile (sysdep_routines): Remove
	oldrecvmsg, oldsendmsg, oldrecvmmsg, oldsendmmsg.
	(CFLAGS-recvmsg.c): Remove rule.
	(CFLAGS-sendmsg.c): Likewise.
	(CFLAGS-oldrecvmsg.c): Likewise.
	(CFLAGS-oldsendmsg.c): Likewise.
	(CFLAGS-recvmmsg.c): Likewise.
	* sysdeps/unix/sysv/linux/bits/socket.h (msghdr.msg_iovlen): Revert
	to kernel defined interfaces.
	(msghdr.msg_controllen): Likewise.
	(cmsghdr.cmsg_len): Likewise.
	(msghdr.__glibc_reserved1): Remove member.
	(msghdr.__glibc_reserved2): Likewise.
	(cmsghdr.__glibc_reserved1): Likewise.
	* sysdeps/unix/sysv/linux/oldrecvmmsg.c: Remove file.
	* sysdeps/unix/sysv/linux/oldrecvmsg.c: Likewise.
	* sysdeps/unix/sysv/linux/oldsendmmsg.c: Likewise.
	* sysdeps/unix/sysv/linux/oldsendmsg.c: Likewise.
	* sysdeps/unix/sysv/linux/recvmmsg.c: Revert back to previous
	version.
	* sysdeps/unix/sysv/linux/recvmsg.c: Likewise.
	* sysdeps/unix/sysv/linux/sendmmsg.c: Likewise.
	* sysdeps/unix/sysv/linux/sendmsg.c: Likewise.
	* sysdeps/unix/sysv/linux/aarch64/Versions [libc] (GLIBC_2.24):
	Remove recvmsg and sendmsg.
	* sysdeps/unix/sysv/linux/alpha/Versions [libc] (GLIBC_2.24):
	Likewise.
	* sysdeps/unix/sysv/linux/hppa/Versions [libc] (GLIBC_2.24):
	Likewise.
	* sysdeps/unix/sysv/linux/i386/Versions [libc] (GLIBC_2.24): Likewise.
	* sysdeps/unix/sysv/linux/m68k/Versions [libc] (GLIBC_2.24): Likewise.
	* sysdeps/unix/sysv/linux/microblaze/Versions [libc] (GLIBC_2.24):
	Likewise.
	* sysdeps/unix/sysv/linux/mips/mips32/Versions [libc] (GLIBC_2.24):
	Likewise.
	* sysdeps/unix/sysv/linux/mips/mips64/n32/Versions
	[libc] (GLIBC_2.24): Likewise.
	* sysdeps/unix/sysv/linux/nios2/Versions [libc] (GLIBC_2.24):
	Likewise.
	* sysdeps/unix/sysv/linux/powerpc/Versions [libc] (GLIBC_2.24):
	Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/Versions
	[libc] (GLIBC_2.24): Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-32/Versions [libc] (GLIBC_2.24):
	Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-64/Versions [libc] (GLIBC_2.24):
	Likewise.
	* sysdeps/unix/sysv/linux/sh/Versions [libc] (GLIBC_2.24): Likewise.
	* sysdeps/unix/sysv/linux/sparc/Versions [libc] (GLIBC_2.24):
	Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc64/Versions [libc] (GLIBC_2.24):
	Likewise.
	* sysdeps/unix/sysv/linux/tile/Versions [libc] (GLIBC_2.24):
	Likewise.
	* sysdeps/unix/sysv/linux/x86_64/Versions [libc] (GLIBC_2.24):
	Likewise.
	* sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/Versions: Remove file
	* sysdeps/unix/sysv/linux/x86_64/64/Versions: Likewise.
	* sysdeps/unix/sysv/linux/mips/mips64/n64/Versions: Likewise.
	* sysdeps/unix/sysv/linux/aarch64/libc.abilist: Remove new 2.24
	version for {recv,send,recm,sendm}msg.
	* sysdeps/unix/sysv/linux/alpha/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/arm/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/hppa/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/i386/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/ia64/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/microblaze/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/libc-le.abilist: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/nios2/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/sh/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/tile/tilepro/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/64/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist: Likewise.
2016-06-10 11:58:16 -03:00
Adhemerval Zanella af7f7c7ec8 network: recvmsg and sendmsg standard compliance (BZ#16919)
POSIX specifies that both msghdr::msg_iovlen and msghdr::msg_controllen
to be of size int and socklen_t respectively.  However Linux defines it as
both size_t and for 64-bit it requires some adjustments to make the
functions standard compliance.

This patch fixes it by creating a temporary header and zeroing the pad
fields for 64-bits architecture where size of size_t exceeds the size of
the int.

Also the new recvmsg and sendmsg implementation is only added on libc,
with libpthread only containing a compat symbol.

Tested on x86_64, i686, aarch64, armhf, and powerpc64le.

	* conform/data/sys/socket.h-data (msghdr.msg_iovlen): Remove xfail-
	and change to correct expected type.
	(msghdr.msg_controllen): Likewise.
	(cmsghdr.cmsg_len): Likewise.
	* sysdeps/unix/sysv/linux/bits/socket.h (msghdr.msg_iovlen): Fix
	expected POSIX assumption about the size.
	(msghdr.msg_controllen): Likewise.
	(msghdr.__glibc_reserved1): Likewise.
	(msghdr.__glibc_reserved2): Likewise.
	(cmsghdr.cmsg_len): Likewise.
	(cmsghdr.__glibc_reserved1): Likewise.
	* nptl/Makefile (libpthread-routines): Remove ptw-recvmsg and ptw-sendmsg.
	Add ptw-oldrecvmsg and ptw-oldsendmsg.
	(CFLAGS-sendmsg.c): Remove rule.
	(CFLAGS-recvmsg.c): Likewise.
	(CFLAGS-oldsendmsg.c): Add rule.
	(CFLAGS-oldrecvmsg.c): Likewise.
	* sysdeps/unix/sysv/linux/alpha/Versions [libc] (GLIBC_2.24): Add
	recvmsg and sendmsg.
	* sysdeps/unix/sysv/linux/aarch64/Version [libc] (GLIBC_2.24):
	Likewise.
	* sysdeps/unix/sysv/linux/arm/Versions [libc] (GLIBC_2.24): Likewise.
	* sysdeps/unix/sysv/linux/hppa/Versions [libc] (GLIBC_2.24): Likewise.
	* sysdeps/unix/sysv/linux/i386/Versions [libc] (GLIBC_2.24): Likewise.
	* sysdeps/unix/sysv/linux/ia64/Versions [libc] (GLIBC_2.24): Likewise.
	* sysdeps/unix/sysv/linux/m68k/Versions [libc] (GLIBC_2.24): Likewise.
	* sysdeps/unix/sysv/linux/microblaze/Versions [libc] (GLIBC_2.24):
	Likewise.
	* sysdeps/unix/sysv/linux/mips/mips32/Versions [libc] (GLIBC_2.24):
	Likewise.
	* sysdeps/unix/sysv/linux/mips/mips64/n32/Versions [libc] (GLIBC_2.24):
	Likewise.
	* sysdeps/unix/sysv/linux/mips/mips64/Versions [libc] (GLIBC_2.24):
	Likewise.
	* sysdeps/unix/sysv/linux/nios2/Versions [libc] (GLIBC_2.24):
	Likewise.
	* sysdeps/unix/sysv/linux/powerpc/Versions [libc] (GLIBC_2.24):
	Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/Versions [libc]
	(GLIBC_2.24): Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-32/Versions [libc] (GLIBC_2.24):
	Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-64/Versions [libc] (GLIBC_2.24):
	Likewise.
	* sysdeps/unix/sysv/linux/sh/Versions [libc] (GLIBC_2.24): Likewise.
	* sysdeps/unix/sysv/linux/sparc/Versions [libc] (GLIBC_2.24):
	Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc64/Versions [libc] (GLIBC_2.24):
	Likewise.
	( sysdeps/unix/sysv/linux/tile/Versions [libc] (GLIBC_2.24):
	Likewise.
	* sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/Versions [libc]
	(GLIBC_2.24): Likewise.
	( sysdeps/unix/sysv/linux/x86_64/64/Versions [libc] (GLIBC_2.24):
	Likewise.
	* sysdeps/unix/sysv/linux/x84_64/Versions [libc] (GLIBC_2.24):
	Likewise.
	* sysdeps/unix/sysv/linux/Makefile
	[$(subdir) = socket)] (sysdep_headers): Add oldrecvmsg and oldsendmsg.
	(CFLAGS-sendmsg.c): Add rule.
	(CFLAGS-recvmsg.c): Likewise.
	(CFLAGS-oldsendmsg.c): Likewise.
	(CFLAGS-oldrecvmsg.c): Likewise.
	* sysdeps/unix/sysv/linux/check_native.c (__check_native): Fix msghdr
	initialization.
	* sysdeps/unix/sysv/linux/check_pf.c (make_request): Likewise.
	* sysdeps/unix/sysv/linux/ifaddrs.c (__netlink_request): Likewise.
	* sysdeps/unix/sysv/linux/oldrecvmsg.c: New file.
	* sysdeps/unix/sysv/linux/oldsendmsg.c: Likewise.
	* sysdeps/unix/sysv/linux/recvmsg.c (__libc_recvmsg): Adjust msghdr
	iovlen and controllen fields to adjust to POSIX specification.
	* sysdeps/unix/sysv/linux/sendmsg.c (__libc_sendmsg): Likewise.
	* sysdeps/unix/sysv/linux/aarch64/libc.abilist: New version and
	added recvmsg and sendmsg.
	* sysdeps/unix/sysv/linux/alpha/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/hppa/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/i386/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/ia64/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/microblaze/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/nios2/libc.abilist: Likewise
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist:
	Likewise.
	* sysdeps/unix/linux/powerpc/powerpc32/nofpu/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/libc-le.abilist: Likewise.
	* sysdepe/unix/sysv/linux/powerpc/powerpc64/libc.abilist: Likewise.
	Likewise.
	Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/sh/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/tile/tilepro/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libc.abilist: Likewise.
	Likewise.
	* sysdeps/unix/sysv/linux/x86_64/64/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist: Likewise.
2016-05-25 17:39:01 -03:00
Joseph Myers d912d3a119 conformtest: Correct some limits.h expectations for XPG3, XPG4.
The conform/ test of limits.h namespace for XPG3 was failing because
of NL_* and NZERO defines.  Those symbols are EX-shaded, not
UX-shaded, so it's correct for them to be defined for XPG3; this patch
corrects the expectations accordingly.  (Actually it looks like they
should not be listed as optional for these standards, but that's
another matter.)

Tested for x86_64 and x86.

	* conform/data/limits.h-data (CHARCLASS_NAME_MAX): Also expect for
	[XPG3 || XPG4].
	(NL_ARGMAX): Also expect for [XPG3].
	(NL_LANGMAX): Likewise.
	(NL_MSGMAX): Likewise.
	(NL_NMAX): Likewise.
	(NL_SETMAX): Likewise.
	(NL_TEXTMAX): Likewise.
	(NZERO): Likewise.
	(TMP_MAX): Likewise.
	* conform/Makefile (test-xfail-XPG3/limits.h/conform): Remove
	variable.
2016-05-23 15:25:34 +00:00
Joseph Myers b003c666ef conformtest: Correct ftw.h expectations for XPG3, XPG4.
This patch corrects various conformtest expectations in ftw.h for XPG3
and XPG4.

Tested for x86_64 and x86.

	* conform/data/ftw.h-data (struct FTW): Do not expect for [XPG3].
	(FTW_DP): Do not expect for [XPG3 || XPG4].
	(FTW_SL): Do not expect for [XPG3].
	(FTW_SLN): Likewise.
	(FTW_PHYS): Likewise.
	(FTW_MOUNT): Likewise.
	(FTW_DEPTH): Likewise.
	(FTW_CHDIR): Likewise.
	(nftw): Likewise.
	* conform/Makefile (test-xfail-XPG3/ftw.h/conform): Remove
	variable.
2016-05-20 19:45:06 +00:00
Joseph Myers bb37c73778 conformtest: Correct pwd.h expectations for XPG3.
This patch corrects some conformtest expectations for pwd.h for XPG4.

Tested for x86_64 and x86.

	* conform/data/pwd.h-data (endpwent): Do not expect for [XPG3].
	(getpwent): Likewise.
	(setpwent): Likewise.
	* conform/Makefile (test-xfail-XPG3/pwd.h/conform): Remove
	variable.
2016-05-19 14:48:30 +00:00
Joseph Myers 4c9695fa8e conformtest: Correct search.h expectations for XPG3.
This patch corrects some conformtest expectations for search.h for
XPG3.

Tested for x86_64 and x86.

	* conform/data/search.h-data (insque): Do not expect for [XPG3].
	(remque): Likewise.
	* conform/Makefile (test-xfail-XPG3/search.h/conform): Remove
	variable.
2016-05-19 14:35:41 +00:00
Joseph Myers 0014680d6a Do not declare grantpt, ptsname, unlockpt in stdlib.h for XPG3 (bug 20094).
stdlib.h declares grantpt, ptsname, unlockpt for __USE_XOPEN.  This
patch corrects the condition to __USE_XOPEN_EXTENDED (these functions
are new in XPG4).

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

	[BZ #20094]
	* stdlib/stdlib.h (grantpt): Declare if [__USE_XOPEN_EXTENDED],
	not [__USE_XOPEN].
	(unlockpt): Likewise.
	(ptsname): Likewise.
	* conform/Makefile (test-xfail-XPG3/stdlib.h/conform): Remove
	variable.
2016-05-17 15:51:55 +00:00
Joseph Myers 9ff81856db Make sys/stat.h define S_IFSOCK, S_ISSOCK for XPG4 (bug 20076).
sys/stat.h should define S_IFSOCK and S_ISSOCK for XPG4 (XNS), but
does not.  This patch corrects the relevant header conditionals.

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

	[BZ #20076]
	* io/sys/stat.h (S_IFSOCK): Define for [__USE_XOPEN_EXTENDED]
	instead of [__USE_UNIX98].
	(S_ISSOCK): Likewise.
	* conform/Makefile (test-xfail-XPG4/sys/stat.h/conform): Remove
	variable.
2016-05-17 15:50:00 +00:00
Joseph Myers b098852ac2 Fix stdlib.h rand_r namespace (bug 20074).
stdlib.h declares rand_r if __USE_POSIX; i.e., POSIX.1:1990.  But
rand_r was added along with threads, so the condition should be
__USE_POSIX199506.  This patch corrects the condition.

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

	[BZ #20074]
	* stdlib/stdlib.h (rand_r): Declare if [__USE_POSIX199506], not if
	[__USE_POSIX].
	* conform/Makefile (test-xfail-XPG4/stdlib.h/conform): Remove
	variable.
2016-05-17 15:48:29 +00:00
Joseph Myers 4242d9683f Correct ttyslot header declaration conditions (bug 20051).
UNIX98 and XPG4 have ttyslot in <stdlib.h>.  glibc, however, has it in
<unistd.h>, for __USE_MISC || (__USE_XOPEN_EXTENDED && !__USE_UNIX98),
but no supported standard has it in <unistd.h>.

This patch adds a properly conditioned declaration to <stdlib.h> (only
enabled for the relevant standards, not for __USE_MISC or __USE_GNU).
The <unistd.h> declaration is restricted to __USE_MISC.  Some relevant
XFAILs are removed.

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

	[BZ #20051]
	* posix/unistd.h [__USE_XOPEN_EXTENDED && !__USE_UNIX98]
	(ttyslot): Do not declare.
	* stdlib/stdlib.h [__USE_XOPEN_EXTENDED && !__USE_XOPEN2K]
	(ttyslot): New prototype.
	* conform/Makefile (test-xfail-XPG4/unistd.h/conform): Remove
	variable.
	(test-xfail-UNIX98/stdlib.h/conform): Likewise.
2016-05-17 15:47:20 +00:00
Joseph Myers fdbdbc83a5 conformtest: Correct some stdlib.h expectations for XPG3.
This patch corrects some spurious conformtest stdlib.h expectations
for XPG3 (not based on a full review of the expectations for that
standard, so other issues may remain).

Tested for x86_64 and x86.

	* conform/data/stdlib.h-data (a64l): Do not expect for [XPG3].
	(ecvt): Likewise.
	(fcvt): Likewise.
	(gcvt): Likewise.
	(getsubopt): Likewise.
	(grantpt): Likewise.
	(initstate): Likewise.
	(l64a): Likewise.
	(mktemp): Likewise.
	(mkstemp): Likewise.
	(ptsname): Likewise.
	(random): Likewise.
	(realpath): Likewise.
	(setstate): Likewise.
	(srandom): Likewise.
	(ttyslot): Likewise.
	(unlockpt): Likewise.
	(valloc): Likewise.
2016-05-13 17:26:04 +00:00
Joseph Myers 8142262bc5 conformtest: Do not expect strdup in string.h for XPG3.
This patch corrects a spurious conformtest expectation of strdup in
string.h for XPG3.

Tested for x86_64 and x86.

	* conform/data/string.h-data (strdup): Do not expect for [XPG3].
	* conform/Makefile (test-xfail-XPG3/string.h/conform): Remove
	variable.
2016-05-13 16:57:09 +00:00
Joseph Myers 567c710bca conformtest: Correct time.h XPG3 expectations.
This patch corrects spurious conformtest expectations of getdate and
getdate_err for XPG3.  (This is not based on a full review of the
expectations, so there may be other issues where the header and tests
agree but are both incorrect.)

Tested for x86_64 and x86.

	* conform/data/time.h-data (getdate_err): Do not expect for
	[XPG3].
	(getdate): Likewise.
	* conform/Makefile (test-xfail-XPG3/time.h/conform): Remove
	variable.
2016-05-12 20:47:15 +00:00
Joseph Myers 7f8843c92a conformtest: Correct some unistd.h expectations for XPG3, XPG4.
The conformtest tests of unistd.h fail for XPG3 because of various
expectations that are incorrect for XPG3.  This patch corrects those
bogus expectations, and one bogus expectation for XPG4.  (This is not
based on a full review of the standards so there may well still be
other bugs in the expectations for this header.)

Tested for x86_64 and x86.

	* conform/data/unistd.h-data (F_LOCK): Do not expect for [XPG3].
	(F_ULOCK): Likewise.
	(F_TEST): Likewise.
	(F_TLOCK): Likewise.
	(useconds_t): Likewise.
	(intptr_t): Do not expect for [XPG3] or [XPG4].
	(brk): Do not expect for [XPG3]
	(fchown): Likewise.
	(fchdir): Likewise.
	(ftruncate): Likewise.
	(getdtablesize): Likewise.
	(gethostid): Likewise.
	(getpagesize): Likewise.
	(getpgid): Likewise.
	(getsid): Likewise.
	(getwd): Likewise.
	(lchown): Likewise.
	(lockf): Likewise.
	(readlink): Likewise.
	(sbrk): Likewise.
	(setpgrp): Likewise.
	(setregid): Likewise.
	(setreuid): Likewise.
	(symlink): Likewise.
	(sync): Likewise.
	(truncate): Likewise.
	(ualarm): Likewise.
	(usleep): Likewise.
	(vfork): Likewise.
	* conform/Makefile (test-xfail-XPG3/unistd.h/conform): Remove
	variable.
2016-05-12 17:39:04 +00:00
Joseph Myers 612fe43275 Declare gethostname for XPG4 (bug 20054).
unistd.h declares gethostname for __USE_UNIX98 || __USE_XOPEN2K.  But
it's also in XPG4 (XNS volume - C438 - not the main definitions of
system interfaces and headers in C435).  This patch corrects the
condition.

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

	[BZ #20054]
	* posix/unistd.h (gethostname): Declare if [__USE_XOPEN_EXTENDED],
	not [__USE_UNIX98].
	* conform/data/unistd.h-data (gethostname): Do not expect for
	[XPG3].
2016-05-12 16:50:43 +00:00
Joseph Myers ca927ec4c2 conformtest: Do not expect S_IF* in fcntl.h.
The conform/ tests for fcntl.h are failing for XPG3 and XPG4 because
of missing S_IFSOCK.

This is a case of a bogus test.  The relevant wording requiring such
constants is, in current POSIX (and this requirement dates back as far
as XPG4), "The <fcntl.h> header shall define the symbolic constants
for file modes for use as values of mode_t as described in
<sys/stat.h>.".  Note that this is *file modes* not *file types*.
That makes sense, since the point is presumably for use with functions
such as open that are declared in fcntl.h, where file modes are
relevant but file types aren't.  So this patch removes all those
spurious S_IF* expectations for fcntl.h (the macros are generally
still *allowed* through the permission to make everything from
sys/stat.h visible).

Tested for x86_64 and x86.

	* conform/data/fcntl.h-data [!POSIX] (S_IFMT): Do not expect.
	[!POSIX] (S_IFBLK): Likewise.
	[!POSIX] (S_IFCHR): Likewise.
	[!POSIX] (S_IFIFO): Likewise.
	[!POSIX] (S_IFREG): Likewise.
	[!POSIX] (S_IFDIR): Likewise.
	[!POSIX] (S_IFLNK): Likewise.
	[!POSIX] (S_IFSOCK): Likewise.
	* conform/Makefile (test-xfail-XPG3/fcntl.h/conform): Remove
	variable.
	(test-xfail-XPG4/fcntl.h/conform): Likewise.
2016-05-12 16:46:55 +00:00
Joseph Myers b7db760660 Declare tcgetsid for XPG4 (bug 20055).
termios.h should declare tcgetsid for XPG4, but only does so for
__USE_UNIX98 || __USE_XOPEN2K8 at present.  This patch fixes the
declaration conditions.  A spurious conformtest expectation of this
declaration for XPG3 is removed, and two XFAILs that are fixed by
these changes are also removed.

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

	[BZ #20055]
	* termios/termios.h (pid_t): Define for [__USE_XOPEN_EXTENDED]
	instead of [__USE_UNIX98].
	(tcgetsid): Declare for [__USE_XOPEN_EXTENDED] instead of
	[__USE_UNIX98].
	* conform/data/termios.h-data (tcgetsid): Do not expect for
	[XPG3].
	* conform/Makefile (test-xfail-XPG3/termios.h/conform): Remove
	variable.
	(test-xfail-XPG4/termios.h/conform): Likewise.
2016-05-11 18:05:37 +00:00
Joseph Myers 8da7d8f877 Fix sys/stat.h fchmod namespace (bug 20073).
sys/stat.h declares fchmod if __USE_POSIX (i.e. POSIX.1:1990).  But it
was actually added in 1993 and also in XPG4.  This patch changes the
conditions to the correct __USE_POSIX199309 || __USE_XOPEN_EXTENDED.

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

	[BZ #20073]
	* io/sys/stat.h (fchmod): Declare for
	[__USE_POSIX199309 || __USE_XOPEN_EXTENDED], not [__USE_POSIX].
	* conform/Makefile (test-xfail-XPG3/sys/stat.h/conform): Remove
	variable.
2016-05-10 21:52:08 +00:00
Joseph Myers 23f3a3b5d4 conformtest: Correct some sys/stat.h expectations for XPG3.
This patch fixes various conformtest sys/stat.h expectations that were
incorrect for XPG3 (not based on a full review, so not necessarily an
exhaustive set of such corrections).  Most of these corrections fix
spurious failures shown in testing (but that for fchmod introduces a
correct failure, as that function is wrongly declared for XPG3, so
this doesn't eliminate any XFAILs).

Tested for x86_64 and x86.

	* conform/data/sys/stat.h-data [XPG3] (S_IFLNK): Do not expect.
	[XPG3] (S_IFSOCK): Likewise.
	[XPG3] (S_ISVTX): Likewise.
	[XPG3] (S_ISLNK): Likewise.
	[XPG3] (S_ISSOCK): Likewise.
	[XPG3] (fchmod): Likewise.
	[XPG3] (lstat): Likewise.
	[XPG3] (mknod): Likewise.
2016-05-10 17:48:23 +00:00
Joseph Myers 77d21a1f4f conformtest: Fix st_blksize, st_blocks expectations for XPG3, XPG4.
The conformtest expectations expect the struct stat fields st_blksize
and st_blocks to be of types blksize_t and blkcnt_t.  But XPG4 does
not have those types, using long instead, and XPG3 does not have these
fields at all.  This patch adjusts the expectations for those
standards, XFAILing them for XPG4 to allow for systems where the
typedefs don't correspond to long.

Tested for x86_64 and x86.

	* conform/data/sys/stat.h-data (st_blksize): Do not expect for
	[XPG3].  Expect type long and XFAIL for [XPG4].
	(st_blocks): Likewise.
2016-05-10 15:20:09 +00:00
Joseph Myers 46c1ffa4d5 Declare pthread_atfork in unistd.h for UNIX98 (bug 20044).
For UNIX98 (only), unistd.h should declare pthread_atfork, but that
declaration is missing.  This patch adds it.

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

	[BZ #20044]
	* posix/unistd.h [__USE_UNIX98 && !__USE_XOPEN2K]
	(pthread_atfork): New prototype.
	* conform/Makefile (test-xfail-UNIX98/unistd.h/conform): Remove
	variable.
2016-05-10 14:57:58 +00:00
Joseph Myers 9e6e128d14 conformtest: Remove some bogus sys/types.h expectations for XPG3 and XPG4.
The conformtest tests for sys/types.h for XPG3 and XPG4 fail because
of missing blksize_t.  This is a bug in the expectations; that type is
not part of those standards.  This patch stops the tests from
expecting it, and some other types that also are not part of XPG3 and
XPG4.

Tested for x86_64 and x86.

	* conform/data/sys/types.h-data (blkcnt_t): Do not expect for
	[XPG3 || XPG4].
	(blksize_t): Likewise.
	(clockid_t): Likewise.
	* conform/Makefile (test-xfail-XPG3/sys/types.h/conform): Remove
	variable.
	(test-xfail-XPG4/sys/types.h/conform): Likewise.
2016-05-09 21:10:10 +00:00
Joseph Myers 2faba597ec Fix sys/time.h timespec namespace (bug 20041).
For UNIX98 and older standards, sys/time.h should not define struct
timespec, but does so via the inclusion of sys/select.h (which is a
new header in the 2001 edition of POSIX, and defines struct timespec
because of the declaration of pselect, a new function in the 2001
edition of POSIX).  In turn, this affects some other headers that
themselves include sys/time.h.

This patch fixes this by conditioning the __need_timespec definition
in sys/select.h on __USE_XOPEN2K, the same condition used there for
the declaration of pselect (this has no effect on direct uses of
sys/select.h with feature test macros for any standard that includes
that header, since such standards result in __USE_XOPEN2K being
defined).

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

	[BZ #20041]
	* misc/sys/select.h (__need_timespec): Only define if
	[__USE_XOPEN2K].
	* conform/Makefile (test-xfail-XPG4/sys/time.h/conform): Remove
	variable.
	(test-xfail-XPG4/utmpx.h/conform): Likewise.
	(test-xfail-UNIX98/sys/time.h/conform): Likewise.
	(test-xfail-UNIX98/utmpx.h/conform): Likewise.
2016-05-03 23:36:18 +00:00
Joseph Myers 35281b18b8 Fix fcntl.h timespec namespace (bug 20023).
fcntl.h defines struct timespec if __USE_XOPEN || __USE_XOPEN2K8.  But
(a) the subsequent bits/stat.h include only needs it if __USE_XOPEN2K8
and (b) older standards did not allow struct timespec here.  (It's
allowed for newer standards by virtue of the permission to include
symbols from sys/stat.h.  But sys/stat.h is only required to provide
struct timespec from the 2008 edition of POSIX onwards, and permitted
by the 2004 TC to the 2001 edition in anticipation of the addition of
nanosecond timestamp support to struct stat in the 2008 edition.)

This patch limits the timespec definition to the __USE_XOPEN2K8 case,
that being the only case where it is actually needed for the
<bits/stat.h> include.

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

	[BZ #20023]
	* io/fcntl.h [__USE_XOPEN && !__USE_XOPEN2K8]: Do not include
	<time.h>.
	* conform/Makefile (test-xfail-UNIX98/fcntl.h/conform): Remove
	variable.
	(test-xfail-XOPEN2K/fcntl.h/conform): Likewise.
2016-05-02 23:20:33 +00:00
Joseph Myers a7657f3012 Fix stdio.h namespace for pre-threads POSIX (bug 20014).
stdio.h declares flockfile, ftrylockfile, funlockfile, getc_unlocked,
getchar_unlocked, putc_unlocked and putchar_unlocked if __USE_POSIX,
with comments "These are defined in POSIX.1:1996.".  But __USE_POSIX
is actually POSIX.1:1990, and these functions should not be declared
for 1990 / 1992 / 1993 POSIX, XPG3 or XPG4.  This patch fixes stdio.h
to use __USE_POSIX199506 instead for those conditionals, as that is
the correct conditional for the version of POSIX that introduced
threads, and with threads those functions.

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

	[BZ #20014]
	* libio/stdio.h (getc_unlocked): Declare if [__USE_POSIX199506],
	not [__USE_POSIX].
	(getchar_unlocked): Likewise.
	(putc_unlocked): Likewise.
	(putchar_unlocked): Likewise.
	(flockfile): Likewise.
	(ftrylockfile): Likewise.
	(funlockfile): Likewise.
	* conform/Makefile (test-xfail-XPG3/stdio.h/conform): Remove
	variable.
	(test-xfail-XPG4/stdio.h/conform): Likewise.
2016-04-28 22:01:04 +00:00
Joseph Myers 022d239b5d conformtest: Add langinfo.h expectations for YESSTR, NOSTR.
The conformtest expectations for langinfo.h fail to include the YESSTR
and NOSTR constants that were present in UNIX98 and earlier XPG
standards.  This patch adds those expectations, so fixing three
XFAILs.

Tested for x86_64 and x86.

	* conform/data/langinfo.h-data [XPG3 || XPG4 || UNIX98] (YESSTR):
	Expect constant.
	[XPG3 || XPG4 || UNIX98] (NOSTR): Likewise.
	* conform/Makefile (test-xfail-XPG3/langinfo.h/conform): Remove
	variable.
	(test-xfail-XPG4/langinfo.h/conform): Likewise.
	(test-xfail-UNIX98/langinfo.h/conform): Likewise.
2016-04-28 17:19:53 +00:00
Joseph Myers 10b8108aec Also define off_t in stdio.h for UNIX98.
Similar to my previous fix for XOPEN2K
<https://sourceware.org/ml/libc-alpha/2016-04/msg00631.html>, now that
bugs in the conformtest expectations for stdio.h for UNIX98 have been
corrected, that case too fails because fseeko and ftello are now
correctly expected, but off_t is not defined.  As in that fix, it
seems appropriate to define off_t in stdio.h for this standard as
well, and this patch does so.

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

	* libio/stdio.h (off_t): Also define if [__USE_UNIX98].
	[__USE_LARGEFILE64] (off64_t): Likewise.
	* conform/Makefile (test-xfail-UNIX98/stdio.h/conform): Remove
	variable.
2016-04-28 17:00:52 +00:00
Joseph Myers 9a018860a7 conformtest: Correct stdio.h expectations for fdopen.
The conform/ test of stdio.h wrongly does not expect fdopen for XPG3
and XPG4.  fdopen is in those standards; this patch corrects the
expectations.

Tested for x86_64 and x86.

	* conform/data/stdio.h-data (fdopen): Expect also for
	[XPG3 || XPG4].
2016-04-27 21:28:58 +00:00
Joseph Myers 1876dfe4c3 conformtest: Correct some stdio.h expectations for UNIX98.
The conform/ test of stdio.h for UNIX98 fails with surious namespace
errors for functions that are correctly declared for that standard.
This patch fixes the expectations to expect those functions also for
UNIX98.  (This does not by itself fix the XFAIL of that test, and is
not based a full review of the header expectations so there could
still be other bugs in the expectations for this header for UNIX98.)

Tested for x86_64 and x86.

	* conform/data/stdio.h-data (flockfile): Also expect for [UNIX98].
	(fseeko): Likewise.
	(ftello): Likewise.
	(ftrylockfile): Likewise.
	(funlockfile): Likewise.
	(getc_unlocked): Likewise.
	(getchar_unlocked): Likewise.
	(putc_unlocked): Likewise.
	(putchar_unlocked): Likewise.
2016-04-27 21:17:00 +00:00
Joseph Myers 9f57e65c93 conformtest: Correct some signal.h expectations for XOPEN2K.
The conformtest expectations for signal.h have various declarations
that are expected for POSIX (1996) and all later standards, except,
wrongly, for XOPEN2K.  This shows up as failures of tests for two
other headers, which are allowed to make visible symbols from
signal.h, because of an incorrect namespace failure for sigval
(required in signal.h in XOPEN2K, so should be allowed for those other
headers); signal.h tests for various standards fail anyway because of
other problems in the header.  This patch fixes the incorrect
expectations and removes the two XFAILs that this fixes.

Tested for x86_64 and x86.

	* conform/data/signal.h-data (union sigval): Expect also if
	[XOPEN2K].
	(struct sigevent): Likewise.
	(SIGEV_NONE): Likewise.
	(SIGEV_SIGNAL): Likewise.
	(SIGEV_THREAD): Likewise.
	(SIGRTMIN): Likewise.
	(SIGRTMAX): Likewise.
	* conform/Makefile (test-xfail-XOPEN2K/aio.h/conform): Remove
	variable.
	(test-xfail-XOPEN2K/mqueue.h/conform): Likewise.
2016-04-27 14:03:14 +00:00
Joseph Myers 085bbece2c Fix langinfo.h nl_langinfo_l namespace (bug 19996).
langinfo.h declares nl_langinfo_l if __USE_XOPEN2K.  But this function
was new in the 2008 edition of POSIX.  This patch fixes the condition
accordingly.

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

	[BZ #19996]
	* locale/langinfo.h (nl_langinfo_l): Declare if [__USE_XOPEN2K8],
	not [__USE_XOPEN2K].
	* conform/Makefile (test-xfail-XOPEN2K/langinfo.h/conform): Remove
	variable.
2016-04-26 15:02:26 +00:00
Joseph Myers 6da052fd6a conformtest: Correct XOPEN2K stdarg.h expectations.
The conform/ test expectations for stdarg.h were wrongly missing an
expectation of va_copy for XOPEN2K (based on C99, so including that
macro).  This patch fixes this.

Tested for x86_64 and x86.

	* conform/data/stdarg.h-data [XOPEN2K] (va_copy): Require macro.
	* conform/Makefile (test-xfail-XOPEN2K/stdarg.h/conform): Remove
	variable.
2016-04-26 13:56:04 +00:00
Joseph Myers bf07472615 Define off_t in stdio.h for XOPEN2K.
The header conformance test for stdio.h for XOPEN2K fails because the
header does not define the off_t type, used in the expected
declarations for fseeko and ftello.

The absence of this type is not actually strictly a bug (hence no bug
report being filed in Bugzilla), since POSIX didn't require the type
to be declared in this header until the 2008 edition.  However, the
glibc convention in such cases - where the type falls under the
general *_t POSIX reservation, and so it's OK to define it for all
POSIX versions - is to make the headers self-contained in this regard
even for the older POSIX versions not requiring the type to be defined
despite including other declarations depending on the type.  Thus,
this patch adjusts the condition in the header and removes the XFAIL
(rather than adapting the expectation to work when the functions are
declared using __off_t without off_t being defined).

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

	* libio/stdio.h (off_t): Define if [__USE_XOPEN2K], not
	[__USE_XOPEN2K8].
	[__USE_LARGEFILE64] (off64_t): Likewise.
	* conform/Makefile (test-xfail-XOPEN2K/stdio.h/conform): Remove
	variable.
2016-04-26 09:55:47 +00:00
Joseph Myers 12404bb04e Fix stdio.h cuserid namespace (bug 19989).
stdio.h declares cuserid if __USE_XOPEN.  But this was removed in the
2001 edition of POSIX.

The #endif comment "Use X/Open, but not issue 6." reflects the correct
logic, but does not correspond to the #ifdef.  The use of a correct
libc-hacker.  The online archives for libc-hacker in August 2000 are
broken, but the messages can be found in the qmail archives in
/sourceware1/qmail/lists-sourceware/libc-hacker/archive/26 if you have
shell access to sourceware.

The issue showed up in August 2000 because of a warning about a
non-prototype definition in sysdeps/posix/cuserid.c when there was no
previous prototype declaration.  Since we've now eliminated
non-prototype function definitions, that issue does not apply.  The
other points from that discussion were about whether it should be
included in _GNU_SOURCE; whether _GNU_SOURCE should include
"everything"; whether deprecated interfaces such as this should be
excluded from it; and whether, even given exclusion of deprecated
interfaces, it should apply for deprecations in a version of POSIX
that at that time had not been released.

This patch follows the more conservative approach to a fix of keeping
the interface in _GNU_SOURCE.  That matches how L_cuserid is handled.
I think there is a strong case for eliminating this interface from
_GNU_SOURCE (but this may not automatically be the case for every
interface removed in newer POSIX versions), but then L_cuserid should
also be removed from _GNU_SOURCE (in stdio-common/stdio_lim.h.in) at
the same time.

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

	[BZ #19989]
	* libio/stdio.h (cuserid): Do not declare if
	[__USE_XOPEN2K && !__USE_GNU].
	* conform/Makefile (test-xfail-XOPEN2K8/stdio.h/conform): Remove
	variable.
2016-04-25 19:29:44 +00:00
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