All of lore.kernel.org
 help / color / mirror / Atom feed
From: Petr Vorel <pvorel@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH 1/1] mallopt01: Rewrite to new API
Date: Thu, 21 Jan 2021 16:03:46 +0100	[thread overview]
Message-ID: <YAmX0tCKisM14QzS@pevik> (raw)
In-Reply-To: <6007A999.7090903@cn.fujitsu.com>

Hi Xu,

thanks for your review and more search in man page than I did!

...
> > diff --git a/configure.ac b/configure.ac
> > index e44e25cc6..17ef76c1a 100644
> > --- a/configure.ac
> > +++ b/configure.ac
> > @@ -94,6 +94,7 @@ AC_CHECK_FUNCS_ONCE([ \
> >       io_uring_register \
> >       io_uring_enter \
> >       kcmp \
> > +    mallopt \
> If glibc/ulibc supports mallopt, it also should support mallinfo. So only
> check mallopt, I think it is ok.
Yes. These are glibc specific and uclibc tries to be API compatible with glibc.


> I guess musl libc doesn't support it, is it right?
Correct, musl don't support it, neither binder.

> > diff --git a/testcases/kernel/syscalls/mallopt/mallopt01.c b/testcases/kernel/syscalls/mallopt/mallopt01.c
...
> > -/*
> > - * NAME
> > - *	mallopt
> > - *
> > - * CALLS
> > - *	malloc(3x), mallopt(3x), mallinfo(3x).
> > - *
> > - * ALGORITHM
> > - *	Set options, malloc memory, and check resource ussage.
> > +/*\
> > + * [DESCRIPTION]
> >    *
> > - * RESTRICTIONS
> > - */
> > + * Basic mallinfo() and mallopt() testing (M_MXFAST, M_NLBLKS).
> > +\*/
> I see glibc code, it said "Only one of these (M_MXFAST) is used
>   in this malloc. The others (M_NLBLKS, M_GRAIN, M_KEEP) don't apply,
>   so setting them has no effect. But this malloc also supports four
>   other options in mallopt. "

> Also, I don't see M_NLBLKS handle in __libc_mallopt.

> I think that is why man-pages said "The SVID defined
> options M_MXFAST, M_NLBLKS, M_GRAIN, and M_KEEP, but only the first of these
> is implemented in glibc."

> I guess we can remove useless M_NLBLKS test.
Good catch! Agree. And it's also not supported on uclibc.

...
> >   	info = mallinfo();
> The lastest mallinfo man-pages said " However, the older function,
> mallinfo(), is deprecated since the type used for the fields is too small".
> The mallinfo2 structure used size_t data type instead of int data type in
> mallinfo struct. Maybe we can add a new test for it.

+1.
mallinfo2() was added few months ago to glibc by Martin Liska, released in 2.33.

Kind regards,
Petr

  reply	other threads:[~2021-01-21 15:03 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-19 13:24 [LTP] [PATCH 1/1] mallopt01: Rewrite to new API Petr Vorel
2021-01-20  3:55 ` Yang Xu
2021-01-21 15:03   ` Petr Vorel [this message]
2021-01-25 12:17 ` Petr Vorel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YAmX0tCKisM14QzS@pevik \
    --to=pvorel@suse.cz \
    --cc=ltp@lists.linux.it \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.