lsof
lsof copied to clipboard
[linux] closefrom_shim: Add optimized fallback for platforms without closefrom or close_range
Add an optimized fallback in closefrom_shim() for Linux, if the platform doesn't support closefrom or close_range. Iterate /proc/self/fd and close anything which is not that directory itself.
This can save significant time if "ulimit -n" (max open files) is very high. For example, in some Docker containers the limit can be 2^30 (~ 1 billion), and lsof may take 10-30 minutes to start up.