[comp.emacs] file locking

owens-christopher@YALE.ARPA.UUCP (09/24/87)

I am toying with the idea of writing file locking code to use the
Apollo system calls. But I want to be philosophically consistent with
what GNU-emacs does now, and I don't want to do it at all if someone
else has already done it.  So....
1) Why does GNU-emacs manage its own file-locking instead of using
system built-ins?
2) Where else besides the obvious filelock.c do I need to hook in to
the existing code?
3) Has anybody else already done this?

thanks,

/c 
ARPA:    Owens-Christopher@cs.yale.edu
UUCP:    {decvax,linus,seismo}!yale!Owens-Christopher
BITNET:  Owens@yalecs

jr@pebbles.bbn.COM (John Robinson) (05/16/88)

The code in filelock.c is nice as far as it goes, but it doesn't
really work out so well in an NFS environment.  You can imagine the
problems: should there be one centralized lock directory across all
file servers?  this hardly works if there are like-named directories
on different machines, and puts one machine at a severe disadvantage
every time an emacs user modifies a buffer.  At the other extreme is
to define PATH_LOCK to be "/tmp/" which only protects you against
yourself or other users of your particular machine.  I don't really
like either of these very much.

So what I would like to know is (1) is it possible to use flock() on
systems that have it to provide at least some of the interlocking?
and/or (2) has anyone come up with a working scheme in NFS (find out
what server has the file you are modifying and go to the PATH_LOCK
directory on that server)?  Other suggestions welcome as well.

/jr
jr@bbn.com or bbn!jr