[PATCH 3/3] ld.so: Add --list-tunables to print tunable values

Florian Weimer fweimer@redhat.com
Fri Sep 18 08:13:05 GMT 2020


* H. J. Lu via Libc-alpha:

> diff --git a/elf/Makefile b/elf/Makefile
> index 0b78721848..7943a684ab 100644
> --- a/elf/Makefile
> +++ b/elf/Makefile
> @@ -414,7 +414,7 @@ endif
>  ifeq (yes,$(build-shared))
>  ifeq ($(run-built-tests),yes)
>  tests-special += $(objpfx)tst-pathopt.out $(objpfx)tst-rtld-load-self.out \
> -		 $(objpfx)tst-rtld-preload.out
> +		 $(objpfx)tst-rtld-preload.out $(objpfx)list-tunables.out
>  endif

I think the new test needs to be conditional on $(have-tunables) as
well.

>        /* If we have no further argument the program was called incorrectly.
>  	 Grant the user some education.  */
>        if (_dl_argc < 2)
> -	_dl_fatal_printf ("\
> +	{
> +#if HAVE_TUNABLES
> +	  _dl_printf
> +#else
> +	  _dl_fatal_printf
> +#endif
> +	    ("\
>  Usage: ld.so [OPTION]... EXECUTABLE-FILE [ARGS-FOR-PROGRAM...]\n\
>  You have invoked `ld.so', the helper program for shared library executables.\n\
>  This program usually lives in the file `/lib/ld.so', and special directives\n\
> @@ -1293,6 +1321,11 @@ of this helper program; chances are you did not intend to run this program.\n\
>  			in LIST\n\
>    --audit LIST          use objects named in LIST as auditors\n\
>    --preload LIST        preload objects named in LIST\n");
> +#if HAVE_TUNABLES
> +	  _dl_fatal_printf ("\
> +  --list-tunables       list all tunables with minimum and maximum values\n");
> +#endif
> +	}

I think you should preprocessor string splicing, so something like this:

  --preload LIST        preload objects named in LIST\n"
#if HAVE_TUNABLES
"\
  --list-tunables       list all tunables with minimum and maximum values\n"
#endif
  );

It should minimize the required changes.

Rest looks okay to me.

Thanks,
Florian
-- 
Red Hat GmbH, https://de.redhat.com/ , Registered seat: Grasbrunn,
Commercial register: Amtsgericht Muenchen, HRB 153243,
Managing Directors: Charles Cachera, Brian Klemm, Laurie Krebs, Michael O'Neill



More information about the Libc-alpha mailing list