Subject: Re: Locking primitives kernel only?
To: None <email@example.com>
From: Jason R Thorpe <firstname.lastname@example.org>
Date: 05/02/2000 11:50:34
On Tue, May 02, 2000 at 11:30:10AM -0700, Eduardo Horvath wrote:
> I see that <machine/lock.h> is being installed in /usr/include. Are the
> locking primitives kernel only or also useable by userland? I was
> considering changing the locking primitive to a compare-and-swap that
> uses curproc as the identifier. It's a great aid in debugging locking
> issues but obviously wouldn't work in userland. And I wouldn't want to
> use a SPARC V9 instruction in 32-bit binaries.
You could certainly use #ifdef _KERNEL to switch them.
However, using curproc as the identifier for a simplelock is incorrect,
as simplelocks are owned by CPUs, not by processes. Processes own
sleep locks implemented by lockmgr().
-- Jason R. Thorpe <email@example.com>