Subject: Re: serial line ideas
To: Charles M. Hannum <mycroft@mit.edu>
From: Don Lewis <Don.Lewis@tsc.tdk.com>
List: current-users
Date: 11/09/1996 18:25:49
On Nov 9, 10:52am, Curt Sampson wrote:
} Subject: Re: serial line ideas
} On 9 Nov 1996, Charles M. Hannum wrote:
} 
} > > Or, if you don't trust the kernel and would rather see userland locks,
} > > you use the generic device and ignore the other two.
} > 
} > You should pick one or the other and stick with it.  Using both is
} > guaranteed lossage.
} 
} If that's the case, I'd rather see userland locks. At least with
} those it's easy to find out what process has the lock, in case one
} has to chase it down and kill it.

I worry about things like putting the pid in the lock file for such
purposes.  What if the process holding the lock dies without removing
the lock file, and when you get around to checking on who is holding the
lock, the process ids have wrapped around and some innocent process now
has that pid?  Then there's the problem of someone manually clearing the
lock by removing the lock while some process is still talking to the device.
How do you recover from that?

With kernal locks, the lock has to be held by a process that has the
device open.  If the process dies, the lock is unlocked.  You can find
out what process(es) have the device open (thus locking it) with fstat.

			---  Truck