[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <63a86460-23a8-4e5a-a34d-d1825c85b5a0@t-8ch.de>
Date: Sun, 26 Nov 2023 11:42:15 +0100
From: Thomas Weißschuh <linux@...ssschuh.net>
To: Willy Tarreau <w@....eu>
Cc: Shuah Khan <shuah@...nel.org>, linux-kernel@...r.kernel.org,
linux-kselftest@...r.kernel.org
Subject: Re: [PATCH 2/3] tools/nolibc: add support for getrlimit/setrlimit
On 2023-11-26 10:28:28+0100, Willy Tarreau wrote:
> Hi Thomas,
>
> > +int test_rlimit(void)
> > +{
> > + struct rlimit rlim = {
> > + .rlim_cur = 1 << 20,
> > + .rlim_max = 1 << 20,
> > + };
> > + int ret;
> > +
> > + ret = setrlimit(RLIMIT_CORE, &rlim);
> > + if (ret)
> > + return -1;
> > +
> > + rlim.rlim_cur = 0;
> > + rlim.rlim_max = 0;
> > +
> > + ret = getrlimit(RLIMIT_CORE, &rlim);
> > + if (ret)
> > + return -1;
> > +
> > + if (rlim.rlim_cur != 1 << 20)
> > + return -1;
> > + if (rlim.rlim_max != 1 << 20)
> > + return -1;
>
> I think you should used two different values here for cur and max so
> that you can also detect stupid API bugs such as a union being used
> instead of a struct, or copy-pastes in the implementation etc. For
> example using 1<<20 and 1<<21 should do the trick.
Good point, I incorporated the suggestion.
> Otherwise Ack-by me for the whole series, of course.
Thanks!
FYI I retested and pushed the series.
Thomas
Powered by blists - more mailing lists