delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2016/04/04/15:06:27

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:date:from:to:subject:message-id:reply-to
:references:mime-version:content-type:in-reply-to; q=dns; s=
default; b=euVImx9isRgyKwOubKK8KQa6/HFRVLXuInj+iyjkehKh/8zWp75Z9
57KWiUnvW+DYMLzGAgTAeUpUV11hfxE3ol/jNB8SnDtD0BnEXK3rPIWsSJ2x3KZi
KJkLDx2Vm0Xgb5XZLTk74sJTKxdiMrj9ll06f00wGNhf5hhN2Ggar4=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:date:from:to:subject:message-id:reply-to
:references:mime-version:content-type:in-reply-to; s=default;
bh=EQQ9NjKBLBqE56ukNbUczEZHznw=; b=e7dh/nlMsKk7AAio4bsPw8mpvIoZ
xc6iEiwePHjh8fe1FPRjbl6yrvIGfuZkoOpZuhssG9oEKsdfT7kxUD86LswukJhu
cY/IUG6a0q0yNN4hm7NMFKUptlcTV6FnUQWi+2mWHCFSIMaAUomk68qkPTZkeggY
2lEhcJNXhuvdjcE=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-94.7 required=5.0 tests=BAYES_20,GOOD_FROM_CORINNA_CYGWIN,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_PBL,RDNS_DYNAMIC autolearn=ham version=3.3.2 spammy=advisory, parents, locks, showstopper
X-HELO: calimero.vinschen.de
Date: Mon, 4 Apr 2016 21:05:58 +0200
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: Unreliable flock
Message-ID: <20160404190558.GB20943@calimero.vinschen.de>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <175808986 DOT 20160403002257 AT yandex DOT ru> <20160404151644 DOT GB29337 AT calimero DOT vinschen DOT de> <59768064 DOT 20160404195111 AT yandex DOT ru>
MIME-Version: 1.0
In-Reply-To: <59768064.20160404195111@yandex.ru>
User-Agent: Mutt/1.5.24 (2015-08-30)

--4Ckj6UjgE2iN1+kY
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Apr  4 19:51, Andrey Repin wrote:
> If you mean the part about
>=20
> > BSD file locks created via flock are only propagated to the direct pare=
nt
> > process, not to grand parents or sibling processes. The locks are only =
valid
> > in the creating process, its parent process, and subsequently started c=
hild
> > processes sharing the same file descriptor.
>=20
> then that's a showstopper. In short, it makes the function literally usel=
ess.
> 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 m=
ay
> 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

--=20
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

--4Ckj6UjgE2iN1+kY
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQIcBAEBCAAGBQJXArsWAAoJEPU2Bp2uRE+gUvUP/3h0P1QULMovcQHkHJz8258/
jvWZTiM8x1pVi6Hf/AJ9B2hnyKmoX4YGGzUSQkp45S7X2eOit41ash346QvRxQPU
urhgSSHENcNU9smqYCE5h9ytYgmjXMRbcDTBhExQLQaY4WhnsFbc9yFrhscskm7D
LsgelIgqQCvyDF4FBcHoKownFxhmpjWwp1o1NIBXm8M/YBwDnW4Pk4dy3vRVSq03
KkcHln3avXg3vCAWpSA5soc0+p9LawTxBwS0zHZXRIc+1oQ1VK88klnkE5UGm2TA
+aB/l7udd71RUUGblwsTODKMajhYy7SlIEPs73tbQCtLvFfrDbR90hRKL12otx9P
8VvNAtrjP+JBxWuGe/EWWmmCojqq35mmNlKOe+8e4F1v2xfN50J03bPLEWjgzEhs
bpB36pwMXIo68PJ281zpQxDt0O3Ve3hPLEx7RAF5KZ8DRkwO8UYEtSPE+yF73SLe
EcghrIWCfPSalmzXHDmVY5oTcSgYJWpTBzpKRh15LOCBrieh9ZYJW1R1x4iYZmBL
eNNTHNMPRhL0L2ZBk/WQt507nrWAQrVhRcaoKxGaRjqooLouLqtfiOFAs/MnIQ4k
Ktf5oUv79mW5PaS/Bv2MxlFluEyYVG4XjgcBVr3KLXnHN3fjYA2SB3lekfDO9aGV
EFVfXWekfYz2ZCdwbbEB
=mst2
-----END PGP SIGNATURE-----

--4Ckj6UjgE2iN1+kY--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019