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::Fuser makes 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 ( requesting that the latter functionality be added there.

File::Lock::Multi::Fuser considers 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 <>

This is free software; You may distribute it under the same terms as perl itself.


File::Lock::Multi, Linux::Fuser