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 __init__ Undocumented
Method _listOpenFDs Return an iterable of file descriptors which may be open in this process.
Method _getImplementation Pick a method which gives correct results for _listOpenFDs in this runtime environment.
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 _fallbackFDImplementation Fallback implementation where either the resource module can inform us about the upper bound of how many FDs to expect, or where we just guess a constant maximum if there is no resource module.
def __init__(self): (source)
Undocumented
def _listOpenFDs(self): (source)
Return an iterable of file descriptors which may be open in this process.

This will try to return the fewest possible descriptors without missing any.

def _getImplementation(self): (source)
Pick a method which gives correct results for _listOpenFDs in this runtime environment.

This involves a lot of very platform-specific checks, some of which may be relatively expensive. Therefore the returned method should be saved and re-used, rather than always calling this method to determine what it is.

See the implementation for the details of how a method is selected.

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 _fallbackFDImplementation(self): (source)
Fallback implementation where either the resource module can inform us about the upper bound of how many FDs to expect, or where we just guess a constant maximum if there is no resource module.

All possible file descriptors from 0 to that upper bound are returned with no attempt to exclude invalid file descriptor values.

API Documentation for Twisted, generated by pydoctor at 2014-05-12 18:27:00.