From: Richard Henderson <richard.henderson@linaro.org>
To: "Philippe Mathieu-Daudé" <philmd@linaro.org>,
"Michael Tokarev" <mjt@tls.msk.ru>,
"Trent Huber" <trentmhuber@gmail.com>,
qemu-devel@nongnu.org
Cc: qemu-trivial@nongnu.org, pbonzini@redhat.com
Subject: Re: [PATCH v2] os-posix: Expand setrlimit() syscall compatibility
Date: Mon, 17 Jun 2024 11:21:23 -0700 [thread overview]
Message-ID: <b6b26e50-ad06-4d07-a8ee-f13d0a1a5b63@linaro.org> (raw)
In-Reply-To: <506a5c94-b9bf-479f-88b1-3c87ece9b9d9@linaro.org>
On 6/17/24 08:15, Philippe Mathieu-Daudé wrote:
> On 17/6/24 15:07, Michael Tokarev wrote:
>> 17.06.2024 10:19, Philippe Mathieu-Daudé wrote:
>>> Hi Trent,
>>>
>>> On 14/6/24 23:06, Trent Huber wrote:
>>>> Darwin uses a subtly different version of the setrlimit() syscall as
>>>> described in the COMPATIBILITY section of the macOS man page. The value
>>>> of the rlim_cur member has been adjusted accordingly for Darwin-based
>>>> systems.
>>>>
>>>> Signed-off-by: Trent Huber <trentmhuber@gmail.com>
>>>> ---
>>>> The previous version assumed OPEN_MAX was a constant defined on all
>>>> POSIX systems--turns out it's only a macOS constant. This version adds
>>>> preprocessing conditionals to maintain compatibility with Linux.
>>>>
>>>> os-posix.c | 4 ++++
>>>> 1 file changed, 4 insertions(+)
>>>>
>>>> diff --git a/os-posix.c b/os-posix.c
>>>> index a4284e2c07..43f9a43f3f 100644
>>>> --- a/os-posix.c
>>>> +++ b/os-posix.c
>>>> @@ -270,7 +270,11 @@ void os_setup_limits(void)
>>>> return;
>>>> }
>>>> +#ifdef CONFIG_DARWIN
>>>> + nofile.rlim_cur = OPEN_MAX < nofile.rlim_max ? OPEN_MAX : nofile.rlim_max;
>>>
>>> Why open-code min()? (The man-page also suggests it).
>>
>> I guess it's because stddef.h isn't included there, so min() isn't immediately
>> available :)
>
> I see os-posix.c -> "qemu/osdep.h" -> <stddef.h>. Anyway,
We also have MIN in osdep.h.
r~
next prev parent reply other threads:[~2024-06-17 18:22 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-14 21:06 [PATCH v2] os-posix: Expand setrlimit() syscall compatibility Trent Huber
2024-06-17 7:19 ` Philippe Mathieu-Daudé
2024-06-17 13:07 ` Michael Tokarev
2024-06-17 15:15 ` Philippe Mathieu-Daudé
2024-06-17 18:21 ` Richard Henderson [this message]
2024-06-17 12:52 ` Daniel P. Berrangé
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=b6b26e50-ad06-4d07-a8ee-f13d0a1a5b63@linaro.org \
--to=richard.henderson@linaro.org \
--cc=mjt@tls.msk.ru \
--cc=pbonzini@redhat.com \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-trivial@nongnu.org \
--cc=trentmhuber@gmail.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).