Re: Compiling problem on AIX 4.2.1 with gcc

From: Chris Wedgwood <chris@dont-contact.us>
Date: Wed, 21 Apr 1999 09:34:35 +1200

On Tue, Apr 20, 1999 at 03:20:30PM -0600, Duane Wessels wrote:

> >Duane Wessels wrote:
> >
> >> while((j=open("/dev/null", 0)) > 0) i=j;
> >
> >I hope this only is for testing purposes.
>
> why, whats wrong with it?

Some systems, eg. FreeBSD and Linux , when configured to do so, will
allwo you to open 1M FDs or thereabouts... this is a _very_ harsh
thing to do on a live system.

> Linus has stated that OPEN_MAX will not change in kernel
> headers and it is unreliable to use it to check and Glibc
> puts in it's own headers which also force the configure
> script to default to 256. getrlimit() provides a reliable way
> to get the maximum file descriptors.

Indeed... after tweaking the appropriate sysctls on boot:

# ulimit -Hn 51240
# ulimit -Sn 51240
# gcc ~me/priv/experiments/open-test.c
# ./a.out
Opened 51237 times

-cw
Received on Tue Jul 29 2003 - 13:15:57 MDT

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:12:05 MST