From owner-svn-src-head@FreeBSD.ORG Mon Jun 15 21:10:19 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 613C81065843; Mon, 15 Jun 2009 21:10:15 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 2BB238FC20; Mon, 15 Jun 2009 21:10:15 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id D54A346B52; Mon, 15 Jun 2009 17:10:14 -0400 (EDT) Received: from jhbbsd.hudson-trading.com (unknown [209.249.190.8]) by bigwig.baldwin.cx (Postfix) with ESMTPA id BFD1B8A072; Mon, 15 Jun 2009 17:10:13 -0400 (EDT) From: John Baldwin To: Colin Percival Date: Mon, 15 Jun 2009 17:09:54 -0400 User-Agent: KMail/1.9.7 References: <200906152038.n5FKctaR001026@svn.freebsd.org> <4A36B3E2.7060309@freebsd.org> In-Reply-To: <4A36B3E2.7060309@freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200906151709.55435.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (bigwig.baldwin.cx); Mon, 15 Jun 2009 17:10:13 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.95.1 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.5 required=4.2 tests=AWL,BAYES_00,RDNS_NONE autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r194262 - in head: include lib/libc/sys sys/compat/freebsd32 sys/kern tools/regression/file/closefrom X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Jun 2009 21:10:24 -0000 On Monday 15 June 2009 4:49:38 pm Colin Percival wrote: > John Baldwin wrote: > > One difference from other *BSD is that this closefrom() does not > > fail with any errors. In practice, while the manpages for NetBSD and > > OpenBSD claim that they return EINTR, they ignore internal errors from > > close() and never return EINTR. DFly does return EINTR, but for the common > > use case (closing fd's prior to execve()), the caller really wants all > > fd's closed and returning EINTR just forces callers to call closefrom() in > > a loop until it stops failing. > > Wouldn't it be better for portability if closefrom(2) is defined to return an > int, even if the value returned is always zero? Otherwise people who want to > write code which works on all BSDs end up having to do something like > #ifdef __FreeBSD__ > closefrom(x); > #else > while (closefrom(x)) > continue; > #endif Solaris returns void, so we just end up in their #ifdef vs the other. Also, Robert's belief is that the vast majority of existing code doesn't do a loop correctly, but instead just does a single call to closefrom(x). In that case, ignoring errors gives the best chance of working correctly. -- John Baldwin