All the crypt related functions, cryptographic algorithms, and
make requirements are removed, with only the exception of md5
implementation which is moved to locale folder since it is
required by localedef for integrity protection (libc's
locale-reading code does not check these, but localedef does
generate them).
Besides thec code itself, both internal documentation and the
manual is also adjusted. This allows to remove both --enable-crypt
and --enable-nss-crypt configure options.
Checked with a build for all affected ABIs.
Co-authored-by: Zack Weinberg <zack@owlfolio.org>
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
I used these shell commands:
../glibc/scripts/update-copyrights $PWD/../gnulib/build-aux/update-copyright
(cd ../glibc && git commit -am"[this commit message]")
and then ignored the output, which consisted lines saying "FOO: warning:
copyright statement not found" for each of 7061 files FOO.
I then removed trailing white space from math/tgmath.h,
support/tst-support-open-dev-null-range.c, and
sysdeps/x86_64/multiarch/strlen-vec.S, to work around the following
obscure pre-commit check failure diagnostics from Savannah. I don't
know why I run into these diagnostics whereas others evidently do not.
remote: *** 912-#endif
remote: *** 913:
remote: *** 914-
remote: *** error: lines with trailing whitespace found
...
remote: *** error: sysdeps/unix/sysv/linux/statx_cp.c: trailing lines
My glibc bot showed that my conformtest changes fail the build of the
conformtest execution tests for x86_64-linux-gnu-static-pie, because
linking the newly built object with the newly built libc and the
associated options normally used for linking requires it to be built
as PIE. Add $(pie-default) to the compiler command used so that PIE
options are used when required.
There's a case for using the whole of $(CFLAGS-.o) (which includes
$(pie-default)), but that raises questions of any impact from using
optimization flags from CFLAGS in these tests. So for now just use
$(pie-default) as the key part of $(CFLAGS-.o) that's definitely
needed.
Tested with build-many-glibcs.py for x86_64-linux-gnu-static-pie.
Although the conform/ header tests are built using the headers of the
glibc under test, the execution tests from conformtest (a few tests of
the values of macros evaluating to string constants) are linked and
run with system libc, not the newly built libc.
Apart from preventing testing in cross environments, this can be a
problem even for native testing. Specifically, it can be useful to do
native testing when building with a cross compiler that links with a
libc that is not the system libc; for example, on x86_64, you can test
all three ABIs that way if the kernel support is present, even if the
host OS lacks 32-bit or x32 libraries or they are older than the
libraries in the sysroot used by the compiler used to build glibc.
This works for almost all tests, but not for these conformtest tests.
Arrange for conformtest to link and run test programs similarly to
other tests, with consequent refactoring of various variables in
Makeconfig to allow passing relevant parts of the link-time command
lines down to conformtest. In general, the parts of the link command
involving $@ or $^ are separated out from the parts that should be
passed to conformtest (the variables passed to conformtest still
involve various variables whose names involve $(@F), but those
variables simply won't be defined for the conformtest makefile rules
and I think their presence there is harmless).
This is also most of the support that would be needed to allow running
those tests of string constants for cross testing when test-wrapper is
defined. That will also need changes to where conformtest.py puts the
test executables, so it puts them in the main object directory
(expected to be shared with a test system in cross testing) rather
than /tmp (not expected to be shared) as at present.
Tested for x86_64.
No "#pragma GCC" pragma allows macro-expansion of its arguments, so no
namespace issues arise from use of such pragmas in installed headers.
Ignore them in conformtest tests of header namespace.
Tested for x86_64, in conjunction with Paul's patch
<https://sourceware.org/pipermail/libc-alpha/2021-August/130571.html>
adding use of such pragmas to installed headers shared with gnulib.
I used these shell commands:
../glibc/scripts/update-copyrights $PWD/../gnulib/build-aux/update-copyright
(cd ../glibc && git commit -am"[this commit message]")
and then ignored the output, which consisted lines saying "FOO: warning:
copyright statement not found" for each of 6694 files FOO.
I then removed trailing white space from benchtests/bench-pthread-locks.c
and iconvdata/tst-iconv-big5-hkscs-to-2ucs4.c, to work around this
diagnostic from Savannah:
remote: *** pre-commit check failed ...
remote: *** error: lines with trailing whitespace found
remote: error: hook declined to update refs/heads/master
The new __proc_waitid RPC now expects WEXITED to be passed, allowing to
properly implement waitid, and thus define the missing W* macros
(according to FreeBSD values).
Change all of the #! lines in Python scripts that are called from
Makefiles to reference /usr/bin/python3.
All of the scripts called from Makefiles are already run with Python 3,
so let's make sure they are explicitly using Python 3 if called
manually.
This patch sets the mode field in ipc_perm as mode_t for all architectures,
as POSIX specification [1]. The changes required are as follow:
1. It moves the ipc_perm definition out of ipc.h to its own header
ipc_perm.h. It also allows consolidate the IPC_* definition on
only one header.
2. The generic implementation follow the kernel ipc64_perm size so the
syscall can be made directly without temporary buffer copy. However,
since glibc defines the MODE field as mode_t, it omits the __PAD1 field
(since glibc does not export mode_t as 16-bit for any architecture).
It is a two-fold improvement:
2.1. New implementation which follow Linux UAPI will not need to
provide an arch-specific ipc-perm.h header neither wrongly
use the wrong 16-bit definition from previous default ipc.h
(as csky did).
2.1. It allows consolidate ipc_perm definition for architectures that
already provide mode_t as 32-bit.
3. All kernel ABIs for the supported architectures already provides the
expected padding for mode type extension to 32-bit. However, some
architectures the padding has the wrong placement, so it requires
the ipc control routines (msgctl, semctl, and shmctl) to adjust the
mode field accordingly. Currently they are armeb, microblaze, m68k,
s390, and sheb.
A new assume is added, __ASSUME_SYSVIPC_BROKEN_MODE_T, which the
required ABIs define.
4. For the ABIs that define __ASSUME_SYSVIPC_BROKEN_MODE_T, it also
require compat symbols that do not adjust the mode field.
Checked on arm-linux-gnueabihf, aarch64-linux-gnu, powerpc64le-linux-gnu,
and x86_64-linux-gnu. I also checked the sysvipc tests on hppa-linux-gnu,
sh4-linux-gnu, s390x-linux-gnu, and s390-linux-gnu.
I also did a sanity test against armeb qemu usermode for the sysvipc
tests.
[BZ #18231]
* sysdeps/unix/sysv/linux/Makefile (sysdep_headers): Add
bits/ipc-perm.h.
* sysdeps/unix/sysv/linux/aarch64/bits/ipc.h: Remove file.
* sysdeps/unix/sysv/linux/alpha/bits/ipc.h: Likewise.
* sysdeps/unix/sysv/linux/hppa/bits/ipc.h: Likewise.
* sysdeps/unix/sysv/linux/ia64/bits/ipc.h: Likewise.
* sysdeps/unix/sysv/linux/mips/bits/ipc.h: Likewise.
* sysdeps/unix/sysv/linux/powerpc/bits/ipc.h: Likewise.
* sysdeps/unix/sysv/linux/s390/bits/ipc.h: Likewise.
* sysdeps/unix/sysv/linux/sparc/bits/ipc.h: Likewise.
* sysdeps/unix/sysv/linux/arm/kernel-features.h
[__BYTE_ORDER == __BIG_ENDIAN] (__ASSUME_SYSVIPC_BROKEN_MODE_T):
Define.
* sysdeps/sysv/linux/microblaze/kernel-features.h: Likewise.
* sysdeps/unix/sysv/linux/s390/kernel-features.h
[!__s390x__] (__ASSUME_SYSVIPC_BROKEN_MODE_T): Define.
* sysdeps/unix/sysv/linux/sh/kernel-features.h
(__ASSUME_SYSVIPC_BROKEN_MODE_T): Define.
* sysdeps/unix/sysv/linux/m68k/kernel-features.h: Likewise.
* sysdeps/unix/sysv/linux/bits/ipc-perm.h: New file.
* sysdeps/unix/sysv/linux/powerpc/bits/ipc-perm.h: Likewise.
* sysdeps/unix/sysv/linux/sparc/bits/ipc-perm.h: Likewise.
* sysdeps/unix/sysv/linux/bits/ipc.h (ipc_perm): Move to
bits/ipc-perm.h.
* sysdeps/unix/sysv/linux/hppa/bits/ipc-perm.h: New file.
* sysdeps/unix/sysv/linux/kernel-features.h: Add comment about
__ASSUME_SYSVIPC_BROKEN_MODE_T semantic.
* sysdeps/unix/sysv/linux/msgctl.c (DEFAULT_VERSION): Define as
2.31 if __ASSUME_SYSVIPC_BROKEN_MODE_T is defined.
(msgctl_syscall, __msgctl_mode16): New symbol.
(__new_msgctl): Add bits for __ASSUME_SYSVIPC_BROKEN_MODE_T.
* sysdeps/unix/sysv/linux/semctl.c: Likewise.
* sysdeps/unix/sysv/linux/shmctl.c: Likewise.
* sysdeps/unix/sysv/linux/arm/be/libc.abilist (GLIBC_2.31): Add
msgctl, semctl, and shmctl.
* sysdeps/sysv/linux/microblaze/be/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/s390/s390-32/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/sh/be/libc.abilist: Likewise.
* conform/data/sys/ipc.h-data: Only xfail {struct ipc_perm} mode_t
mode for Hurd.
* sysdeps/unix/sysv/linux/m68k/Versions (libc) [GLIBC_2.31]: Add
msgctl, semctl, and shmctl.
* sysdeps/unix/sysv/linux/arm/be/Versions: New file.
* sysdeps/unix/sysv/linux/microblaze/be/Versions: Likewise.
* sysdeps/unix/sysv/linux/sh/be/Versions: Likewise.
[1] http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_ipc.h.html
The stub implementations are turned into compat symbols.
Linux actually has two reserved system call numbers (for getpmsg
and putpmsg), but these system calls have never been implemented,
and there are no plans to implement them, so this patch replaces
the wrappers with the generic stubs.
According to <https://bugzilla.redhat.com/show_bug.cgi?id=436349>,
the presence of the XSI STREAMS declarations is a minor portability
hazard because they are not actually implemented.
This commit does not change the TIRPC support code in
sunrpc/rpc_svcout.c. It uses additional XTI functionality and
therefore never worked with glibc.
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
In <https://sourceware.org/ml/libc-alpha/2018-11/msg00225.html>,
Florian reported that the change from conformtest.pl to conformtest.py
had increased conform/ test time, possibly because of increased
startup overhead for Python scripts.
This patch improves conformtest.py performance by arranging for as
many tests of a (header, standard) pair as possible to use a single
execution of the compiler, so it does not need to initialize and parse
the whole header under test separately for every test assertion.
Specifically, compilation tests that are not marked as "optional" or
"xfail" are combined into a single source file, and are only then run
separately if compilation of that combined file fails. For me, this
reduces the wall clock time for the conformtest.py tests (not the
whole of the conform/ directory) from two minutes to 15 seconds.
Tested for x86_64, and with build-many-glibcs.py.
* conform/conformtest.py (CompileSubTest.__init__): Set
self.run_early to False.
(ExecuteSubTest.__init__): Likewise.
(HeaderTests.run): Try running all non-optional, non-XFAILed
compilation tests in a single execution of the compiler.
This patch continues moving conformtest towards running more tests in
a single compiler execution by separating the generation and execution
of the subtests of each test.
Instead of test classes having a run method that both generates the
text of the programs to be compiled or executed, and compiles or
executes them, they are changed to having a gen_subtests method that
just generates CompileSubTest and ExecuteSubTest objects to store the
subtest names and text, and then a separate loop in HeaderTests.run
deals with actually executing those subtests.
This will allow for future changes to extract the text for all
non-optional, non-xfail compilation subtests to try compiling those
all at once, with separate compilations only if that fails, so
massively reducing the number of separate compiler executions (each of
which needs to parse the entire contents of the header under test, in
addition to the startup cost that applies even for compiling an empty
file).
Tested for x86_64, and with build-many-glibcs.py.
* conform/conformtest.py (CompileSubTest): New class.
(ExecuteSubTest): Likewise.
(ElementTest.run): Rename to gen_subtests. Append tests to
self.subtests instead of running them.
(ConstantTest.run): Likewise.
(SymbolTest.run): Likewise.
(TypeTest.run): Likewise.
(TagTest.run): Likewise.
(FunctionTest.run): Likewise.
(VariableTest.run): Likewise.
(MacroFunctionTest.run): Likewise.
(MacroStrTest.run): Likewise.
(HeaderTests.handle_test_line): Generate subtests for tests.
(HeaderTests.run): Run subtests for tests.
This patch makes tests in conformtest use unique identifiers, in
preparation for trying to cover more tests in a single compilation to
speed up these tests as suggested in
<https://sourceware.org/ml/libc-alpha/2018-11/msg00229.html>.
Tests are assigned a number, used in generating identifiers; where a
single call to a run method does multiple compilations (sharing that
number), identifiers are changed as needed to avoid duplication
between those compilations, so they can be combined in future.
Large numbers of positional arguments to format strings make the code
harder to follow, and using the test numbers serves to increase the
number of arguments to such format strings, so the code is generally
changed to use %(name)s where all the arguments come from attributes
of the test object and so vars(self) is sufficient to provide all
those names for the format string. Cases where some arguments aren't
attributes of self still use positional format arguments.
Tested for x86_64, and with build-many-glibcs.py.
* conform/conformtest.py (ElementTest.run): Use unique identifiers
in tests. Use names for format arguments.
(ConstantTest.run): Likewise.
(SymbolTest.run): Likewise.
(TypeTest.run): Likewise.
(TagTest.run): Likewise.
(FunctionTest.run): Likewise.
(VariableTest.run): Likewise.
(MacroFunctionTest.run): Likewise.
(MacroStrTest.run): Likewise.
(HeaderTests.__init__): Set self.num_tests.
(HeaderTests.handle_test_line): Set test.num. Increment
self.num_tests.
conform/Makefile creates $(@D)/scratch for the per-standard per-header
tests. That directory was formerly used by the Perl scripts for
temporary files, but the Python implementations use
tempfile.TemporaryDirectory to get such files cleaned up
automatically. This patch changes the Makefile to create only $(@D)
(required for the output redirection to work), not the scratch
subdirectory.
Tested for x86_64.
* conform/Makefile ($(conformtest-header-tests)): Create $(@D),
not $(@D)/scratch.
($(linknamespace-header-tests)): Likewise.
Continuing the consolidation on Python for various miscellaneous build
and test scripts, this patch moves conformtest from Perl to Python.
The substance of the tests run is intended to be the same as before,
except that the previous test for tags did not actually achieve the
intended purpose of verifying whether a tag was already declared, so
is changed to one that would actually fail for a tag that wasn't
declared, and a typo in the old test for variables being available
($xyzzy instead of xyzzy) would have made that test not use the
correct type (but it would have passed anyway with warnings). No
attempt is made to keep the details of what the test output looks
like; instead, tests are given names which are made to follow PASS: /
FAIL: / XFAIL: / SKIP: / MISSING: as appropriate.
In the new version, there is more consistent parsing of test lines
(into a series of words, either surrounded by {} or separated by
spaces) that applies for all kinds of test lines, rather than the old
approach of different regular expressions for every kind of test. A
few of the conform/data/ files are adjusted so their syntax works with
the new script (which now requires spaces in certain cases where the
old script tolerated them being missing, and does not allow stray
semicolons at the end of "function" lines). Similarly, common logic
is used around what happens with a second subtest if a first one fails
(e.g., a test for a symbol's type if the test for availability fails),
rather than such logic being replicated separately for each kind of
test. Common parsing also applies for test lines both when they are
lines for the header under test and when they are lines for another
header specified with allow-header, again unlike the old script.
Tested for x86_64, and with build-many-glibcs.py.
* conform/conformtest.py: New file.
* conform/conformtest.pl: Remove.
* conform/GlibcConform.pm: Likewise.
* conform/glibcconform.py (KEYWORDS_C90): New constant.
(KEYWORDS_C99): Likewise.
(KEYWORDS): Likewise.
* conform/Makefile ($(conformtest-header-tests)): Use
conformtest.py instead of conformtest.pl. Do not pass --tmpdir
option. Use --header instead of --headers.
* conform/data/arpa/inet.h-data: Remove trailing semicolons on
function entries.
* conform/data/spawn.h-data: Likewise.
* conform/data/fcntl.h-data (openat): Add space after function
name.
* conform/data/wchar.h-data (wcscasecmp): Likewise.
(wcscasecmp_l): Likewise.
* conform/data/termios.h-data (c_cc): Add space after element
name.
This patch replaces conform/linknamespace.pl with a new
conform/linknamespace.py, so continuing the consolidation on Python
instead of Perl for miscellaneous scripts used in building and testing
glibc. The new script follows the same logic as the old one; as a
recently-added script, there were no major cleanups to be made in the
course of the language conversion.
Tested for x86_64, and with build-many-glibcs.py. For x86_64 I also
tested that if the Perl and Python scripts were made to print all the
symbols in seen_where and the paths of symbol references by which
those symbols were linked in, even when those symbols were OK,
identical symbol lists appeared in the output with both versions of
the script (the differences in linknamespace.out files were only in
paths to temporary files in diagnostics for e.g. deprecated functions,
and error output for the expected compilation failures when testing
ndbm.h and varargs.h).
* conform/linknamespace.py: New file.
* conform/linknamespace.pl: Remove file.
* conform/Makefile ($(linknamespace-header-tests)): Use
linknamespace.py instead of linknamespace.pl. Do not use --tmpdir
option.
Now that we require Python 3.4 or later, Python code creating
temporary directories can use tempfile.TemporaryDirectory in "with" to
have the directory deleted automatically instead of needing to use
try/finally to handle removing a directory created with
tempfile.mkdtemp. This patch does so in conform/glibcconform.py.
Tested for x86_64.
* conform/glibcconform.py: Do not import shutil.
(list_exported_functions): Use tempfile.TemporaryDirectory instead
of mkdtemp.
This patch makes Python 3.4 or later a required tool for building
glibc, so allowing changes of awk, perl etc. code used in the build
and test to Python code without any such changes needing makefile
conditionals or to handle older Python versions.
This patch makes the configure test for Python check the version and
give an error if Python is missing or too old, and removes makefile
conditionals that are no longer needed. It does not itself convert
any code from another language to Python, and does not remove any
compatibility with older Python versions from existing scripts.
Tested for x86_64.
* configure.ac (PYTHON_PROG): Use AC_CHECK_PROG_VER. Set
critic_missing for versions before 3.4.
* configure: Regenerated.
* manual/install.texi (Tools for Compilation): Document
requirement for Python to build glibc.
* INSTALL: Regenerated.
* Rules [PYTHON]: Make code unconditional.
* benchtests/Makefile [PYTHON]: Likewise.
* conform/Makefile [PYTHON]: Likewise.
* manual/Makefile [PYTHON]: Likewise.
* math/Makefile [PYTHON]: Likewise.
Continuing the move of test code from Perl to Python (which seems
uncontroversial, unlike dependencies on Python in the actual build of
glibc), this patch replaces conform/list-header-symbols.pl with a
Python script, as a first step in converting the conform/ tests.
(conform/glibcconform.py is an equivalent to GlibcConform.pm,
containing code that will be relevant to move than one of the conform/
scripts.)
Tested for x86_64, including verifying that the symbol lists generated
are identical to those generated by the Perl version.
* conform/glibcconform.py: New file.
* conform/list-header-symbols.py: Likewise.
* conform/list-header-symbols.pl: Remove.
* conform/Makefile (tests-special): Only add linknamespace tests
if [PYTHON].
($(linknamespace-symlists-tests)): Use list-header-symbols.py.
Remove conformace assumption of NPTL implementation for ISO C threads
and revert wrong libcrypt addition on linknamespace-libs-XPG4.
The i686-gnu target now shows two new conformance failures:
FAIL: conform/ISO11/threads.h/conform
FAIL: conform/ISO11/threads.h/linknamespace
It is expected due missing HTL ISO C threads support and both conformance
.out files indicates the reason ("#error "HTL does not implement ISO C
threads").
Checked on i686-linux-gnu and i686-gnu.
* include/threads.h: Move to ...
* sysdeps/nptl/threads.h: ... here.
* sysdeps/htl/threads.h: New file.
* conform/Makefile (linknamespace-libs-ISO11): Use
static-thread-library instead of linking libpthread.
(linknamespace-libs-XPG4): Revert wrong libcrypt.a addition.
This patch adds the tss_* definitions from C11 threads (ISO/IEC 9899:2011),
more specifically tss_create, tss_delete, tss_get, tss_set, and required
types.
Mostly of the definitions are composed based on POSIX conterparts, including
tss_t (pthread_key_t).
Checked with a build for all major ABI (aarch64-linux-gnu, alpha-linux-gnu,
arm-linux-gnueabi, i386-linux-gnu, ia64-linux-gnu, m68k-linux-gnu,
microblaze-linux-gnu [1], mips{64}-linux-gnu, nios2-linux-gnu,
powerpc{64le}-linux-gnu, s390{x}-linux-gnu, sparc{64}-linux-gnu,
and x86_64-linux-gnu).
Also ran a full check on aarch64-linux-gnu, x86_64-linux-gnu, i686-linux-gnu,
arm-linux-gnueabhf, and powerpc64le-linux-gnu.
[BZ #14092]
* conform/data/threads.h-data (thread_local): New macro.
(TSS_DTOR_ITERATIONS): Likewise.
(tss_t): New type.
(tss_dtor_t): Likewise.
(tss_create): New function.
(tss_get): Likewise.
(tss_set): Likewise.
(tss_delete): Likewise.
* nptl/Makefile (libpthread-routines): Add tss_create, tss_delete,
tss_get, and tss_set objects.
* nptl/Versions (libpthread) [GLIBC_2.28]: Likewise.
* nptl/tss_create.c: New file.
* nptl/tss_delete.c: Likewise.
* nptl/tss_get.c: Likewise.
* nptl/tss_set.c: Likewise.
* sysdeps/nptl/threads.h (thread_local): New define.
(TSS_DTOR_ITERATIONS): Likewise.
(tss_t): New typedef.
(tss_dtor_t): Likewise.
(tss_create): New prototype.
(tss_get): Likewise.
(tss_set): Likewise.
(tss_delete): Likewise.
This patch adds the cnd_* definitions from C11 threads (ISO/IEC 9899:2011),
more specifically cnd_broadcast, cnd_destroy, cnd_init, cnd_signal,
cnd_timedwait, cnd_wait, and required types.
Mostly of the definitions are composed based on POSIX conterparts, and
cnd_t is also based on internal pthreads fields, but with distinct internal
layout to avoid possible issues with code interchange (such as trying to pass
POSIX structure on C11 functions and to avoid inclusion of pthread.h). The
idea is to make it possible to share POSIX internal implementation for mostly
of the code making adjust where only required.
Checked with a build for all major ABI (aarch64-linux-gnu, alpha-linux-gnu,
arm-linux-gnueabi, i386-linux-gnu, ia64-linux-gnu, m68k-linux-gnu,
microblaze-linux-gnu [1], mips{64}-linux-gnu, nios2-linux-gnu,
powerpc{64le}-linux-gnu, s390{x}-linux-gnu, sparc{64}-linux-gnu,
and x86_64-linux-gnu).
Also ran a full check on aarch64-linux-gnu, x86_64-linux-gnu, i686-linux-gnu,
arm-linux-gnueabhf, and powerpc64le-linux-gnu.
[BZ #14092]
* conform/data/threads.h-data (cnd_t): New type.
(cnd_init): New function.
(cnd_signal): Likewise.
(cnd_broadcast): Likewise.
(cnd_wait): Likewise.
(cnd_timedwait): Likewise.
(cnd_destroy): Likewise.
* nptl/Makefile (libpthread-routines): Add cnd_broadcast,
cnd_destroy, cnd_init, cnd_signal, cnd_timedwait, and cnd_wait
object.
* nptl/Versions (libpthread) [GLIBC_2.28]: Likewise.
* nptl/cnd_broadcast.c: New file.
* nptl/cnd_destroy.c: Likewise.
* nptl/cnd_init.c: Likewise.
* nptl/cnd_signal.c: Likewise.
* nptl/cnd_timedwait.c: Likewise.
* nptl/cnd_wait.c: Likewise.
* sysdeps/nptl/threads.h (cnd_t): New type.
(cnd_init): New prototype.
(cnd_signa): Likewise.
(cnd_broadcast): Likewise.
(cnd_wait): Likewise.
(cnd_timedwait): Likewise.
(cnd_destroy): Likewise.
This patch adds the call_* definitions from C11 threads (ISO/IEC 9899:2011),
more specifically call_once and required types.
Mostly of the definitions are composed based on POSIX conterparts,including
once_flag (pthread_once_t). The idea is to make possible to share POSIX
internal implementations for mostly of the code (and making adjustment only
when required).
Checked with a build for all major ABI (aarch64-linux-gnu, alpha-linux-gnu,
arm-linux-gnueabi, i386-linux-gnu, ia64-linux-gnu, m68k-linux-gnu,
microblaze-linux-gnu [1], mips{64}-linux-gnu, nios2-linux-gnu,
powerpc{64le}-linux-gnu, s390{x}-linux-gnu, sparc{64}-linux-gnu,
and x86_64-linux-gnu).
Also ran a full check on aarch64-linux-gnu, x86_64-linux-gnu, i686-linux-gnu,
arm-linux-gnueabhf, and powerpc64le-linux-gnu.
[BZ #14092]
* conform/data/threads.h-data (ONCE_FLAG_INIT): New macro.
(once_flag): New type.
(call_once): New function.
* nptl/Makefile (libpthread-routines): Add call_once object.
* nptl/Versions (libphread) [GLIBC_2.28]: Add call_once symbol.
* nptl/call_once.c: New file.
* sysdeps/nptl/threads.h (ONCE_FLAG_INIT): New define.
(once_flag): New type.
(call_once): New prototype.
This patch adds the mtx_* definitions from C11 threads (ISO/IEC 9899:2011),
more specifically mtx_init, mtx_destroy, mtx_lock, mtx_timedlock, mtx_trylock,
mtx_unlock, and required types.
Mostly of the definitions are composed based on POSIX conterparts, and mtx_t
is also based on internal pthread fields, but with a distinct internal layout
to avoid possible issues with code interchange (such as trying to pass POSIX
structure on C11 functions and to avoid inclusion of pthread.h). The idea
is to make possible to share POSIX internal implementations for mostly of
the code (and making adjustment only when required).
Checked with a build for all major ABI (aarch64-linux-gnu, alpha-linux-gnu,
arm-linux-gnueabi, i386-linux-gnu, ia64-linux-gnu, m68k-linux-gnu,
microblaze-linux-gnu [1], mips{64}-linux-gnu, nios2-linux-gnu,
powerpc{64le}-linux-gnu, s390{x}-linux-gnu, sparc{64}-linux-gnu,
and x86_64-linux-gnu).
Also ran a full check on aarch64-linux-gnu, x86_64-linux-gnu, i686-linux-gnu,
arm-linux-gnueabhf, and powerpc64le-linux-gnu.
[BZ #14092]
* conform/data/threads.h-data (mtx_plain): New constant.
(mtx_recursive): Likewise.
(mtx_timed): Likewise.
(mtx_t): New type.
(mtx_init): New function.
(mtx_lock): Likewise.
(mtx_timedlock): Likewise.
(mtx_trylock): Likewise.
(mtx_unlock): Likewise.
(mtx_destroy): Likewise.
* nptl/Makefile (libpthread-routines): Add mtx_destroy, mtx_init,
mtx_lock, mtx_timedlock, mtx_trylock, and mtx_unlock object.
* nptl/Versions (libpthread) [GLIBC_2.28]): Add mtx_init, mtx_lock,
mtx_timedlock, mtx_trylock, mtx_unlock, and mtx_destroy.
* nptl/mtx_destroy.c: New file.
* nptl/mtx_init.c: Likewise.
* nptl/mtx_lock.c: Likewise.
* nptl/mtx_timedlock.c: Likewise.
* nptl/mtx_trylock.c: Likewise.
* nptl/mtx_unlock.c: Likewise.
* sysdeps/nptl/threads.h (mtx_plain): New enumeration.
(mtx_recursive): Likewise.
(mtx_timed): Likewise.
(mtx_t): New type.
(mtx_init): New prototype.
(mtx_lock): Likewise.
(mtx_timedlock): Likewise.
(mtx_trylock): Likewise.
(mtx_unlock): Likewise.
(mtx_destroy): Likewise.
This patch adds the thrd_* definitions from C11 threads (ISO/IEC 9899:2011),
more specifically thrd_create, thrd_curent, rhd_detach, thrd_equal,
thrd_exit, thrd_join, thrd_sleep, thrd_yield, and required types.
Mostly of the definitions are composed based on POSIX conterparts, such as
thrd_t (using pthread_t). For thrd_* function internally direct
POSIX pthread call are used with the exceptions:
1. thrd_start uses pthread_create internal implementation, but changes
how to actually calls the start routine. This is due the difference
in signature between POSIX and C11, where former return a 'void *'
and latter 'int'.
To avoid calling convention issues due 'void *' to int cast, routines
from C11 threads are started slight different than default pthread one.
Explicit cast to expected return are used internally on pthread_create
and the result is stored back to void also with an explicit cast.
2. thrd_sleep uses nanosleep internal direct syscall to avoid clobbering
errno and to handle expected standard return codes. It is a
cancellation entrypoint to be consistent with both thrd_join and
cnd_{timed}wait.
3. thrd_yield also uses internal direct syscall to avoid errno clobbering.
Checked with a build for all major ABI (aarch64-linux-gnu, alpha-linux-gnu,
arm-linux-gnueabi, i386-linux-gnu, ia64-linux-gnu, m68k-linux-gnu,
microblaze-linux-gnu [1], mips{64}-linux-gnu, nios2-linux-gnu,
powerpc{64le}-linux-gnu, s390{x}-linux-gnu, sparc{64}-linux-gnu,
and x86_64-linux-gnu).
Also ran a full check on aarch64-linux-gnu, x86_64-linux-gnu, i686-linux-gnu,
arm-linux-gnueabhf, and powerpc64le-linux-gnu.
[BZ #14092]
* conform/Makefile (conformtest-headers-ISO11): Add threads.h.
(linknamespace-libs-ISO11): Add libpthread.a.
* conform/data/threads.h-data: New file: add C11 thrd_* types and
functions.
* include/stdc-predef.h (__STDC_NO_THREADS__): Remove definition.
* nptl/Makefile (headers): Add threads.h.
(libpthread-routines): Add new C11 thread thrd_create, thrd_current,
thrd_detach, thrd_equal, thrd_exit, thrd_join, thrd_sleep, and
thrd_yield.
* nptl/Versions (libpthread) [GLIBC_2.28]): Add new C11 thread
thrd_create, thrd_current, thrd_detach, thrd_equal, thrd_exit,
thrd_join, thrd_sleep, and thrd_yield symbols.
* nptl/descr.h (struct pthread): Add c11 field.
* nptl/pthreadP.h (ATTR_C11_THREAD): New define.
* nptl/pthread_create.c (START_THREAD_DEFN): Call C11 thread start
routine with expected function prototype.
(__pthread_create_2_1): Add C11 threads check based on attribute
value.
* sysdeps/unix/sysdep.h (INTERNAL_SYSCALL_CANCEL): New macro.
* nptl/thrd_create.c: New file.
* nptl/thrd_current.c: Likewise.
* nptl/thrd_detach.c: Likewise.
* nptl/thrd_equal.c: Likewise.
* nptl/thrd_exit.c: Likewise.
* nptl/thrd_join.c: Likewise.
* nptl/thrd_priv.h: Likewise.
* nptl/thrd_sleep.c: Likewise.
* nptl/thrd_yield.c: Likewise.
* include/threads.h: Likewise.
This suppresses Perl warnings like these:
Unescaped left brace in regex is deprecated here (and will be fatal in
Perl 5.32), passed through in regex; marked by <-- HERE in m/^element
*({ <-- HERE ([^}]*)}|([^{ ]*)) *({([^}]*)}|([^{ ]*)) *([A-Za-z0-9_]*)
*(.*)/ at conformtest.pl line 370.
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Some Linux distributions are experimenting with a new, separately
maintained and hopefully more agile implementation of the crypt
API. To facilitate this, add a configure option which disables
glibc's embedded libcrypt. When this option is given, libcrypt.*
and crypt.h will not be built nor installed.
The functions encrypt, setkey, encrypt_r, setkey_r, cbc_crypt,
ecb_crypt, and des_setparity should not be used in new programs,
because they use the DES block cipher, which is unacceptably weak by
modern standards. Demote all of them to compatibility symbols, and
remove their prototypes from installed headers. cbc_crypt, ecb_crypt,
and des_setparity were already compat symbols when glibc was
configured with --disable-obsolete-rpc.
POSIX requires encrypt and setkey to be available when _XOPEN_CRYPT
is defined, so this change also removes the definition of X_OPEN_CRYPT
from <unistd.h>.
The entire "DES Encryption" section is dropped from the manual, as is
the mention of AUTH_DES and FIPS 140-2 in the introduction to
crypt.texi. The documentation of 'memfrob' cross-referenced the DES
Encryption section, which is replaced by a hyperlink to libgcrypt, and
while I was in there I spruced up the actual documentation of
'memfrob' and 'strfry' a little. It's still fairly jokey, because
those functions _are_ jokes, but they do also have real use cases, so
people trying to use them for real should have all the information
they need.
DES-based authentication for Sun RPC is also insecure and should be
deprecated or even removed, but maybe that can be left as TI-RPC's
problem.
* bits/in.h [!__USE_MISC]: Do not define struct ip_opts.
* conform/data/netinet/in.h-data: Allow sin_ and sin6_ prefix.
* sysdeps/gnu/bits/msq.h (struct msqid_ds): Use __wait_queue struct
instead of wait_queue.
* sysdeps/gnu/bits/shm.h (struct shmid_ds): Use __vm_area_struct
instead of vm_area_struct.
We shipped 2.27 with libio.h and _G_config.h still installed but
issuing warnings when used. Let's stop installing them early in 2.28
so that we have plenty of time to think of another plan if there are
problems.
The public stdio.h had a genuine dependency on libio.h for the
complete definitions of FILE and cookie_io_functions_t, and a genuine
dependency on _G_config.h for the complete definitions of fpos_t and
fpos64_t; these are moved to single-type headers.
bits/types/struct_FILE.h also provides a handful of accessor and
bitflags macros so that code is not duplicated between bits/stdio.h
and libio.h. All the other _IO_ and _G_ names used by the public
stdio.h can be replaced with either public names or __-names.
In order to minimize the risk of breaking our own compatibility code,
bits/types/struct_FILE.h preserves the _IO_USE_OLD_IO_FILE mechanism
exactly as it was in libio.h, but you have to define _LIBC to use it,
or it'll error out. Similarly, _IO_lock_t_defined is preserved
exactly, but will error out if used without defining _LIBC.
Internally, include/stdio.h continues to include libio.h, and libio.h
scrupulously provides every _IO_* and _G_* name that it always did,
perhaps now defined in terms of the public names. This is how this
patch avoids touching dozens of files throughout glibc and becoming
entangled with the _IO_MTSAFE_IO mess. The remaining patches in this
series eliminate most of the _G_ names.
Tested on x86_64-linux; in addition to the test suite, I installed the
library in a sysroot and verified that a simple program that uses
stdio.h could be compiled against the installed library, and I also
verified that installed stripped libraries are unchanged.
* libio/bits/types/__fpos_t.h, libio/bits/types/__fpos64_t.h:
New single-type headers split from _G_config.h.
* libio/bits/types/cookie_io_functions_t.h
* libio/bits/types/struct_FILE.h
New single-type headers split from libio.h.
* libio/Makefile: Install the above new headers. Don't install
libio.h, _G_config.h, bits/libio.h, bits/_G_config.h, or
bits/libio-ldbl.h.
* libio/_G_config.h, libio/libio.h: Delete file.
* libio/bits/libio.h: Remove improper-inclusion guard.
Include stdio.h and don't repeat anything that it does.
Define _IO_fpos_t as __fpos_t, _IO_fpos64_t as __fpos64_t,
_IO_BUFSIZ as BUFSIZ, _IO_va_list as __gnuc_va_list,
__io_read_fn as cookie_read_function_t,
__io_write_fn as cookie_write_function_t,
__io_seek_fn as cookie_seek_function_t,
__io_close_fn as cookie_close_function_t,
and _IO_cookie_io_functions_t as cookie_io_functions_t.
Define _STDIO_USES_IOSTREAM, __HAVE_COLUMN, and _IO_file_flags
here, in the "compatibility defines" section. Remove an #if 0
block. Use the "body" macros from bits/types/struct_FILE.h to
define _IO_getc_unlocked, _IO_putc_unlocked, _IO_feof_unlocked,
and _IO_ferror_unlocked.
Move prototypes of __uflow and __overflow...
* libio/stdio.h: ...here. Don't include bits/libio.h.
Don't define _STDIO_USES_IOSTREAM. Get __gnuc_va_list
directly from stdarg.h. Include bits/types/__fpos_t.h,
bits/types/__fpos64_t.h, bits/types/struct_FILE.h,
and, when __USE_GNU, bits/types/cookie_io_functions_t.h.
Use __gnuc_va_list, not _G_va_list; __fpos_t, not _G_fpos_t;
__fpos64_t, not _G_fpos64_t; FILE, not struct _IO_FILE;
cookie_io_functions_t, not _IO_cookie_io_functions_t;
__ssize_t, not _IO_ssize_t. Unconditionally define
BUFSIZ as 8192 and EOF as (-1).
* libio/bits/stdio.h: Add multiple-include guard. Use the "body"
macros from bits/types/struct_FILE.h instead of _IO_* macros
from libio.h; use __gnuc_va_list instead of va_list and __ssize_t
instead of _IO_ssize_t.
* libio/bits/stdio2.h: Similarly.
* libio/iolibio.h: Add multiple-include guard.
Include bits/libio.h after stdio.h.
* libio/libioP.h: Add multiple-include guard.
Include stdio.h and bits/libio.h before iolibio.h.
* include/bits/types/__fpos_t.h, include/bits/types/__fpos64_t.h
* include/bits/types/cookie_io_functions_t.h
* include/bits/types/struct_FILE.h: New wrappers.
* bits/_G_config.h, sysdeps/unix/sysv/linux/_G_config.h:
Get definitions of _G_fpos_t and _G_fpos64_t from
bits/types/__fpos_t.h and bits/types/__fpos64_t.h
respectively. Remove improper-inclusion guards.
* conform/data/stdio.h-data: Update expectations of va_list.
* scripts/check-installed-headers.sh: Remove special case for
libio.h and _G_config.h.
This patch completes the ucontext.h namespace fixes by fixing issues
related to the use of struct sigcontext as mcontext_t, and inclusion
of <bits/sigcontext.h> even when struct sigcontext is not so used.
Inclusion of <bits/sigcontext.h> by <sys/ucontext.h> is removed; the
way to get the sigcontext structure is by including <signal.h> (in a
context where __USE_MISC is defined); the sysdeps/generic version of
sys/ucontext.h keeps the inclusion by necessity, with a comment about
how this is not namespace-clean, but the only configuration that used
it, MicroBlaze, gets its own version of the header in this patch.
Where mcontext_t was typedefed to struct sigcontext, the contents of
struct sigcontext are inserted (with appropriate namespace handling to
prefix fields with __ when __USE_MISC is not defined); review should
check that this has been done correctly in each case, whether the
definition of struct sigcontext comes from glibc headers or from the
Linux kernel. This changes C++ name mangling on affected
architectures (which do not include x86_64/x86).
Tested for x86_64, and with build-many-glibcs.py.
2017-08-14 Joseph Myers <joseph@codesourcery.com>
[BZ #21457]
* sysdeps/arm/sys/ucontext.h: Do not include <bits/sigcontext.h>.
* sysdeps/generic/sys/ucontext.h: Add comment about use of struct
sigcontext and namespace requirements.
* sysdeps/i386/sys/ucontext.h: Do not include <bits/sigcontext.h>.
* sysdeps/m68k/sys/ucontext.h: Likewise.
* sysdeps/mips/sys/ucontext.h: Likewise. Include <bits/types.h>.
* sysdeps/unix/sysv/linux/aarch64/sys/ucontext.h: Do not include
<bits/sigcontext.h>.
(__ctx): Define earlier.
(mcontext_t): Define structure contents rather than using struct
sigcontext.
* sysdeps/unix/sysv/linux/aarch64/ucontext_i.sym (oEXTENSION): Use
__glibc_reserved1 instead of __reserved.
* sysdeps/unix/sysv/linux/alpha/sys/ucontext.h: Do not include
<bits/sigcontext.h>.
(__ctx): Define earlier.
(mcontext_t): Define structure contents rather than using struct
sigcontext.
* sysdeps/unix/sysv/linux/alpha/ucontext-offsets.sym: Use
mcontext_t instead of struct sigcontext.
* sysdeps/unix/sysv/linux/arm/sys/ucontext.h: Do not include
<bits/sigcontext.h>.
(__ctx): Define earlier.
(mcontext_t): Define structure contents rather than using struct
sigcontext.
* sysdeps/unix/sysv/linux/hppa/sys/ucontext.h: Do not include
<bits/sigcontext.h>.
(__ctx): Define earlier.
(mcontext_t): Define structure contents rather than using struct
sigcontext.
* sysdeps/unix/sysv/linux/ia64/makecontext.c (__makecontext): Use
mcontext_t instead of struct sigcontext.
* sysdeps/unix/sysv/linux/ia64/sigcontext-offsets.sym: Use
mcontext_t instead of struct sigcontext.
* sysdeps/unix/sysv/linux/ia64/sys/ucontext.h: Do not include
<bits/sigcontext.h>.
(__ctx): New macro.
(struct __ia64_fpreg_mcontext): New type.
(mcontext_t): Define structure contents rather than using struct
sigcontext.
(_SC_GR0_OFFSET): Use mcontext_t instead of struct sigcontext.
(uc_sigmask): Define using __ctx.
(uc_stack): Likewise.
* sysdeps/unix/sysv/linux/ia64/sys/procfs.h: Include
<bits/sigcontext.h>.
* sysdeps/unix/sysv/linux/ia64/sys/ptrace.h: Likewise.
* sysdeps/unix/sysv/linux/m68k/sys/ucontext.h: Do not include
<bits/sigcontext.h>.
* sysdeps/unix/sysv/linux/microblaze/sys/ucontext.h: New file.
* sysdeps/unix/sysv/linux/mips/sys/ucontext.h: Do not include
<bits/sigcontext.h>.
* sysdeps/unix/sysv/linux/nios2/sys/ucontext.h: Do not include
<bits/sigcontext.h>.
* sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h: Do not include
<bits/sigcontext.h>.
* sysdeps/unix/sysv/linux/s390/sys/ucontext.h: Do not include
<bits/sigcontext.h>.
* sysdeps/unix/sysv/linux/sh/sys/ucontext.h: Do not include
<bits/sigcontext.h>.
* sysdeps/unix/sysv/linux/sparc/sys/ucontext.h: Do not include
<bits/sigcontext.h>.
* sysdeps/unix/sysv/linux/tile/sys/ucontext.h: Do not include
<bits/sigcontext.h>.
(__ctx): Define earlier.
(mcontext_t): Define structure contents rather than using struct
sigcontext.
* sysdeps/unix/sysv/linux/x86/sys/ucontext.h: Do not include
<bits/sigcontext.h>. Include <bits/types.h>.
* conform/Makefile (test-xfail-XPG42/signal.h/conform): Remove.
(test-xfail-XPG42/sys/wait.h/conform): Likewise.
(test-xfail-XPG42/ucontext.h/conform): Likewise.
(test-xfail-UNIX98/signal.h/conform): Likewise.
(test-xfail-UNIX98/sys/wait.h/conform): Likewise.
(test-xfail-UNIX98/ucontext.h/conform): Likewise.
(test-xfail-XOPEN2K/signal.h/conform): Likewise.
(test-xfail-XOPEN2K/sys/wait.h/conform): Likewise.
(test-xfail-XOPEN2K/ucontext.h/conform): Likewise.
(test-xfail-POSIX2008/signal.h/conform): Likewise.
(test-xfail-POSIX2008/sys/wait.h/conform): Likewise.
(test-xfail-XOPEN2K8/signal.h/conform): Likewise.
(test-xfail-XOPEN2K8/sys/wait.h/conform): Likewise.