[Gllug] Multiple logins with NIS/YP

Alan Peery peery at io.com
Wed Feb 13 20:11:57 UTC 2002



Richard Cottrill wrote:

> I'm pretty sure that only one program can have a file open for writing at a
> time.

Nope.  Unix expects the applications to do the locking.  Try it.  The following
lines were constructed with two separate "cat >>fred" commands in different
windows, typing alternate letters:

a
b
c
d
e
f

File locking on Unix is up to the writing process.

> I think you'll get some error about 'couldn't write to file' from any
> decent program. NFS should enforce this sort of thing across an entire
> network too.

Too optimistic again.  If your program wants such locking, it uses the functions
provided by the rpc.lockd and rpc.statd demons.

> Now if a file is opened, written to, and closed; of course it can then be
> overwritten.

Absolutely.


> I think a lot of common programs use their own lock files for
> managing multiple instances; Navigator and pine certainly do.

It's quite interesting what Netscape uses for the lock file--it makes
~/.netscape/lock a symlink pointing to "<ip_address>:process", which a new
Nescape process will use *somehow* in determining if it should run and update
files, or if it should complain about another process already running.

Alan



-- 
Gllug mailing list  -  Gllug at linux.co.uk
http://list.ftech.net/mailman/listinfo/gllug




More information about the GLLUG mailing list