From owner-freebsd-hackers Mon Jan 29 6:25:54 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from pcnet1.pcnet.com (pcnet1.pcnet.com [204.213.232.3]) by hub.freebsd.org (Postfix) with ESMTP id 805E637B6A0 for ; Mon, 29 Jan 2001 06:25:29 -0800 (PST) Received: (from eischen@localhost) by pcnet1.pcnet.com (8.8.7/PCNet) id JAA09719; Mon, 29 Jan 2001 09:25:03 -0500 (EST) Date: Mon, 29 Jan 2001 09:25:02 -0500 (EST) From: Daniel Eischen To: "Jacques A. Vidrine" Cc: mouss , Garance A Drosihn , Matt Dillon , Luigi Rizzo , hackers@FreeBSD.ORG, wollman@khavrinen.lcs.mit.edu Subject: Re: [kernel patch] fcntl(...) to close many descriptors In-Reply-To: <20010129081455.B2390@hamlet.nectar.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Mon, 29 Jan 2001, Jacques A. Vidrine wrote: > On Mon, Jan 29, 2001 at 03:13:05PM +0100, mouss wrote: > > I fully agree that we'd better mimic netbsd than aix... > > but the netbsd closeall() is just a libc function that calls close() > > for all descriptors. so we can still mimic it with: > > > > #define closeall(start) fcntl(start, F_CLOSEM, 0) > > Better a function than a macro. I agree. > > and with this, we have both netbsd and aix compat. note that if I > > do it for freebsd, I'll do the same for netbsd and openbsd (I'm a fan of > > *BSD convergence [I don't mean they should be the same, but unjustified > > diffs should be killed whenever possible]:). > > > > As for the "generic" syscall mechanism, I'd love it. I think that > > there are many places where "names" would be good, instead of > > hardcoded numbers. The only problem is to find a way to do that > > without reducing performance. names are good. just try to see what it > > would be if filenames were replaced by inodes. I think that having a > > name-based mechanism makes it easier to add new syscalls or reject > > deprecated ones. > > Performance is not much of an issue. A perfect hash can be generated > for syscall names. > > [snip] > > back to the closeall, here is what I suggest: > > - add the fcntl option. the coherence arg is certainly reasonable, but > > fcntl is not a "cohrent" function > > (thanks to svr4 lobbying into posix:). > > - add a closeall macro to call it. > > > > this gives both aix and netbsd compat (and if the fcntl thing goes into > > netbsd, the compat would be full). > > I really do not care for using fcntl with this. fcntl operates on a > single file descriptor -- F_CLOSEM mucks up the interface. Please don't forget libc_r and what it has to do when opening and closing files. Also, close(2) is a cancellation point. I'd expect closeall(2/3) would also be a cancellation point even if not spelled out in POSIX (since it doesn't exist). -- Dan Eischen To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message