From owner-freebsd-bugs@FreeBSD.ORG Tue Apr 4 06:10:20 2006 Return-Path: X-Original-To: freebsd-bugs@hub.freebsd.org Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7CA1D16A420 for ; Tue, 4 Apr 2006 06:10:20 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 192C743D53 for ; Tue, 4 Apr 2006 06:10:20 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.4/8.13.4) with ESMTP id k346AJxo092572 for ; Tue, 4 Apr 2006 06:10:19 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.4/8.13.4/Submit) id k346AJDW092570; Tue, 4 Apr 2006 06:10:19 GMT (envelope-from gnats) Date: Tue, 4 Apr 2006 06:10:19 GMT Message-Id: <200604040610.k346AJDW092570@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org From: Bruce Evans Cc: 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 Reply-To: Bruce Evans List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Apr 2006 06:10:20 -0000 The following reply was made to PR kern/95239; it has been noted by GNATS. From: Bruce Evans To: Todd Miller Cc: freebsd-gnats-submit@FreeBSD.org, freebsd-bugs@FreeBSD.org Subject: Re: misc/95239: nftw() returns EINVAL for large values of maxfds when it should not Date: Tue, 4 Apr 2006 16:07:02 +1000 (EST) 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