This patch adds the actual pretty-printer for errno. I could have
used Python's built-in errno module to get the symbolic names for the
constants, but it seemed better to do something entirely under our
control, so there's a .pysym file generated from errnos.texi, with a
hook that allows the Hurd to add additional constants. Then a .py
module is generated from that plus errno.h in the usual manner; many
thanks to the authors of the .pysym mechanism.
There is also a test which verifies that the .py file (not the .pysym
file) covers all of the constants defined in errno.h.
hurd-add-errno-constants.awk has been manually tested, but the
makefile logic that runs it has not been tested.
* stdlib/errno-printer.py: New pretty-printer.
* stdlib/test-errno-constants.py: New special test.
* stdlib/test-errno-printer.c, stdlib/test-errno-printer.py:
New pretty-printer test.
* stdlib/make-errno-constants.awk: New script to generate the
.pysym file needed by errno-printer.py.
* stdlib/Makefile: Install, run, and test all of the above, as
appropriate.
* sysdeps/mach/hurd/hurd-add-errno-constants.awk: New script to
add Mach/Hurd-specific errno constants to the .pysym file used by
stdlib/errno-printer.py.
* sysdeps/mach/hurd/Makefile: Hook hurd-add-errno-constants.awk
into the generation of that .pysym file.
Make error_t always int; make __errno_location return an __error_t.
error_t is a Hurdism whose purpose, as far as I know, is to make it so
you can get GDB to tell you the E-constant corresponding to the
current value of errno by typing 'p (error_t) errno'. I tried to
generalize this to all platforms a few weeks ago and it was suggested
to me that this is maybe a job for a GDB pretty-printer, instead.
This patch clears the ground for that, by removing the Hurd-specific
definition of error_t.
error_t is also used to make the return values of a few GNU extension
functions (in argp.h and argz.h) a little more self-documenting, so it
can't completely go away, and it will be useful to be able to write
'p (error_t) err' where err is some ordinary int variable that happens
to have an errno value stashed in it. So now stdlib/errno.h defines it
and it's always just a typedef for 'int'.
This patch also changes all definitions of __errno_location and the
underlying thread-local errno to have type __error_t instead of int.
__error_t is also just a typedef for int, but this is how we will cue
the GDB pretty-printer to print errno specially. I believe that this
does not have any standards-compliance consequences, because it's just
a typedef for int. This part of the change doesn't make sense in the
absence of the pretty-printer itself, but this split-up seemed more
useful to reviewers.
* stdlib/errno.h (__error_t): New type (typedef as int).
(__errno_location): Declare as returning __error_t.
(error_t): Typedef as __error_t, if not already defined.
* csu/errno-loc.c, csu/errno.c, include/errno.h
* sysdeps/mach/hurd/dl-sysdep.c, sysdeps/mach/hurd/errno-loc.c:
Change type of errno, __libc_errno, and rtld_errno, and
return type of __errno_location to __error_t.
* sysdeps/mach/hudr/errnos.awk: Do not emit enum __error_t_codes
or a definition of error_t.
* sysdeps/mach/hurd/bits/errno.h: Regenerate.
* sysdeps/mach/hurd/errno.c: Delete file.
* bits/errno.h: Update commentary.
The C programs used to test GDB pretty-printers were being compiled
with -DMODULE_NAME=libc (!) which causes many problems, such as
failure to link if they refer to errno. Now they are compiled with
-DMODULE_NAME=testsuite instead.
test_printers_common.py was testing for expected output in a clumsy
way which meant the pexpect timeout had to expire before it could
report a failure, even if the regexp was never going to match. This
slows down debugging a test quite a bit. Rewrote that logic so it
doesn't do that anymore. Note that as a side effect, test() fails the
test by calling exit() rather than throwing an exception -- that could
change if people think it's a bad idea.
Add an 'unsupported_pattern' argument to test(); if the normal
'pattern' fails to match, but an 'unsupported_pattern' was supplied
and it matches, then the test fails as unsupported, not as a normal
failure. This feature is used in part 2.
Tighten up the code to honor TIMEOUTFACTOR, and add another
environment variable TEST_PRINTERS_LOG; if this is set to a pathname,
all of the dialogue with the gdb subprocess will be logged to that
file.
* Rules: Set MODULE_NAME=testsuite for everything in tests-printers.
* scripts/test_printers_common.py (TIMEOUTFACTOR): Tighten up handling.
(TEST_PRINTERS_LOG): New env variable; if set, pexpect will log all
dialogue with the gdb subprocess to the file it names.
(send_command): New function broken out of test.
(test): Add 'unsupported_pattern' argument and improve
handling of 'pattern' argument; match failures no longer have to
wait for the timeout.
This commit adds fixed-size allocation buffers. The primary use
case is in NSS modules, where dynamically sized data is stored
in a fixed-size buffer provided by the caller.
Other uses include a replacement of mempcpy cascades (which is
safer due to the size checking inherent to allocation buffers).
x86-64: Implement strcmp family IFUNC selectors in C
Implement strcmp family IFUNC selectors in C.
All internal calls within libc.so can use IFUNC on x86-64 since unlike
x86, x86-64 supports PC-relative addressing to access the GOT entry so
that it can call via PLT without using an extra register. For libc.a,
we can't use IFUNC for functions which are called before IFUNC has been
initialized. Use IFUNC internally reduces the icache footprint since
libc.so and other codes in the process use the same implementations.
This patch uses IFUNC for strcmp family functions within libc.
Fix tile SA_* conditions for POSIX.1:2008 (bug 21622).
As shown by conform/ tests once the remaining namespace issues are
fixed, the tile bits/sigaction.h fails to declare SA_RESETHAND,
SA_RESTART and SA_NODEFER for non-XSI POSIX.1:2008 as other versions
do. Those constants were moved from XSI to Base in the 2008 edition
of POSIX. This patch fixes the conditions to match other versions of
this header.
Tested (compilation only) for tilegx-linux-gnu with
build-many-glibcs.py.
[BZ #21622]
* sysdeps/unix/sysv/linux/tile/bits/sigaction.h (SA_RESTART):
Define for [__USE_UNIX98 || __USE_XOPEN2K8], not [__USE_UNIX98 ||
__USE_MISC].
(SA_NODEFER): Likewise.
(SA_RESETHAND): Likewise.
Rename glibc.tune.ifunc to glibc.tune.hwcaps and move it to
sysdeps/x86/dl-tunables.list since it is x86 specicifc. Also
change type of data_cache_size, data_cache_size and
non_temporal_threshold to unsigned long int to match size_t.
Remove usage DEFAULT_STRLEN from cpu-tunables.c.
* elf/dl-tunables.list (glibc.tune.ifunc): Removed.
* sysdeps/x86/dl-tunables.list (glibc.tune.hwcaps): New.
Remove security_level on all fields.
* manual/tunables.texi: Replace ifunc with hwcaps.
* sysdeps/x86/cpu-features.c (TUNABLE_CALLBACK (set_ifunc)):
Renamed to ..
(TUNABLE_CALLBACK (set_hwcaps)): This.
(init_cpu_features): Updated.
* sysdeps/x86/cpu-features.h (cpu_features): Change type of
data_cache_size, data_cache_size and non_temporal_threshold to
unsigned long int.
* sysdeps/x86/cpu-tunables.c (DEFAULT_STRLEN): Removed.
(TUNABLE_CALLBACK (set_ifunc)): Renamed to ...
(TUNABLE_CALLBACK (set_hwcaps)): This. Update comments. Don't
use DEFAULT_STRLEN.