From owner-freebsd-bugs@FreeBSD.ORG Tue Apr 4 06:07:12 2006 Return-Path: X-Original-To: freebsd-bugs@FreeBSD.org Delivered-To: freebsd-bugs@FreeBSD.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 1619C16A420; Tue, 4 Apr 2006 06:07:12 +0000 (UTC) (envelope-from bde@zeta.org.au) Received: from mailout2.pacific.net.au (mailout2.pacific.net.au [61.8.0.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 011D543D68; Tue, 4 Apr 2006 06:07:06 +0000 (GMT) (envelope-from bde@zeta.org.au) Received: from mailproxy1.pacific.net.au (mailproxy1.pacific.net.au [61.8.0.86]) by mailout2.pacific.net.au (Postfix) with ESMTP id 42C5FEDCD6; Tue, 4 Apr 2006 16:07:05 +1000 (EST) Received: from katana.zip.com.au (katana.zip.com.au [61.8.7.246]) by mailproxy1.pacific.net.au (8.13.4/8.13.4/Debian-3) with ESMTP id k345TqFA025419; Tue, 4 Apr 2006 15:29:53 +1000 Date: Tue, 4 Apr 2006 16:07:02 +1000 (EST) From: Bruce Evans X-X-Sender: bde@delplex.bde.org To: Todd Miller In-Reply-To: <200604022043.k32KhEGU082448@www.freebsd.org> Message-ID: <20060404155815.Q23645@delplex.bde.org> References: <200604022043.k32KhEGU082448@www.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: freebsd-bugs@FreeBSD.org, freebsd-gnats-submit@FreeBSD.org Subject: Re: misc/95239: nftw() returns EINVAL for large values of maxfds when it should not X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Apr 2006 06:07:12 -0000 On Sun, 2 Apr 2006, Todd Miller wrote: >> Description: > The nftw(3) I wrote for OpenBSD that is now used by FreeBSD has a bug where it returns -1 and sets errno to EINVAL when maxfds > OPEN_MAX. However, only the older ftw(3) should have this restriction (see single unix or POSIX). > > I've inluded the fix I used in OpenBSD but due to the web form submission the patch will likely have to be applied by hand (it is small). It is a bug for anything to have a limit of OPEN_MAX for anything. The POSIX limit for everything that has a limit on open files, including ftw, is {OPEN_MAX} is quite different. It is a bug for BSD systems to define OPEN_MAX, since defining OPEN_MAX says that the limit on open files is a compile-time constant but it is actually a runtime constant and highly variable. On FreeBSD at least, {OPEN_MAX} = sysconf(_SC_OPEN_MAX) is the associated rlimit. Bruce