in reply to With a fcntl lock, why this lsof output?

The issue is that you use fcntl to get a byte-level write lock (the lowercase w) while visudo uses flock or lockf (depending on what you have) to lock the whole file (uppercase W). The lowercase u is because visudo opens the file read-write and you open it for append.

HTH, --traveler

  • Comment on Re: With a fcntl lock, why this lsof output?

Replies are listed 'Best First'.
Re^2: With a fcntl lock, why this lsof output?
by welchavw (Pilgrim) on Sep 26, 2005 at 14:25 UTC

    Perfect. Thank you. I grabbed File::lockf and was indeed able to see that lockf with a "+<" mode open exactly replicates the visudo locking. I had never ventured into deeply enough into file-locking to learn of the multiple APIs and their differences.

    Regards,
    Adam