This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

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
History
Date User Action Args
2013-01-03 15:23:26vstinnersetrecipients: + vstinner, amaury.forgeotdarc, neologix, sbt, alexey-smirnov
2013-01-03 15:23:26vstinnersetmessageid: <1357226606.72.0.774782752961.issue16850@psf.upfronthosting.co.za>
2013-01-03 15:23:26vstinnerlinkissue16850 messages
2013-01-03 15:23:26vstinnercreate