From: Corinna Vinschen <corinna-cygwin@cygwin.com>
To: cygwin@cygwin.com
Subject: Re: Unreliable flock
Date: Mon, 04 Apr 2016 19:06:00 -0000 [thread overview]
Message-ID: <20160404190558.GB20943@calimero.vinschen.de> (raw)
In-Reply-To: <59768064.20160404195111@yandex.ru>
[-- Attachment #1: Type: text/plain, Size: 1748 bytes --]
On Apr 4 19:51, Andrey Repin wrote:
> If you mean the part about
>
> > BSD file locks created via flock are only propagated to the direct parent
> > process, not to grand parents or sibling processes. The locks are only valid
> > in the creating process, its parent process, and subsequently started child
> > processes sharing the same file descriptor.
>
> then that's a showstopper. In short, it makes the function literally useless.
> I can work around it in a given script, but... *sad panda*
The problem with BSD locks is that the way they are implemented requires
a common shared datastructure in all child processes of a common
ancestor process which opened the file. This isn't available in Cygwin.
Implementing this is tricky and potentially costly so I only got around
to implement this for the direct ancestor process. I'm open to
suggestions or even patches to make this work in full. Have a look into
Cygwin's flock.cc to see how locks are implemented. Feel free to discuss
implementation details on the cygwin-developers ML.
Note that the same restrictions don't apply to POSIX locks since they
are working quite differently.
> Why they aren't real locks? What's use for "advisory locks"? "I think I may
> have a use for this file, but you are free to delete it, if you wish" ?
Unix systems usually implement file locking advisory, not mandatory.
Windows only implements mandatory locks which are incompatible in
behaviour with POSIX as well as BSD locks. I guess you read that
there's a way to use Windows mandatory locks, too.
Corinna
--
Corinna Vinschen Please, send mails regarding Cygwin to
Cygwin Maintainer cygwin AT cygwin DOT com
Red Hat
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
next prev parent reply other threads:[~2016-04-04 19:06 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-02 21:35 Andrey Repin
2016-04-04 15:16 ` Corinna Vinschen
2016-04-04 17:05 ` Andrey Repin
2016-04-04 19:06 ` Corinna Vinschen [this message]
2016-04-05 2:20 ` Andrey Repin
2016-04-05 8:33 ` Corinna Vinschen
2016-04-04 19:24 ` Warren Young
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160404190558.GB20943@calimero.vinschen.de \
--to=corinna-cygwin@cygwin.com \
--cc=cygwin@cygwin.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).