From owner-freebsd-hackers@FreeBSD.ORG Fri Jul 6 12:42:13 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 B41C316A46C for ; Fri, 6 Jul 2007 12:42:13 +0000 (UTC) (envelope-from joerg@britannica.bec.de) Received: from www.pkgsrc-box.org (www.ostsee-abc.de [62.206.222.50]) by mx1.freebsd.org (Postfix) with ESMTP id 8BE2713C448 for ; Fri, 6 Jul 2007 12:42:12 +0000 (UTC) (envelope-from joerg@britannica.bec.de) Received: from britannica.bec.de (www.pkgsrc-box.org [127.0.0.1]) by www.pkgsrc-box.org (Postfix) with ESMTP id B8B4FE7A3FA for ; Fri, 6 Jul 2007 12:42:05 +0000 (UTC) Received: by britannica.bec.de (Postfix, from userid 1000) id 6DA787D6C; Fri, 6 Jul 2007 14:41:19 +0200 (CEST) Date: Fri, 6 Jul 2007 14:41:19 +0200 From: Joerg Sonnenberger To: freebsd-hackers@freebsd.org Message-ID: <20070706124119.GD427@britannica.bec.de> Mail-Followup-To: freebsd-hackers@freebsd.org References: <20070705122650.GE1302@britannica.bec.de> <468E16E6.6030608@delphij.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <468E16E6.6030608@delphij.net> User-Agent: Mutt/1.5.13 (2006-08-11) 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: Fri, 06 Jul 2007 12:42:13 -0000 On Fri, Jul 06, 2007 at 06:18:14PM +0800, LI Xin wrote: > - closefrom(-1) would be no-op on DragonFly, my version would close all > open files (From my understanding of OpenSolaris's userland > implementation, this is Solaris's behavior). I think this is a bad idea as -1 is generally an invalid file descriptor. > - my version closefrom(very_big_fd) would result in EBADF. I am not > very sure whether this is correct, but it does not hurt for applications > that thinks closefrom() would return void. I don't think this is a good idea either. One typical use is closefrom(3) and returning an error because no such descriptors are open sounds very wrong. It also just adds another special case as the loop handles this already.... Joerg