24 May 2015 09:25:20 UTC
- Distribution: File-Lock-Multi
- Source (raw)
- Browse (raw)
- How to Contribute
- Issues (1)
- Testers (433 / 69 / 0)
- KwaliteeBus factor: 0
- % Coverage
- License: perl_5
- Activity24 month
- Download (11.16KB)
- MetaCPAN Explorer
- Subscribe to distribution
- This version
- Latest versionCRAKRJACK Tyler MacDonald
File::Lock::Multi::Fuser - Lock files based on how many times they are open
This module provides a linux-specific concurrent locking mechanism. It uses the /proc filesystem to determine how many times a lockfile is open, and counts each open filehandle as a "lock". Locks are obtained by opening the given lockfile in append mode, which means that if the file does not exist when you attempt to gain (or check for) a lock, it will be created.
File::Lock::Multi::Fusermakes use of Linux::Fuser to obtain the list of processes that have opened the file -- it then looks in /proc to see how many times each process has the file opened. There is a ticket opened with the Linux::Fuser manpage (http://rt.cpan.org/Public/Bug/Display.html?id=43979) requesting that the latter functionality be added there.
File::Lock::Multi::Fuserconsiders any filehandle that is opened on your lockfile (read or write, flock'ed or not) to be a "lock". There is a /proc extension ("fdinfo") that can give more detailed information about what processes are doing with your files, so options may be added to refine this in the future.
Since the "fd" directories in the /proc filesystem are protected, you can only "see" locks if you are root, or the locks have been taken out by processes that match your userid.
Copyright 2009 Tyler "Crackerjack" MacDonald <firstname.lastname@example.org>
This is free software; You may distribute it under the same terms as perl itself.
Module Install Instructions
To install File::Lock::Multi, copy and paste the appropriate command in to your terminal.
perl -MCPAN -e shell install File::Lock::Multi
For more information on module installation, please visit the detailed CPAN module installation guide.