Message178949
| Author |
vstinner |
| Recipients |
alexey-smirnov, amaury.forgeotdarc, neologix, sbt, vstinner |
| Date |
2013年01月03日.15:23:26 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1357226606.72.0.774782752961.issue16850@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
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 |
|