Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT sources DOT redhat DOT com Delivered-To: mailing list cygwin AT sources DOT redhat DOT com Message-Id: <200108211525.KAA28846@devmail.dev.tivoli.com> X-Mailer: exmh version 2.5 07/13/2001 with nmh-1.0.4 To: cygwin AT cygwin DOT com Reply-To: jheyman AT dev DOT tivoli DOT com Subject: Re: Help on posix file lock semantics In-reply-to: <20010820232542.A6414@ping.be> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Tue, 21 Aug 2001 11:25:22 -0400 From: (Jerry Heyman) I'm joining this late, and may be misunderstanding something, but... On 20 August 2001 at 23:25, Kurt Roeckx wrote: > On Mon, Aug 20, 2001 at 10:55:54PM +0200, Gunnar Andre Dalsnes wrote: > > >On Sun, Aug 19, 2001 at 11:06:13PM +0200, Gunnar Andre Dalsnes wrote: >> Example: >> A file has write lock from off. 10 to 20 and read lock from off. 30 to 40. >> A new read lock from off. 15 to 35 upgrades both existing overlapped regions. >> >> Now we have three locks? >> -write lock off. 10 to 15 >> -read lock off. 15 to 35 >> -read lock off. 35 to 40 >> >> Or maybe they merged? >> -write lock off. 10 to 15 >> -read lock off. 15 to 40 >> >> The reason i ask is that i want F_GETLK to behave correctly if called >> afterwards. > > You got me there. :) > > I don't see anything in the standard that covers it, so I guess > it's implementation defined. > > Otoh, is it really that important? My understanding on the locks is that a Read lock is a downgrade relative to a write lock. A write lock is exclusive, and while a read lock precludes others from writing, it doesn't preclude others from reading. With that assumption, you cannot merge and shrink the write lock, but you would surely join the two read locks into a single lock. jerry -- Jerry Heyman 919.224.1442 | IBM SWG/Tivoli Software |"Software is the Build Infrastructure Architect | 3901 S Miami Blvd | difference between jheyman AT dev DOT tivoli DOT com | Durham, NC 27703 | hardware and reality" http://www.acm.org/~heymanj -- 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/