diff options
-rwxr-xr-x | move/tools/busy-files | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/move/tools/busy-files b/move/tools/busy-files index 476a2dc67..5356b3684 100755 --- a/move/tools/busy-files +++ b/move/tools/busy-files @@ -2,8 +2,20 @@ use MDK::Common; -print "$_\n" foreach uniq (map { +my @pids = grep { $_ ne $$ && /^(\d+)$/ } all('/proc'); + +my @l = map { grep { $_ && !m!^(/proc/|/dev/|pipe:|socket:)!; } map { readlink($_) } "/proc/$_/exe", glob_("/proc/$_/fd/*"); -} grep { $_ ne $$ && /^(\d+)$/ } all('/proc')); +} @pids; + +push @l, grep { $_ } map { (split)[5] } map { cat_("/proc/$_/maps") } @pids; + +foreach (uniq @l) { + if ($ARGV[0] eq '--server') { + s!/image_(always|boot)!/tmp/live_tree!; + s!/image_raw/live_tree!/tmp/live_tree!; + } + print "$_\n"; +} |