semctl(2) is probablly the cleanest way on unix. if things really
get hosed, you can use ipcrm to get rid of the semaphore.
i've never had success with unix locking /really/ working.

however, i think the way to address this (and get what paul's after)
is to split src/libdraw/devdraw.c into two parts. _drawmsgwrite
would really write to "/dev/draw" (a p9p filesystem living in 
$NAMESPACE like $NAMESPACE/devdraw.$WINDOWID).  
access to the mouse and keyboard would need to be similarly 
multiplexed.

window(1) could then provide "/dev/{draw,mouse,cons,consctl,label}";
so rio could run this to start a 9term:

#!/usr/local/bin/rc
WINDOWID=`{window}
if (~ $#WINDOWID 1)
        exec the.9term
exit 1

the upside of all this is that window and rio would be the only programs
linked against X. the downside would be extra 9p traffic.

- erik

"Russ Cox" <[EMAIL PROTECTED]> writes

| 
| > I've been recycling the drawable, but I need to keep a cross-process  
| > lock there; what's a good way to keep a lock in P9P?
| 
| I didn't answer this.  I don't know how to do a cross-process lock.
| Perhaps you could create a temporary file and fcntl lock it.
| 
| Russ

Reply via email to