[issue40423] Optimization: use close_range(2) if available

Gregory P. Smith report at bugs.python.org
Sun Oct 11 14:48:19 EDT 2020


Gregory P. Smith <greg at krypto.org> added the comment:

for reference, very recent Linux kernels appear to have gained a close_range syscall.  http://lkml.iu.edu/hypermail/linux/kernel/2008.0/02649.html

Your diff isn't quite sufficient as is.  When depending on a syscall that has a function provided by libc, the libc function may exist (thus HAVE_CLOSE_RANGE will be true at Python compile time) but the system the process is running on may not support the system call.  So it'll return an EINVAL (or something like that) error.

Special handling of that error to add an `else {...}` falling back to the other codepath is necessary.

----------
nosy: +gregory.p.smith

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue40423>
_______________________________________


More information about the Python-bugs-list mailing list