Max open files....
Edan Idzerda
edan at mtu.edu
Sat Apr 18 18:09:19 GMT 1998
On Sun, 19 Apr 1998, Luke Kenneth Casson Leighton wrote:
> On Sat, 18 Apr 1998, Jeremy Allison wrote:
> > I *know* it will crash some UNIXs (who shall remain
> > nameless :-) if it gets set too high.
>
> hm... how about a default MAX_OPEN_FILES on a per-system basis, then?
>
> is it acceptable for autoconf to try to work this out: crashing the UNIX
> box, dealing with the subsequent reboot and recovery etc :-)
What about determining if the system in question has getrlimit()
and using the value returned by that? I quickly checked SunOS 4.1.3,
5.5.1, 5.6, and Irix 5.something using the same little test program
and it worked fine on all of them.
Irix won with a hard limit of 2500, Solaris 2 was next with 1024, and
Solaris 1 returned a piddly 256.
I just thought that if we can determine the maximum number ourselves,
we shouldn't let the user configure us to crash, since they'll say
its our fault when they do :)
Of course, now I see that Jean-Francois Micouleau has already
suggested it...
- edan
/*
** THIS PROGRAM IS COPYRIGHT 1998 EDAN IDZERDA AND MAY NOT BE COPIED,
** READ, COMPILED, EDITED, DELETED, DISPLAYED OR GLANCED AT WITHOUT
** EXPRESS WRITTEN PERMISSION OF SAID COPYRIGHT OWNER.
**
** THIS PROGRAM IS CONSIDERED A MUTITION BY CERTAIN NARROW MINDED
** GOVERNMENTS. FAILURE TO OBSERVE EXPORT LAWS WILL RESULT IN THE
** ERASURE OF YOUR HARD DRIVE AND THE DEATH OF YOUR DOG.
*/
#include <stdio.h>
#include <sys/time.h>
#include <sys/resource.h>
main () {
struct rlimit rlp;
getrlimit (RLIMIT_NOFILE, &rlp);
printf ("current %d\n hard %d\n", rlp.rlim_cur, rlp.rlim_max);
}
More information about the samba-technical
mailing list