File locking ... need info
Dan Kegel
dank at kegel.com
Tue Dec 31 01:38:40 CST 2002
Bill Medland wrote:
> If you do intend working on it then you are going to have to address some of
> the following issues:
> 1. Windows region locking has different behaviour with regard to merging
> regions etc. than Unix.
> 2. Remember that fcntl locks are on the actual file, not on the handle; and
> closing one handle drops all the locks on all other handles to the same file.
> (I am being almost criminally lax with my wording here but it will do for
> now).
> 3. The timeouts are going to be an interesting task. However the structure of
> the wine server should help immensely
> 4. To the best of my knowledge SMB file systems don't handle it. No one has
> yet told me differenly on the several occasions I have tried to ask. (I know
> that Samba serves out locks to Windows machines successfully but if you put
> an fcntl lock on a file on a SMB share to the best of my knowledge it doesn't
> translate to an SMB lock request).
> 5. The whole issue of advisory and mandatory locking.
Ah, yes, file locking. I was one of the folks who advised Sun
as they were bringing file locking to Java (in "JSR-51"), and
we had some fun discussions about how to define file locking
in Java so it would map properly onto either Windows or Unix.
One thing I recall is that W. Richard Stevens has a nice
discussion of Unix locking in chapter 12 of "Advanced Programming
in the Unix environment", published 1993. It aged fairly well, I think,
and provides a bit of insight into how locking evolved -- and
some problems with mandatory locking (e.g. mandatory locking
didn't prevent ed from editing a file!) Note that mandatory
locking is not part of Posix (http://www.opengroup.org/onlinepubs/007904975/toc.htm).
JSR-51 decided to map Java file locks to mandatory locks on Windows,
and advisory locks on Unix. I'm afraid that's about the only
real option.
- Dan
--
Dan Kegel
Linux User #78045
http://www.kegel.com
More information about the wine-devel
mailing list