lock file question

John Rose johnrose at austin.ibm.com
Tue Nov 4 08:32:15 EST 2003

As part of a new RTAS interface, I'm writing a library that needs to
manage mmap() use of a phys mem region in /dev/mem/.  If library user B
requires an mmap()'ed buffer of a subset of this memory, then the
library should ensure that it does not hand out a region being used by
library user A.

The current plan is to create a lock file "/var/lock/LCK..librtas", and
use byte-range locks to manage the use of buffers that fall within this
region.  When such a buffer is needed, the lock file will be probed to
select an appropriate region for use.  The client function can then mmap
/dev/mem with the confidence that it has exclusive control over the

Does this seem like to right direction to go?  I'm under the impression
that I shouldn't use byte-range locks directly on /dev/mem.  Thoughts?

John "Rtas Interface" Rose :)

** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/

More information about the Linuxppc64-dev mailing list