NAME
Linux::Fuser - Determine which processes have a file open
SYNOPSIS
use Linux::Fuser;
my $fuser = Linux::Fuser->new();
my @procs = $fuser->fuser('foo');
foreach my $proc ( @procs )
{
print $proc->pid(),"\t", $proc->user(),"\n",@{$proc->cmd()},"\n";
}
DESCRIPTION
This module provides information similar to the Unix command 'fuser' about which processes have a particular file open. The way that this works is highly unlikely to work on any other OS other than Linux and even then it may not work on other than 2.2.* kernels.
It should also be borne in mind that this may not produce entirely accurate results unless you are running the program as the Superuser as the module will require access to files in /proc that may only be readable by their owner.
METHODS
- new
-
The constructor of the object. It takes no arguments and returns a blessed reference suitable for calling the methods on.
- fuser SCALAR $file
-
Given the name of a file it will return a list of Linux::Fuser::Procinfo objects, one for each process that has the file open - this will be the empty list if no processes have the file open or undef if the file doesnt exist.
PER PROCESS METHODS
The fuser() method will return a list of objects of type Linux::Fuser::Procinfo which itself has methods to return information about the process.
- user
-
The login name of the user that started this process ( or more precisely that owns the file descriptor that the file is open on ).
- pid
-
The process id of the process that has the file open.
- cmd
-
The command line of the program that opened the file. This actually returns a reference to an array containing the individual elements of the command line.
EXPORT
None.
AUTHOR
Jonathan Stowe, <jns@gellyfish.com>
COPYRIGHT AND LICENSE
Please see the README file in the source distribution.
SEE ALSO
2 POD Errors
The following errors were encountered while parsing the POD:
- Around line 168:
You forgot a '=back' before '=head2'
- Around line 192:
=back without =over