Re: How to read /proc/locks in safe mode?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 2011-07-15 at 18:21 +0200, Dario Lesca wrote:

> If I try copy it (cp /proc/locks /tmp/l or cat /proc/locks>/tmp/l) two
> times in succession, the result is always very different and the
> abnormal line (more than 8 field) are like attachment of previous
> message.

The thing is ANY processing is inherently going to be racy, at least
some of the time. 

The way to find out of part of a file is locked, is to try to take the
lock yourself (LOCK_NB  as an argument to flock may be useful here), if
you get it then it was not held, and if your attempt fails then the lock
is held by something else. 

ANYTHING else is going to give you inherently out of date information
that may change from under you.

You really need to find another way to do whatever it is you are really
trying to do, why does a third party need to know which locks are held?

Regards, Dan.



-- 
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxxx
https://admin.fedoraproject.org/mailman/listinfo/devel


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]
  Powered by Linux