[−][src]Function close_fds::iter_open_fds
pub fn iter_open_fds(minfd: c_int) -> FdIterⓘ
Iterate over all open file descriptors for the current process, starting at minfd
. The file
descriptors are guaranteed to be returned in ascending order.
Warnings
- Some of the file descriptors yielded by this iterator may be in active use by other sections of code. Be very careful about which operations you perform on them.
- File descriptors that are opened during iteration may or may not be included in the results (exact behavior is platform-specific and depends on several factors).
- Closing file descriptors during iteration will not affect the iterator's ability to list
other open file descriptors (if it does, that is a bug). However, in most cases you should
use
close_open_fds()
to do this. - If your program is multi-threaded, this is vulnerable to race conditions; a file descriptor returned by this iterator may not be valid by the time your code tries to do something with it.