1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-30 22:43:12 +03:00

ld.so: Add --list-tunables to print tunable values

Pass --list-tunables to ld.so to print tunables with min and max values.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
This commit is contained in:
H.J. Lu
2020-07-12 06:04:53 -07:00
parent cc528f9a7e
commit 86f65dffc2
10 changed files with 172 additions and 2 deletions

View File

@ -26,6 +26,7 @@
#include <sysdep.h>
#include <fcntl.h>
#include <ldsodefs.h>
#include <array_length.h>
#define TUNABLES_INTERNAL 1
#include "dl-tunables.h"
@ -398,6 +399,48 @@ __tunables_init (char **envp)
}
}
void
__tunables_print (void)
{
for (int i = 0; i < array_length (tunable_list); i++)
{
const tunable_t *cur = &tunable_list[i];
if (cur->type.type_code == TUNABLE_TYPE_STRING
&& cur->val.strval == NULL)
_dl_printf ("%s:\n", cur->name);
else
{
_dl_printf ("%s: ", cur->name);
switch (cur->type.type_code)
{
case TUNABLE_TYPE_INT_32:
_dl_printf ("%d (min: %d, max: %d)\n",
(int) cur->val.numval,
(int) cur->type.min,
(int) cur->type.max);
break;
case TUNABLE_TYPE_UINT_64:
_dl_printf ("0x%lx (min: 0x%lx, max: 0x%lx)\n",
(long int) cur->val.numval,
(long int) cur->type.min,
(long int) cur->type.max);
break;
case TUNABLE_TYPE_SIZE_T:
_dl_printf ("0x%Zx (min: 0x%Zx, max: 0x%Zx)\n",
(size_t) cur->val.numval,
(size_t) cur->type.min,
(size_t) cur->type.max);
break;
case TUNABLE_TYPE_STRING:
_dl_printf ("%s\n", cur->val.strval);
break;
default:
__builtin_unreachable ();
}
}
}
}
/* Set the tunable value. This is called by the module that the tunable exists
in. */
void