file locking primitive

Julian Fitzell julian at beta4.com
Sat Jan 3 00:37:35 UTC 2004


This has come up before but we need the file locking primitive in Squeak 
to support our work in OmniBase.  There has been enough interest in this 
in the past that I think it's worthwhile coming up with a primitive 
interface that is implementable in all the common VMs.

I don't know anywhere near enough about file locking on the various 
platforms to know what this is.  To keep the number of primitives down 
I'm guessing we want one that takes a boolean indicating whether to lock 
or unlock the file.

fctl() on *nix seems to allow you to speficy a range using a length and 
a start position relative to either the beginning of the file, the 
current position, or the end of the file.

Do we want to maintain the same interface?  Or is it going to be easier 
to have the primitive always take positions relative to the start? or to 
the current position?

These questions are based mainly on ignorance about how Squeak deals 
with the file descriptors, etc.  Any pointers on how to get the FD from 
the primitive or comments on the correct interface for the primitive 
would be much appreciated.

We're going to look at implementing something for the unix VM on Monday, 
but if we can come up with something that makes others happy then 
hopefully others can jump in with implementations for the other VMs.

Julian




More information about the Squeak-dev mailing list