[issue13788] os.closerange optimization

2021-07-04 Thread Gregory P. Smith
Gregory P. Smith added the comment: Code needed in a modern patch: 1) Use the system call if compile time configure detected it may be available. (if we just use syscall() rather than a libc wrapper, a configure check may not be necessary, but various #ifdefs likely are) 2) If (1) produces

[issue13788] os.closerange optimization

2021-07-01 Thread William Manley
William Manley added the comment: Linux has a close_range syscall since v5.9 (Oct 2020): https://man7.org/linux/man-pages/man2/close_range.2.html -- nosy: +wmanley ___ Python tracker

[issue13788] os.closerange optimization

2019-09-09 Thread Gregory P. Smith
Change by Gregory P. Smith : -- versions: +Python 3.8 -Python 3.4 ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue13788] os.closerange optimization

2019-09-09 Thread STINNER Victor
STINNER Victor added the comment: See also bpo-38061: "FreeBSD: Optimize subprocess.Popen(close_fds=True) using closefrom()". -- ___ Python tracker ___

[issue13788] os.closerange optimization

2013-11-23 Thread Gregory P. Smith
Changes by Gregory P. Smith g...@krypto.org: -- assignee: gregory.p.smith - ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13788 ___ ___

[issue13788] os.closerange optimization

2013-07-09 Thread Ronald Oussoren
Ronald Oussoren added the comment: Two small technical comments: 1) I'd add a configure or compile-time check to determine if the procfs interface might be available. I don't like probing for features that you know are not available. 2) MacOSX has simular functionality using /dev/fd

[issue13788] os.closerange optimization

2013-07-09 Thread Christian Heimes
Christian Heimes added the comment: In case someone is wondering if the approach really reduces the amount of syscalls: yes, it does. readdir() doesn't do a syscall for each entry. On Linux it uses the internal syscall getdents() to fill a buffer of directory entry structs.

[issue13788] os.closerange optimization

2013-07-09 Thread Gregory P. Smith
Gregory P. Smith added the comment: _posixsubprocess already uses the Linux getdent64 syscall when available (though for different reasons: readdir is not safe in that context). http://hg.python.org/cpython/file/3f3cbfd52f94/Modules/_posixsubprocess.c#l227 Probing for procfs at configure time

[issue13788] os.closerange optimization

2013-07-09 Thread STINNER Victor
STINNER Victor added the comment: FreeBSD and other OSes provide closefrom(). Why not exposing this function which is probably implemented as a single syscall? -- nosy: +haypo ___ Python tracker rep...@bugs.python.org

[issue13788] os.closerange optimization

2013-07-08 Thread Christian Heimes
Changes by Christian Heimes li...@cheimes.de: -- nosy: +christian.heimes stage: committed/rejected - versions: +Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13788 ___

[issue13788] os.closerange optimization

2012-01-15 Thread Charles-François Natali
Changes by Charles-François Natali neolo...@free.fr: -- resolution: - duplicate stage: - committed/rejected status: open - closed superseder: - subprocess close_fds behavior should only close open fds ___ Python tracker rep...@bugs.python.org

[issue13788] os.closerange optimization

2012-01-15 Thread Georg Brandl
Georg Brandl ge...@python.org added the comment: fwiw, s/MSDOS_WINDOWS/MS_WINDOWS/. -- nosy: +georg.brandl ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13788 ___

[issue13788] os.closerange optimization

2012-01-15 Thread Gregory P. Smith
Gregory P. Smith g...@krypto.org added the comment: Reopening. Comments added to the code review. This issue is independent of the subprocess module issue in #8052. The _posixsubprocess.c has its own fd closing loop.

[issue13788] os.closerange optimization

2012-01-14 Thread Ferringb
New submission from Ferringb ferri...@gmail.com: The current implementation of closerange essentially is a bruteforce invocation of close for every integer in the range. While this works, it's rather noisy for stracing, and for most invocations, is near a thousand close invocations more than

[issue13788] os.closerange optimization

2012-01-14 Thread Ferringb
Ferringb ferri...@gmail.com added the comment: Fixed tabs/spaces... -- Added file: http://bugs.python.org/file24242/closerange-optimization.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13788

[issue13788] os.closerange optimization

2012-01-14 Thread Ferringb
Changes by Ferringb ferri...@gmail.com: Removed file: http://bugs.python.org/file24241/closerange-optimization.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13788 ___

[issue13788] os.closerange optimization

2012-01-14 Thread Ross Lagerwall
Ross Lagerwall rosslagerw...@gmail.com added the comment: Thanks for the patch. However, this cannot as far as I understand be used for the subprocess implementation due to the limitation of what can be called after a fork() and before an exec(). Take a look at #8052 for some more discussion