about summary refs log tree commit diff
path: root/elf/rtld.c
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2020-07-12 06:04:53 -0700
committerH.J. Lu <hjl.tools@gmail.com>2021-01-15 05:59:10 -0800
commit86f65dffc2396d408beb628f1cad2b8f63e197bd (patch)
tree70d71a492800a6b4838ff2232ecc315d353a469b /elf/rtld.c
parentcc528f9a7e51f769ea79a9c413af417671bcc695 (diff)
downloadglibc-86f65dffc2396d408beb628f1cad2b8f63e197bd.tar.gz
glibc-86f65dffc2396d408beb628f1cad2b8f63e197bd.tar.xz
glibc-86f65dffc2396d408beb628f1cad2b8f63e197bd.zip
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>
Diffstat (limited to 'elf/rtld.c')
-rw-r--r--elf/rtld.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/elf/rtld.c b/elf/rtld.c
index 8d9add90e3..596b6ac3d9 100644
--- a/elf/rtld.c
+++ b/elf/rtld.c
@@ -50,6 +50,7 @@
 #include <dl-main.h>
 #include <list.h>
 #include <gnu/lib-names.h>
+#include <dl-tunables.h>
 
 #include <assert.h>
 
@@ -1276,6 +1277,16 @@ dl_main (const ElfW(Phdr) *phdr,
 	    _dl_argc -= 2;
 	    _dl_argv += 2;
 	  }
+#if HAVE_TUNABLES
+	else if (! strcmp (_dl_argv[1], "--list-tunables"))
+	  {
+	    state.mode = rtld_mode_list_tunables;
+
+	    ++_dl_skip_args;
+	    --_dl_argc;
+	    ++_dl_argv;
+	  }
+#endif
 	else if (strcmp (_dl_argv[1], "--help") == 0)
 	  {
 	    state.mode = rtld_mode_help;
@@ -1296,6 +1307,14 @@ dl_main (const ElfW(Phdr) *phdr,
 	else
 	  break;
 
+#if HAVE_TUNABLES
+      if (__glibc_unlikely (state.mode == rtld_mode_list_tunables))
+	{
+	  __tunables_print ();
+	  _exit (0);
+	}
+#endif
+
       /* If we have no further argument the program was called incorrectly.
 	 Grant the user some education.  */
       if (_dl_argc < 2)