delorie.com/archives/browse.cgi | search |
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=RvLHv/estTe5jAnAsLWR/Ck6/KeXXJh31G0ZSnL/P7mp+e+d2y40D | |
L0iGvRvwMAnZHlmc++zBkRLHkrPVFHL/RQHT7281gGiRKJ8Bm47dTnkn++AIDqBQ | |
I5gU0gutNNlImTdvz9g9vLbrMO6/uhQrA0MB9D7ZPWGzLSMqhJam1E= | |
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=vbHX2XMHf7ObKNHU5u+20ele5TI=; b=bQg+cFPDb9S7OWtI9D9Nj+nD7XlQ | |
H6r9L2kHTsmGvOXQN/vQPmLpPszXrhr0IwXYN0zfqi3eq+IA/ncFrqL6mrDnET3V | |
Dzs0lS9mn713aLbbDEu5PtZ0gG1e3sp9Ikc3YalTFaK4ywLwcGU8o7UVnMiiYhmi | |
oNEaCKaAnxinsYk= | |
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=-1.5 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.3.2 |
X-HELO: | calimero.vinschen.de |
Date: | Tue, 15 Oct 2013 16:15:09 +0200 |
From: | Corinna Vinschen <corinna-cygwin AT cygwin DOT com> |
To: | cygwin AT cygwin DOT com |
Subject: | Re: Perl and File Locking |
Message-ID: | <20131015141509.GF19383@calimero.vinschen.de> |
Reply-To: | cygwin AT cygwin DOT com |
Mail-Followup-To: | cygwin AT cygwin DOT com |
References: | <20130925172435 DOT 320 AT binki> <5242F270 DOT 3090003 AT etr-usa DOT com> |
MIME-Version: | 1.0 |
In-Reply-To: | <5242F270.3090003@etr-usa.com> |
User-Agent: | Mutt/1.5.21 (2010-09-15) |
--4VrXvz3cwkc87Wze Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sep 25 08:25, Warren Young wrote: > On 9/25/2013 02:24, wynfield AT gmail DOT com wrote: > > > >"Your vendor has not defined Fcntl macro O_EXLOCK," >=20 > O_EXLOCK is a BSD feature, and Cygwin tries to emulate Linux, not BSD. >=20 > Minimal testing tells me you can use Cygwin's nonstandard > F_LCK_MANDATORY feature from Perl. This script, foo.pl, doesn't > die: >=20 > #!/usr/bin/perl > sysopen my $fh, "foo.pl", 0600, O_RDONLY or die "sysopen: $!\n"; > fcntl $fh, 0x99, 1 or die "fcntl: $!\n"; >=20 > Whether it actually does what you expect is a different question. Uh, no, don't do that. O_EXLOCK in the BSD world does *not* mean that you want mandatory locking. It only means that the application wants an exclusive lock on the entire file right at open time, thus allowing an atomic open/lock under BSD flock semantics. What you want to do is to call sysopen my $fh, "foo.pl", 0600, O_RDONLY ... [insert perl equivalent of the flock system call here] That's not atomic, but this isn't provided (yet) utside the BSD world. Corinna --=20 Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Maintainer cygwin AT cygwin DOT com Red Hat --4VrXvz3cwkc87Wze Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.14 (GNU/Linux) iQIcBAEBAgAGBQJSXU3tAAoJEPU2Bp2uRE+gkJkP/09MMobaygzQVfU9b3Ndqdje esJfpsJQx2UuMJonBfkjxCuu5xou6LGFuHFgxaMNyP/XPXL9VrfRgMy7lcTPgEEE OuVAUPbsdCmfnb6gfP/UZvf85nBH1w9c+a3TCMmiEGhdhC3l5V9pnbdnzZpzepz4 oWFI4p8XLoysyFgkXbNqFNq8JWDg1cLYBjqhyKXW9AzrfwIdJNqi6UI3BZZwkHCw CstK0yJwScKppF+jo7a5072MX377AgdTwR5lOf5KwrBWdxhMDyDihG/yjaG544PX wzB1OH0XPCNTZ1GdHFKLD8yTu5knkdiCUdZz5s7zU7V1EwOMzkm7mzn/FkazW1qs inLeNwkY5JNHoKRIhZT0VkWUKnb59QgvK0oWvKFJamuaUha9BFG+x+BoH35jMbMq v/AdRP9iMPLKORk124LEBgBL6i7g52SJ32A0ADgmTfdIBb2BPzqqmjcGMuH6NC9B R+AmxOt6Vf8XnoHR1J2Fx8fNySenuQ53gocVZRHzgVHKL7wjRkhOrd8lK0Qys62I C6zzjywtRTEItJeopslb0JcB+ORvK5EIY52HSZTeKK2tq3tj/Q5eaLf4Lyugk2eS E8g0KV82SMFvivNaZRUaipahIdpu8fPtlXdJ8ai1iwGjIoQgf+JwuVKL/V8PdQGM RYgTYuQEURg3kHE64+vx =TR33 -----END PGP SIGNATURE----- --4VrXvz3cwkc87Wze--
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |