delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2003/01/13/13:00:40

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/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
Date: Mon, 13 Jan 2003 18:49:43 +0100 (CET)
From: Pavel Tsekov <ptsekov AT gmx DOT net>
X-X-Sender: ptsekov AT moria DOT atlanticsky DOT com
To: Heiko Elger <heiko DOT elger AT gmx DOT de>
cc: cygwin AT cygwin DOT com, ente59 <heiko_elger AT arburg DOT com>
Subject: Re: fcntl() bug? if called second times!
In-Reply-To: <000701c2bb25$4d257640$0502a8c0@heiko>
Message-ID: <Pine.LNX.4.44.0301131833330.19138-100000@moria.atlanticsky.com>
MIME-Version: 1.0

Hello,

Cygwin doesn't support advisory file locking. It implements file locking 
via the Win32 api LockFile*. Find out more here:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/base/lockfile.asp

And more specifically this part:
[...]
Locking a portion of a file for shared access denies all processes write 
access to the specified region of the file, including the process that 
first locks the region. All processes can read the locked region.
[...]

In fact I think the Win32 error code returned in this case is 
ERROR_LOCK_VIOLATION and Cygwin translates it to EACCESS.

Some time before I started porting sendmail to Cygwin and met this 
problem. I decided to try to implement something like advisory file 
locking for Cygwin back then but lack of time prevented me from doing so 
:(

On Mon, 13 Jan 2003, Heiko Elger wrote:

> Hello,
> 
> I try to comiple an run the distcc package - but I get errors while running.
> I figured out, tha the problems are the fcntl() calls - perhaps
> ther is a bug in cygwin?
> The following code runs differently in cygwin and linux.
> If I want ro lock the whole file twice, but still the same process, I will
> get an "permission denied" error on cygwin.
> The same code works on linux!
> 
> ===> Cygwin console
>     heiko AT HEIKO ~/src/fslock
>     $ ./fslocktest
>     Lock 1
>     Lock 2
>     lock failed: fslocktest.txt: Permission denied
> 
> ===> linux console
>     heiko AT linux:~/src/fslock> ./fslocktest
>     Lock 1
>     Lock 2



--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


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