Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 4 Apr 2006 16:07:02 +1000 (EST)
From:      Bruce Evans <bde@zeta.org.au>
To:        Todd Miller <Todd.Miller@courtesan.com>
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
Message-ID:  <20060404155815.Q23645@delplex.bde.org>
In-Reply-To: <200604022043.k32KhEGU082448@www.freebsd.org>
References:  <200604022043.k32KhEGU082448@www.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20060404155815.Q23645>