t.i.p._FDDetector(object) : class documentation

Part of twisted.internet.process View Source View In Hierarchy

This class contains the logic necessary to decide which of the available system techniques should be used to detect the open file descriptors for the current process. The chosen technique gets monkey-patched into the _listOpenFDs method of this class so that the detection only needs to occur once.
Unknown Field: ivarslistdirThe implementation of listdir to use. This gets overwritten by the test cases.
getpidThe implementation of getpid to use, returns the PID of the running process.
openfileThe implementation of open() to use, by default the Python builtin.
Method _listOpenFDs Figure out which implementation to use, then run it.
Method _getImplementation Check if /dev/fd works, if so, use that. Otherwise, check if /proc/%d/fd exists, if so use that.
Method _checkDevFDSanity Returns true iff opening a file modifies the fds visible in /dev/fd, as it should on a sane platform.
Method _devFDImplementation Simple implementation for systems where /dev/fd actually works. See: http://www.freebsd.org/cgi/man.cgi?fdescfs
Method _procFDImplementation Simple implementation for systems where /proc/pid/fd exists (we assume it works).
Method _resourceFDImplementation Fallback implementation where the resource module can inform us about how many FDs we can expect.
Method _fallbackFDImplementation Fallback-fallback implementation where we just assume that we need to close 256 FDs.
def _listOpenFDs(self): (source)
Figure out which implementation to use, then run it.
def _getImplementation(self): (source)

Check if /dev/fd works, if so, use that. Otherwise, check if /proc/%d/fd exists, if so use that.

Otherwise, ask resource.getrlimit, if that throws an exception, then fallback to _fallbackFDImplementation.
def _checkDevFDSanity(self): (source)
Returns true iff opening a file modifies the fds visible in /dev/fd, as it should on a sane platform.
def _devFDImplementation(self): (source)
Simple implementation for systems where /dev/fd actually works. See: http://www.freebsd.org/cgi/man.cgi?fdescfs
def _procFDImplementation(self): (source)
Simple implementation for systems where /proc/pid/fd exists (we assume it works).
def _resourceFDImplementation(self): (source)

Fallback implementation where the resource module can inform us about how many FDs we can expect.

Note that on OS-X we expect to be using the /dev/fd implementation.
def _fallbackFDImplementation(self): (source)
Fallback-fallback implementation where we just assume that we need to close 256 FDs.
API Documentation for Twisted, generated by pydoctor at 2011-10-27 16:27:37.