From owner-freebsd-current Tue Dec 24 6:52:10 2002 Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4C6E437B401 for ; Tue, 24 Dec 2002 06:52:09 -0800 (PST) Received: from critter.freebsd.dk (critter.freebsd.dk [212.242.86.163]) by mx1.FreeBSD.org (Postfix) with ESMTP id 70E8643E4A for ; Tue, 24 Dec 2002 06:52:08 -0800 (PST) (envelope-from phk@critter.freebsd.dk) Received: from critter.freebsd.dk (localhost [127.0.0.1]) by critter.freebsd.dk (8.12.6/8.12.6) with ESMTP id gBOEq5In001867; Tue, 24 Dec 2002 15:52:06 +0100 (CET) (envelope-from phk@critter.freebsd.dk) To: Garrett Wollman Cc: current@FreeBSD.ORG Subject: Re: revoke(2) redux... From: phk@FreeBSD.ORG In-Reply-To: Your message of "Tue, 24 Dec 2002 09:42:46 EST." <200212241442.gBOEgkU5034854@khavrinen.lcs.mit.edu> Date: Tue, 24 Dec 2002 15:52:05 +0100 Message-ID: <1866.1040741525@critter.freebsd.dk> Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG In message <200212241442.gBOEgkU5034854@khavrinen.lcs.mit.edu>, Garrett Wollman writes: >< said: > >> Isn't there a pretty obvious race between the revoke() and the open() ? > >To the extent that the race matters, it is obviated by making sure >that only the current user has permission to open the device. If the >user somehow manages to open a device that he owns anyway, it's his >problem if doing so screws it up. > >revoke() was a POSIX invention; it replaces the older vhangup(). But I can't find mention of it in SUS ? >AIX has an extension such as you suggest (they call it frevoke()). I think we should implement that in the kernel instead of revoke(2) because it is actually a lot simpler to implement correctly. We can then provide revoke(2) as a wrapper: revoke(const char *name) { int fd, e; fd = open(name, O_RDONLY); if (fd < 0) return (fd); e = frevoke(fd); close(fd); return (e); } -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk@FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe Never attribute to malice what can adequately be explained by incompetence. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message