On Mon, Feb 11, 2013 at 10:42:36PM +0000, Sami Kerola wrote: > Subject: [PATCH] lslocks: print waiting state when necessary > Organization: Lastminute.com > > Earlier output was primarily unexpected. > > $ flock foo -c "sleep 100" & flock foo -c "sleep 100" & flock foo -c > "sleep 100" & lslocks > [1] 22352 > [2] 22353 > [3] 22354 > lslocks: failed to parse pid: 'WRITE' > > This commit adds WAITING mode to output listing. The locks which failed > with earlier version will look the following. > > COMMAND PID TYPE SIZE MODE M START END PATH > [...] > flock 22354 FLOCK 0B WAITING 0 0 0 > /home/src/util-linux/foo > flock 22352 FLOCK 0B WAITING 0 0 0 > /home/src/util-linux/foo > flock 22353 FLOCK 0B WRITE 0 0 0 > /home/src/util-linux/foo It's probably good idea to add information that the process is blocked, but I don't think that use WAITING in the MODE column is the right way. We will lost the original information about the lock mode. It would be better to add a new column (e.g. BLOCKED). We can also add a prefix to MODE, for example ">WRITE" for blocked process. The disadvantage is that ">WRITE" is not backwardly compatible. (Hmm.. lslocks was introduced in release 2.22 and it's broken now ... maybe it's not so big problem ;-) It would be also nice to have --blocked command line option to list blocked processes only. Karel -- Karel Zak <kzak@xxxxxxxxxx> http://karelzak.blogspot.com -- To unsubscribe from this list: send the line "unsubscribe util-linux" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html