delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2004/08/27/06:10:58

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
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
Date: Fri, 27 Aug 2004 12:11:09 +0200
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: F_ULOCK, F_LOCK, F_TLOCK, F_TEST missing in unistd.h
Message-ID: <20040827101109.GK27978@cygbert.vinschen.de>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <20040826133503 DOT GE27978 AT cygbert DOT vinschen DOT de> <200408270348 DOT i7R3mS8r029145 AT mx3 DOT redhat DOT com>
Mime-Version: 1.0
In-Reply-To: <200408270348.i7R3mS8r029145@mx3.redhat.com>
User-Agent: Mutt/1.4.2i

On Aug 26 22:48, Gary R. Van Sickle wrote:
> Well, I just did my 2 minute due diligence and looked up the difference
> between advisory and mandatory file locking.  Did I read right?  Does
> advisory locking actually in no way prevent write access to the "locked"
> file unless all the interested processes also explicitly use lockf() etc?

Yes.

> If so (and I must be missing something there), couldn't this be implemented
> in Windows simply as named mutexes, with the names being some
> suitably-chosen derivative of the file name?  You wouldn't even need to do
> any explicit sharing between Cygwin processes then.

Keep in mind that it's not per-file locking but record locking.  So you'd
need mutex names which reflect the locked region in the file as well.  But
then you'd need one mutex per locked record.  How do you find overlapping
regions hold by other processes?  To make it worse, flock(2) locks are
preserved across forks, so both processes hold the lock together.


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          mailto:cygwin AT cygwin DOT com
Red Hat, Inc.

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.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