Was this ugly mess from the year 2000:use Linux::Fuser;
package File::Fuser; use strict; use vars qw( @ISA @EXPORT ); use File::Spec; use Exporter; @ISA = qw(Exporter); @EXPORT = qw(fuser); sub fuser { my($file) = File::Spec->rel2abs($_[0]); my($f,@pids); foreach(glob("/proc/*")) { if ($_ =~ /^\/proc\/\d+$/) { foreach $f(glob("$_/fd/*")) { if ((reverse(File::Spec->splitpath($f)))[0] > 3 && -l +$f) { if (readlink($f) eq $file) { push(@pids,(reverse(File::Spec->splitpath($_)) +)[0]); } } } } } return((@pids)? @pids : -1); } 1;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
RE: Fuser under perl
by Fastolfe (Vicar) on Oct 12, 2000 at 18:07 UTC | |
by lindex (Friar) on Oct 12, 2000 at 23:16 UTC | |
|
Re: Fuser under perl
by Anonymous Monk on Mar 11, 2009 at 18:42 UTC | |
|
Re: Fuser under perl
by Aristotle (Chancellor) on Oct 29, 2002 at 20:22 UTC | |
by lindex (Friar) on Dec 06, 2002 at 00:08 UTC |