[Python-checkins] peps: PEP 446: enhance the Rationale to take into account Cameron Simpson's remarks
victor.stinner
python-checkins at python.org
Sat Jul 6 14:31:47 CEST 2013
http://hg.python.org/peps/rev/425f831fddf7
changeset: 4978:425f831fddf7
user: Victor Stinner <victor.stinner at gmail.com>
date: Sat Jul 06 14:27:23 2013 +0200
summary:
PEP 446: enhance the Rationale to take into account Cameron Simpson's remarks
* mention the name of the close-on-exec flag: HANDLE_FLAG_INHERIT, O_CLOEXEC
* mention the name of the blocking flag: O_NONBLOCK
* explain that file attributes are duplicated at fork
files:
pep-0446.txt | 28 +++++++++++++++++++++-------
1 files changed, 21 insertions(+), 7 deletions(-)
diff --git a/pep-0446.txt b/pep-0446.txt
--- a/pep-0446.txt
+++ b/pep-0446.txt
@@ -27,14 +27,25 @@
on each file descriptor using a *close-on-exec* flag. By default, the
close-on-exec flag is not set.
-On Windows, file descriptors are not inherited if the
-``bInheritHandles`` parameter of the ``CreateProcess()`` function is
-``FALSE``, even if the close-on-exec flag is not set.
+On Windows, the close-on-exec flag is ``HANDLE_FLAG_INHERIT``. File
+descriptors are not inherited if the ``bInheritHandles`` parameter of
+the ``CreateProcess()`` function is ``FALSE``, even if the
+``HANDLE_FLAG_INHERIT`` flag is set. If ``bInheritHandles`` is ``TRUE``,
+only file descriptors with ``HANDLE_FLAG_INHERIT`` flag set are
+inherited, others are not.
-On UNIX, file descriptors with the close-and-exec flag set are closed at
-the execution of a new program (ex: when calling ``execv()``). The flag
-has no effect on ``fork()``, all file descriptors are inherited by the
-child process.
+On UNIX, the close-on-exec flag is ``O_CLOEXEC``. File descriptors with
+the ``O_CLOEXEC`` flag set are closed at the execution of a new program
+(ex: when calling ``execv()``).
+
+The ``O_CLOEXEC`` flag has no effect on ``fork()``, all file descriptors
+are inherited by the child process. Futhermore, most properties file
+descriptors are shared between the parent and the child processes,
+except file attributes which are duplicated (``O_CLOEXEC`` is the only
+file attribute). Setting ``O_CLOEXEC`` flag of a file descriptor in the
+child process does not change the ``O_CLOEXEC`` flag of the file
+descriptor in the parent process.
+
Issues of the inheritance of file descriptors
---------------------------------------------
@@ -62,6 +73,9 @@
By default, newly created sockets are blocking. Setting the non-blocking
mode requires additional system calls.
+On UNIX, the blocking flag is ``O_NONBLOCK``: a pipe and a socket are
+non-blocking if the ``O_NONBLOCK`` flag is set.
+
Setting flags at the creation of the file descriptor
----------------------------------------------------
--
Repository URL: http://hg.python.org/peps
More information about the Python-checkins
mailing list