lsof icon indicating copy to clipboard operation
lsof copied to clipboard

[linux] closefrom_shim: Add optimized fallback for platforms without closefrom or close_range

Open MarcT512 opened this issue 9 months ago • 0 comments

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.

MarcT512 avatar May 15 '24 10:05 MarcT512