On Tue, 20 Oct 2026 09:03:00 +0200,
David Uhden Collado <[email protected]> wrote:
> 
> The existing /dev/fd enumeration uses operations that may allocate
> memory after fork, which is unsafe in a multithreaded process.
>

Probably I need a coffe, but I not really understand that you mean here, but
anyway, if it true, it should be fixed upstream.

> ++        for fd in 0..=RawFd::MAX {
> ++            if remaining <= 0 {
> ++                break;
> ++            }
> ++            let flags = libc::fcntl(fd, libc::F_GETFD);
> ++            if flags == -1 {
> ++                continue;
> ++            }

So, instead iterate over a few fd inside /dev/fd you're flooding by fcntl.

I've read https://doc.rust-lang.org/std/os/fd/type.RawFd.html and I see that

pub type RawFd = c_int;

Which reads like loop from 0 till 2^31 on usual system and each step calls 
fcntl().

What did I miss?


-- 
wbr, Kirill

Reply via email to