From owner-freebsd-hackers Mon Jan 29 6: 4:12 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from smtp.nettoll.com (matrix.nettoll.net [212.155.143.61]) by hub.freebsd.org (Postfix) with ESMTP id 87E6A37B402 for ; Mon, 29 Jan 2001 06:03:54 -0800 (PST) Received: by smtp.nettoll.com; Mon, 29 Jan 2001 14:59:09 +0100 (MET) Message-Id: <4.3.0.20010129145823.023dfeb0@pop.free.fr> X-Sender: usebsd@pop.free.fr X-Mailer: QUALCOMM Windows Eudora Version 4.3 Date: Mon, 29 Jan 2001 15:13:05 +0100 To: Garance A Drosihn , Matt Dillon , Luigi Rizzo From: mouss Subject: Re: [kernel patch] fcntl(...) to close many descriptors Cc: hackers@FreeBSD.ORG, wollman@khavrinen.lcs.mit.edu In-Reply-To: References: <200101290303.f0T33qg60603@earth.backplane.com> <200101281837.f0SIbGI24332@iguana.aciri.org> <200101290303.f0T33qg60603@earth.backplane.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG At 02:01 29/01/01 -0500, Garance A Drosihn wrote: >Mouss mentioned that NetBSD has a closeall >function in it's libc, and it sounded like he was going to >mimic that instead of the fcntl change. If I were going to >mimic something, I'd rather mimic netbsd than some feature >which exists only in AIX. And as I mentioned in my previous >message, I think the AIX strategy warps the definition of >the fcntl routine, so I was not too fond of it even if there >hadn't been any BSD-based alternative to follow. >-- 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) 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. Now this is not restricted to syscalls. there are other places. for examaple, we could have device names that are "user" configurable, instead of the ef0, npx0, and the like. for network interfaces, I'd suggest adding a field "title" so that one can do: # ifconfig external instead of something like "ifconfig fxp0". While this is of limited use in ifconfig (the guy who uses ifconfig should know what he is doing), this would be useful when configuring firewalls and the like. Indeed, it means a thing to block some packets received by "external" interface than by "ef0". While the guy might change the interface and replace an ef0 with a xl1, the "external" concept is still the same. 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). cheers, mouss To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message