From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 128728 invoked by alias); 4 Apr 2016 19:06:11 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 128715 invoked by uid 89); 4 Apr 2016 19:06:10 -0000 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 Received: from ipbcc0d020.dynamic.kabel-deutschland.de (HELO calimero.vinschen.de) (188.192.208.32) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 04 Apr 2016 19:06:00 +0000 Received: by calimero.vinschen.de (Postfix, from userid 500) id CF667A80612; Mon, 4 Apr 2016 21:05:58 +0200 (CEST) Date: Mon, 04 Apr 2016 19:06:00 -0000 From: Corinna Vinschen To: cygwin@cygwin.com Subject: Re: Unreliable flock Message-ID: <20160404190558.GB20943@calimero.vinschen.de> Reply-To: cygwin@cygwin.com Mail-Followup-To: cygwin@cygwin.com References: <175808986.20160403002257@yandex.ru> <20160404151644.GB29337@calimero.vinschen.de> <59768064.20160404195111@yandex.ru> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="4Ckj6UjgE2iN1+kY" Content-Disposition: inline In-Reply-To: <59768064.20160404195111@yandex.ru> User-Agent: Mutt/1.5.24 (2015-08-30) X-SW-Source: 2016-04/txt/msg00068.txt.bz2 --4Ckj6UjgE2iN1+kY Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-length: 1726 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" Content-length: 819 -----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--