Options for getting mandatory locking in cygwin1.dll

Warren Young warren@etr-usa.com
Fri Aug 17 15:52:00 GMT 2012

On 8/17/2012 3:37 AM, Corinna Vinschen wrote:
> On Aug 16 13:51, Warren Young wrote:
>> On 8/16/2012 6:26 AM, Corinna Vinschen wrote:
>>> You are aware that there's no chance at all to implement the UNIX
>>> locking API calls correctly this way...
>> Cygwin could follow Linux and implement 'mount -o mand'
> A "mand" mount option sounds like a really interesting idea, together
> with the special group permission settings as described in the Linux
> fcntl(2) man page.  Maybe we can even relax that by making the "mand"
> option the default setting,

I don't see why -o mand is a good default.  It isn't the default on 
Linux.  Besides, wouldn't that dredge up all the hairy problems with 
Windows' by-default mandatory locking?

All I'm wishing for here is a way to say "this subtree should use 
mandatory locks".  The user makes the choice, presumably for good reasons.

I like my per-process Cygwin-specific solution better, though.  In that 
case, libsqlite would make the decision, because it knows that on 
Windows, mandatory locking of SQLite DB files is almost certainly the 
right thing.  The rare counterexample like Achim's can be handled 
through an environment variable or similar; if set, it would cause 
libsqlite to pass 0 to my proposed cygwin_set_mandatory_locking() call, 
or skip calling it entirely.

> In the next
> couple of months I have probably no time to implement it.  It's not
> overly tricky to implement it, as far as I can see, but, as usual,
> somebody has to do it.

I'm totally fine with limping by with the current solution, where we do 
locking the "Wrong (tm)" way in libsqlite for now, with the hope that we 
can fix it the Right way later in the Cygwin DLL itself.

Is there old code in the DLL's code repo that does this?  I mean, did 
the Cygwin DLL use mandatory locking once upon a time, which was 
replaced by its current advisory locking scheme, or has it always 
provided advisory locking only?

Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

More information about the Cygwin mailing list