class twisted.internet.process._FDDetector: (source)
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.
Instance Variable | listdir | The implementation of listdir to use. This gets overwritten by the test cases. |
Instance Variable | getpid | The implementation of getpid to use, returns the PID of the running process. |
Instance Variable | openfile | The implementation of open() to use, by default the Python builtin. |
Method | __init__ | Undocumented |
Instance Variable | _implementations | 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. |
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.
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.
Simple implementation for systems where /dev/fd actually works. See: http://www.freebsd.org/cgi/man.cgi?fdescfs
Simple implementation for systems where /proc/pid/fd exists (we assume it works).
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.