mirror of
https://github.com/RustPython/RustPython.git
synced 2026-10-29 03:04:38 +08:00
FreeBSD and Linux implement a syscall for close_range. It's faster than looping through the file descriptors to close which would cause a context switch per descriptor. CPython also uses the syscall where available. See: * https://man.freebsd.org/cgi/man.cgi?close_range(2) * https://man7.org/linux/man-pages/man2/close_range.2.html * https://github.com/python/cpython/blob/5a22a62b96a68c2dd31784c5e3427ad7b365388a/Python/fileutils.c#L3193-L3231