From owner-freebsd-hackers Mon Aug 30 8:42:43 1999 Delivered-To: freebsd-hackers@freebsd.org Received: from mail1.its.rpi.edu (mail1.its.rpi.edu [128.113.100.7]) by hub.freebsd.org (Postfix) with ESMTP id 117E915182; Mon, 30 Aug 1999 08:42:25 -0700 (PDT) (envelope-from drosih@rpi.edu) Received: from [128.113.24.47] (gilead.acs.rpi.edu [128.113.24.47]) by mail1.its.rpi.edu (8.9.3/8.9.3) with ESMTP id LAA47460; Mon, 30 Aug 1999 11:40:09 -0400 Mime-Version: 1.0 X-Sender: drosih@mail.rpi.edu Message-Id: In-Reply-To: <19990828125241.G13904@freebie.lemis.com> References: <19990828125241.G13904@freebie.lemis.com> Date: Mon, 30 Aug 1999 11:40:40 -0400 To: Greg Lehey , FreeBSD Committers , FreeBSD Hackers From: Garance A Drosihn Subject: Re: locking revisited Content-Type: text/plain; charset="us-ascii" ; format="flowed" Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG At 12:52 PM +0930 8/28/99, Greg Lehey wrote: >FreeBSD is one of the few operating systems which doesn't have >kernel-level locking. If we want to emulate other systems correctly, >we *must* have advisory locking. This includes SCO UNIX, System V.4 >and Linux. I suspect it also includes Microsoft. > >All this doesn't leave too much room for arguments about whether >locking works or not: it works on all platforms except FreeBSD, and >that's only because FreeBSD doesn't implement locking. I agree (for what it's worth) >As a result, I argue that we should implement locking. The questions >are: how? I'd suggest three ... [the third being:] > > - Via separate calls to fcntl. fcntl currently has the following > command values: > > #define F_DUPFD 0 /* duplicate file descriptor */ > #define F_GETFD 1 /* get file descriptor flags */ > #define F_SETFD 2 /* set file descriptor flags */ > #define F_GETFL 3 /* get file status flags */ > #define F_SETFL 4 /* set file status flags */ > #define F_GETOWN 5 /* get SIGIO/SIGURG proc/pgrp */ > #define F_SETOWN 6 /* set SIGIO/SIGURG proc/pgrp */ > #define F_GETLK 7 /* get record locking information */ > #define F_SETLK 8 /* set record locking information */ > #define F_SETLKW 9 /* F_SETLK; wait if blocked */ > > We could add a F_SETMANDLOCK or some such. > >Any thoughts? On this last option, I assume that means a program could open some file, set this option, and then other programs would behave as if the mandatory-locking flag was on for that file. However, that behavior would only last as long as the first program, the one which set the option, still had the file-descriptor open? Presumably this new fcntl value would only be honored for programs executing as the owner of the file? (or some other limited group, to limit denial-of-service attacks) --- Garance Alistair Drosehn = gad@eclipse.acs.rpi.edu Senior Systems Programmer or drosih@rpi.edu Rensselaer Polytechnic Institute To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message