A scan over /proc takes some time to complete, and there is no
particular guarantee of the relative timing of when a process exits and
when its /proc entries have gone away. Thus, before returning a list of
PIDs which claim to have a file open, verify the PIDs in question are
actually alive with a kill(0) test.
A scan over /proc takes some time to complete, and there is no particular guarantee of the relative timing of when a process exits and when its /proc entries have gone away. Thus, before returning a list of PIDs which claim to have a file open, verify the PIDs in question are actually alive with a kill(0) test.