glibc/sysdeps/unix/sysv/linux/dl-diagnostics-kernel.c
Paul Eggert 581c785bf3 Update copyright dates with scripts/update-copyrights
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
2022-01-01 11:40:24 -08:00

78 lines
2.5 KiB
C

/* Print kernel diagnostics data in ld.so. Linux version.
Copyright (C) 2021-2022 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
#include <dl-diagnostics.h>
#include <ldsodefs.h>
#include <sys/utsname.h>
/* Dump the auxiliary vector to standard output. */
static void
print_auxv (void)
{
/* See _dl_show_auxv. The code below follows the general output
format for diagnostic dumps. */
unsigned int index = 0;
for (ElfW(auxv_t) *av = GLRO(dl_auxv); av->a_type != AT_NULL; ++av)
{
_dl_printf ("auxv[0x%x].a_type=0x%lx\n"
"auxv[0x%x].a_val=",
index, (unsigned long int) av->a_type, index);
if (av->a_type == AT_EXECFN
|| av->a_type == AT_PLATFORM
|| av->a_type == AT_BASE_PLATFORM)
/* The address of the strings is not useful at all, so print
the strings themselvs. */
_dl_diagnostics_print_string ((const char *) av->a_un.a_val);
else
_dl_printf ("0x%lx", (unsigned long int) av->a_un.a_val);
_dl_printf ("\n");
++index;
}
}
/* Print one uname entry. */
static void
print_utsname_entry (const char *field, const char *value)
{
_dl_printf ("uname.");
_dl_diagnostics_print_labeled_string (field, value);
}
/* Print information from uname, including the kernel version. */
static void
print_uname (void)
{
struct utsname uts;
if (__uname (&uts) == 0)
{
print_utsname_entry ("sysname", uts.sysname);
print_utsname_entry ("nodename", uts.nodename);
print_utsname_entry ("release", uts.release);
print_utsname_entry ("version", uts.version);
print_utsname_entry ("machine", uts.machine);
print_utsname_entry ("domainname", uts.domainname);
}
}
void
_dl_diagnostics_kernel (void)
{
print_auxv ();
print_uname ();
}