From owner-freebsd-hackers@FreeBSD.ORG Tue Jul 17 14:45:55 2007 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 9C46F16A404 for ; Tue, 17 Jul 2007 14:45:55 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from speedfactory.net (mail6.speedfactory.net [66.23.216.219]) by mx1.freebsd.org (Postfix) with ESMTP id 4CCF113C4B4 for ; Tue, 17 Jul 2007 14:45:55 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from server.baldwin.cx (unverified [66.23.211.162]) by speedfactory.net (SurgeMail 3.7b8) with ESMTP id 197191648 for multiple; Tue, 17 Jul 2007 10:54:11 -0400 Received: from localhost.corp.yahoo.com (john@localhost [127.0.0.1]) (authenticated bits=0) by server.baldwin.cx (8.13.8/8.13.8) with ESMTP id l6HEjkMB043598; Tue, 17 Jul 2007 10:45:48 -0400 (EDT) (envelope-from jhb@freebsd.org) From: John Baldwin To: freebsd-hackers@freebsd.org Date: Tue, 17 Jul 2007 10:34:09 -0400 User-Agent: KMail/1.9.6 References: <20070716113425.GC65937@turion.vk2pj.dyndns.org> <469BB821.1010507@elischer.org> In-Reply-To: <469BB821.1010507@elischer.org> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200707171034.09619.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-2.0.2 (server.baldwin.cx [127.0.0.1]); Tue, 17 Jul 2007 10:45:49 -0400 (EDT) X-Virus-Scanned: ClamAV 0.88.3/3689/Tue Jul 17 08:02:12 2007 on server.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=4.2 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.1.3 X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on server.baldwin.cx X-Server: High Performance Mail Server - http://surgemail.com r=1653887525 Cc: Julian Elischer Subject: Re: add closefrom() call X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Jul 2007 14:45:55 -0000 On Monday 16 July 2007 02:25:37 pm Julian Elischer wrote: > Peter Jeremy wrote: > > On 2007-Jul-15 16:51:38 -0700, Julian Elischer wrote: > >>> void > >>> closefrom(int lowfd) > >>> { > >>> fcntl(lowfd, F_CLOSEM, NULL); > >>> } > >> what on earth would that achieve? > >> (as opposed to just a simple syscall) > > > > The only benefit I can think of is minimising the number of syscalls. > > Is there any other benefit? > > > > I don't think so.. it's less efficient, and harder to do.. > syscalls are not in short supply. Actually, adding a new fcntl is about the same as adding a new system call except that you don't have to generate tables, etc. (so it might actually be simpler). I'm not sure it's such a bad idea to just have a fcntl to get the max open fd and do the loop in userland so you get better auditing of the individual close() operations. -- John Baldwin