Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
In case /proc is not available to get the actual list of opened fds, we fall back to iterating the list of all possible fds. It is possible that during the course of the program execution the limit on number of open file descriptors might be lowered, so using the current limit, as returned by sysconf(_SC_OPEN_MAX), might omit some fds. Therefore, use rlim_max from the structure filled in by gertlimit(RLIMIT_NOFILE) to make sure we're checking all fds. This slows down the function, but only in the case /proc is not available, which should be rare in practice. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
- Loading branch information