https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119112

--- Comment #1 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-14 branch has been updated by Iain Buclaw
<ibuc...@gcc.gnu.org>:

https://gcc.gnu.org/g:ca0ea3d4192313ad00da4ff734baffcecafe0b1f

commit r14-11399-gca0ea3d4192313ad00da4ff734baffcecafe0b1f
Author: Iain Buclaw <ibuc...@gdcproject.org>
Date:   Mon Mar 10 20:52:49 2025 +0100

    libphobos: Default to libc closefrom in spawnProcessPosix [PR119112]

    This is a backport of two changes in upstream Phobos.

    - The current implementation of spawnProcessPosix is broken on systems
    with a large `ulimit -n' because it always OOMs making it impossible to
    spawn processes. Using the libc implementation, when available, for
    doing file descriptor operations en-mass solves this problem.

    - The fallback code now reads the list of file descriptors in use from
    /dev/fd or /proc/this/fd, avoiding the need to scroll through the entire
    list of possible file descriptors. This fixes the fork process being
    very slow and memory intensive when RLIMIT_NOFILE is too high.

            PR d/119112

    libphobos/ChangeLog:

            * libdruntime/core/sys/freebsd/unistd.d (closefrom): Add binding.
            * libdruntime/core/sys/linux/unistd.d (closefrom): Likewise.
            * libdruntime/core/sys/openbsd/unistd.d (closefrom): Likewise.
            * src/std/process.d (enum InternalError): Add closefds_dup2.
            (spawnProcessPosix): Use closefrom when available.

    Reviewed-on: https://github.com/dlang/phobos/pull/9048
    Reviewed-on: https://github.com/dlang/phobos/pull/9077

Reply via email to