[issue16850] Add "e" mode to open(): close-and-exec (O_CLOEXEC) / O_NOINHERIT

STINNER Victor report at bugs.python.org
Thu Jan 10 00:43:11 CET 2013


STINNER Victor added the comment:

There is another way to set close-on-exec flag on a file descriptor: "ioctl(fd, FIOCLEX, 0);" (and "ioctl(fd, FIONCLEX, 0);" to unset the flag). It is interesting because it avoids the need to get the flags before setting new flags (old | FD_CLOEXEC): 1 syscall instead of 2.

ioctl(fd, FIOCLEX) is available on at least: Linux, Mac OS X, QNX, NetBSD, OpenBSD, FreeBSD. I don't know if it's available in old versions of these operating systems. (It is *not* supported by Interix.)

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue16850>
_______________________________________


More information about the Python-bugs-list mailing list