Message178949
Recent version on different operating systems support opening a file with close-on-exec flag set immediatly (atomic). This feature fixes a race condition when the process calls execv() between open() and fcntl() (to set the FD_CLOEXEC flag to the newly opened file).
It would be nice to expose this feature in Python. The problem is the find a portable and safe way to expose the feature: neologix is against a best-effort function. For example, Linux kernel older than 2.6.22 simply ignores O_CLOEXEC flag (while the libc may expose it).
The feature looks to be supported by at least:
* Linux kernel >= 2.6.23
* FreeBSD 8+
* Windows: _open(filename, _O_NOINHERIT). Is it supported by Windows XP and older versions? http://msdn.microsoft.com/en-us/library/z0kc8e3z.aspx
See also:
* Issue #12760 (closed): This issue added an "x" mode to open() to create a file in exclusive mode
* Issue #12103: "Document how to use open with os.O_CLOEXEC"
* Issue #12105: It was proposed to add an "e" mode to open() for O_CLOEXEC |
|
Date |
User |
Action |
Args |
2013-01-03 15:23:26 | vstinner | set | recipients:
+ vstinner, amaury.forgeotdarc, neologix, sbt, alexey-smirnov |
2013-01-03 15:23:26 | vstinner | set | messageid: <1357226606.72.0.774782752961.issue16850@psf.upfronthosting.co.za> |
2013-01-03 15:23:26 | vstinner | link | issue16850 messages |
2013-01-03 15:23:26 | vstinner | create | |
|