From owner-freebsd-hackers Sun Jan 28 10:38: 9 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from iguana.aciri.org (iguana.aciri.org [192.150.187.36]) by hub.freebsd.org (Postfix) with ESMTP id 4ADFC37B698 for ; Sun, 28 Jan 2001 10:37:45 -0800 (PST) Received: (from rizzo@localhost) by iguana.aciri.org (8.11.1/8.11.1) id f0SIbGI24332; Sun, 28 Jan 2001 10:37:16 -0800 (PST) (envelope-from rizzo) From: Luigi Rizzo Message-Id: <200101281837.f0SIbGI24332@iguana.aciri.org> Subject: Re: [kernel patch] fcntl(...) to close many descriptors In-Reply-To: <01012820234100.00214@dades.chilali.net> from mouss at "Jan 28, 2001 8: 9:53 pm" To: usebsd@free.fr (mouss) Date: Sun, 28 Jan 2001 10:37:16 -0800 (PST) Cc: drosih@rpi.edu, hackers@FreeBSD.ORG, wollman@khavrinen.lcs.mit.edu X-Mailer: ELM [version 2.4ME+ PL43 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > I agree that breaking coherence is bad, though I find fcntl is the kind of > functions to use when you don't have a more specific one:) do we have (or could we design) a generic mechanism for machine-specific syscalls which are not available on all OS ? basically i am thinking of something like generic_syscall("fdcloseall", ....); In this way it would be clear what the non-portable pieces of code are, and the mechanism would be extensible with no changes to libraries and syscalls. You could even have dynamically-loaded modules implementing new "syscalls". cheers luigi > then I'd propose > int fdcloseall(int start); > > (I remember having seen some closeall() function in M$ windows > I think there is such function in M$ windows, so while I didn't sell my soul to > Bill, I don't see enough reason to choose a new one (that said, I'm not sure of > the syntax and use there...). > > Note that unlike fcntl() change, this requires adding a syscall, and remaking > libc. > > I'm gonna work on this (and put in the optimization idea suggested by Matt). > > regards, > mouss > > > On Sat, 27 Jan 2001, Garance A Drosihn wrote: > > > > [snip] > > void closeallfds(int start); > > > > While I understand that defining a new routine is more work > > than just adding a parameter to an existing routine, I do > > think it is more appropriate to have that new routine than > > to use fcntl for this. The description for fcntl says the > > first parameter is: > > a descriptor to be operated on by 'cmd' as > > described below. > > For the proposed F_CLOSEM command, it does not operate on the > > GIVEN fd, it operates on a whole bunch of OTHER fd's. This > > means that a program which calls fcntl with a cmd-argument > > which is different than the programmer thinks is being passed > > could cause some pretty painful-to-debug errors in sections of > > the program which have nothing to do with the section that has > > the bug. > > [snip] > > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-hackers" in the body of the message > To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message