Using flock, several processes can have a shared lock at the same time, or be waiting to acquire a write lock. How do I get a list of these processes?That is, for a given file X, ideally to find the process id of each process which either holds, or is waiting for, a lock on the file. It would be a very good start though just to get a count of the number of processes waiting for a lock.
How to list processes locking file?
files;process;lock
lslocks, from the util-linux package, does exactly this.In the MODE column, processes waiting for a lock will be marked with a *.