Message-Id: <200408280228.i7S2SF9P016719@delorie.com> Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com From: "Gary R. Van Sickle" To: Subject: RE: F_ULOCK, F_LOCK, F_TLOCK, F_TEST missing in unistd.h Date: Fri, 27 Aug 2004 21:27:16 -0500 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit In-Reply-To: <20040827101109.GK27978@cygbert.vinschen.de> X-IsSubscribed: yes > 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. > Wow. Is this acually a useful thing, or just an unseemly holdover from the bad-old-days? > > 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. Hmmm. Well, is there some reason you couldn't just use LockFile{Ex} et al? Any apps that are expecting to simultaneously write to the same file without "real" locking are busted anyway, aren't they? -- Gary R. Van Sickle -- 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/