Date: Tue, 4 Apr 2006 06:10:19 GMT From: Bruce Evans <bde@zeta.org.au> To: freebsd-bugs@FreeBSD.org Subject: Re: misc/95239: nftw() returns EINVAL for large values of maxfds when it should not Message-ID: <200604040610.k346AJDW092570@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR kern/95239; it has been noted by GNATS. From: Bruce Evans <bde@zeta.org.au> To: Todd Miller <Todd.Miller@courtesan.com> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200604040610.k346AJDW092570>