From owner-freebsd-hackers Mon Aug 23 20:48: 0 1999 Delivered-To: freebsd-hackers@freebsd.org Received: from allegro.lemis.com (allegro.lemis.com [192.109.197.134]) by hub.freebsd.org (Postfix) with ESMTP id 39F8D14FF6; Mon, 23 Aug 1999 20:45:16 -0700 (PDT) (envelope-from grog@freebie.lemis.com) Received: from freebie.lemis.com (freebie.lemis.com [192.109.197.137]) by allegro.lemis.com (8.9.1/8.9.0) with ESMTP id NAA22505; Tue, 24 Aug 1999 13:14:07 +0930 (CST) Received: (from grog@localhost) by freebie.lemis.com (8.9.3/8.9.0) id NAA90211; Tue, 24 Aug 1999 13:14:06 +0930 (CST) Date: Tue, 24 Aug 1999 13:14:06 +0930 From: Greg Lehey To: Christopher Masto Cc: Chuck Robey , Garance A Drosihn , "Daniel C. Sobral" , Poul-Henning Kamp , Matthew Dillon , FreeBSD Hackers , FreeBSD Committers , Garrett Wollman Subject: Re: Mandatory locking? Message-ID: <19990824131406.C83273@freebie.lemis.com> References: <19990823231130.A16133@netmonger.net> <19990823232726.B16133@netmonger.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.95.4i In-Reply-To: <19990823232726.B16133@netmonger.net>; from Christopher Masto on Mon, Aug 23, 1999 at 11:27:27PM -0400 WWW-Home-Page: http://www.lemis.com/~grog X-PGP-Fingerprint: 6B 7B C3 8C 61 CD 54 AF 13 24 52 F8 6D A4 95 EF Organization: LEMIS, PO Box 460, Echunga SA 5153, Australia Phone: +61-8-8388-8286 Fax: +61-8-8388-8725 Mobile: +61-41-739-7062 Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Monday, 23 August 1999 at 23:27:27 -0400, Christopher Masto wrote: > On Mon, Aug 23, 1999 at 11:16:21PM -0400, Chuck Robey wrote: >> On Mon, 23 Aug 1999, Christopher Masto wrote: >> >>> Bleah.. I can't count the number of times I've seen idiotic code like: >>> >>> open file >>> read data >>> close file >>> open file for write >>> write data >>> close file >>> >>> Mandatory locking of the type above doesn't force such a thing to work. >> >> What has that code you show above got to do with mandatory locking? >> You completely missed the explicit locking calls that you have to make, >> to get and release the locks. If you don't make the call, and you have >> madatory locking, then your process will sleep until someone else >> releases the lock; > > Exactly. You said that mandatory locking means that user A's correct > use of locking means that user B doesn't have to be careful. That's > not the case, since A can step in between B's read and write. B doesn't have to be careful about messing up A's transaction, like he doesn't need to be careful not to overwrite A's address space. If he wants his own transactions protected, he needs to do something about that. Greg -- See complete headers for address, home page and phone numbers finger grog@lemis.com for PGP public key To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message