From owner-freebsd-hackers Tue Oct 1 11:01:23 1996 Return-Path: owner-hackers Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id LAA05885 for hackers-outgoing; Tue, 1 Oct 1996 11:01:23 -0700 (PDT) Received: from phaeton.artisoft.com (phaeton.Artisoft.COM [198.17.250.211]) by freefall.freebsd.org (8.7.5/8.7.3) with SMTP id LAA05880 for ; Tue, 1 Oct 1996 11:01:18 -0700 (PDT) Received: (from terry@localhost) by phaeton.artisoft.com (8.6.11/8.6.9) id LAA02000; Tue, 1 Oct 1996 11:00:34 -0700 From: Terry Lambert Message-Id: <199610011800.LAA02000@phaeton.artisoft.com> Subject: Re: flock/sendmail stuffup To: michaelh@cet.co.jp (Michael Hancock) Date: Tue, 1 Oct 1996 11:00:34 -0700 (MST) Cc: terry@lambert.org, julian@whistle.com, eng@alpo.whistle.com, hackers@freebsd.org In-Reply-To: from "Michael Hancock" at Oct 1, 96 02:01:58 pm X-Mailer: ELM [version 2.4 PL24] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-hackers@freebsd.org X-Loop: FreeBSD.org Precedence: bulk > On Mon, 30 Sep 1996, Terry Lambert wrote: > > > 8-). Already there. flock uses an advisory range lock on the entire > > file -- that's how it operates: it's a simplified special case of fcntl() > > locking. > > flock also has better semantics. I think fcntl() still releases all locks > when any one process closes the file. I will have to check it. If it does, it is in error. Locks must be explicitly released, or there is an implied release on decrement of reference count from 1->0. In other words, it's in the close() code, not the exit code that calls the close code. There *does* need to be two counting references -- instantiation count vs. open count, since an object in the name cache is considered to be instantiated, but not necessarily reference for the purpose of resource tracking the locks. Terry Lambert terry@lambert.org --- Any opinions in this posting are my own and not those of my present or previous employers.