From owner-freebsd-current Sun Nov 7 3:25: 3 1999 Delivered-To: freebsd-current@freebsd.org Received: from salmon.maths.tcd.ie (salmon.maths.tcd.ie [134.226.81.11]) by hub.freebsd.org (Postfix) with SMTP id F3E5F14E08 for ; Sun, 7 Nov 1999 03:24:59 -0800 (PST) (envelope-from dwmalone@maths.tcd.ie) Received: from walton.maths.tcd.ie by salmon.maths.tcd.ie with SMTP id ; 7 Nov 1999 11:24:58 +0000 (GMT) Date: Sun, 7 Nov 1999 11:24:58 +0000 From: David Malone To: Jonathan Lemon Cc: current@freebsd.org, Ollivier Robert Subject: Re: Serious locking problem in CURRENT Message-ID: <19991107112458.A14670@walton.maths.tcd.ie> References: <199911061929.NAA26145@free.pcs> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0pre3i In-Reply-To: <199911061929.NAA26145@free.pcs> Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Sat, Nov 06, 1999 at 01:29:16PM -0600, Jonathan Lemon wrote: > From the manual page for flock: > > NOTES > Locks are on files, not file descriptors. That is, file descriptors du- > plicated through dup(2) or fork(2) do not result in multiple instances of > a lock, but rather multiple references to a single lock. If a process > holding a lock on a file forks and the child explicitly unlocks the file, > the parent will lose its lock. Doesn't this make it impossible to hold a lock on a file when you want to fork a child to do some task 'cos the lock will be dropped when the child closes its copy of the file discriptor on exit? Either it's a posix goof or the lock shouldn't be let go until either explicitly released or the last instance of the file discriptor is closed? David. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message