#!/usr/bin/perl use MDK::Common; my @pids = grep { $_ ne $$ && /^(\d+)$/ } all('/proc'); my @l = map { grep { $_ && !m!^(/proc/|/dev/|pipe:|socket:)!; } map { readlink($_) } "/proc/$_/exe", glob_("/proc/$_/fd/*"); } @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"; }