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

H.J. Lu hjl.tools@gmail.com
Fri Sep 18 15:24:32 GMT 2020


On Fri, Sep 18, 2020 at 1:13 AM Florian Weimer <fweimer@redhat.com> wrote:
>
> * 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.

Will do.

> >        /* 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.

Will do.

> Rest looks okay to me.
>

I will submit the updated patch set.

Thanks.

-- 
H.J.


More information about the Libc-alpha mailing list