Bruno Haible <[email protected]> writes:

> Grisha Levit wrote:
>> FWIW, Austin Group Defect 418 [1] seems directly on point and in line with
>> your interpretation.
>> 
>> [1] posix_spawn_file_actions_addclose() should not check against OPEN_MAX
>>     https://austingroupbugs.net/view.php?id=418
>
> Thanks for this reference. So, it was wrong that I wanted to make the
> function behave on NetBSD like on glibc. I'm reverting that change now.

Thanks for the extra info Grisha.

>> > Hi Bruno, any thoughts on this? I'm considering opening a glibc bug
>> > report for it. But it would be nice to get another interpretation,
>> > whether or not it agrees with mine.
>
> The Rationale section of
> https://pubs.opengroup.org/onlinepubs/9799919799/functions/posix_spawn_file_actions_addclose.html
> explains the logic. Whether it's a glibc bug depends whether in glibc
> "{OPEN_MAX} reflects the RLIMIT_NOFILE soft limit"; I haven't looked
> how sysconf (_SC_OPEN_MAX) is implemented in glibc.

It looks like sysdeps/posix/sysconf.c is used on GNU/Linux. It simply
calls __getdtablesize () which is just getrlimit (RLIMIT_NOFILE, ...)
with an OPEN_MAX fallback if that fails.

Collin


Reply via email to