Message179402
socketserver_close_on_exec.patch:
- Add TCPServer.close_on_exec class attribute: True by default if the fcntl module is present, False otherwise
- Use SOCK_CLOEXEC if present, fcntl() + FD_CLOEXEC otherwise
Even if SOCK_CLOEXEC is present, fcntl() is used to check the flag "works" (if FD_CLOEXEC was set). If SOCK_CLOEXEC works, fcntl() will not be called anymore, otherwise we fall back to fcntl() + FD_CLOEXEC. I implemented this fallback for Linux older than 2.6.27. I don't know if SOCK_CLOEXEC is simply ignored, as Linux did for O_CLOEXEC, but I don't have such old Linux version to test.
I chose to set close-on-exec flag *by default*. If we chose to disable it by default, the following changes should be done on my patch:
- TCPServer.close_on_exec : "close_on_exec = (fcntl is not None)" => "close_on_exec = False"
- SimpleXMLRPCServer: add close_on_exec class attribute, "close_on_exec = (fcntl is not None)" (and restore try/except ImportError for fcntl) |
|
Date |
User |
Action |
Args |
2013-01-09 00:07:18 | vstinner | set | recipients:
+ vstinner, gregory.p.smith, pitrou, nadeem.vawda, neologix, Christophe.Devriese |
2013-01-09 00:07:17 | vstinner | set | messageid: <1357690037.94.0.786606736501.issue12107@psf.upfronthosting.co.za> |
2013-01-09 00:07:17 | vstinner | link | issue12107 messages |
2013-01-09 00:07:17 | vstinner | create | |
|