Re: fork: out of memory

Andi Kleen (ak@muc.de)
25 Nov 1997 14:51:00 +0100


alan@lxorguk.ukuu.org.uk (Alan Cox) writes:

> > Hmm ... FreeBSD gets round this by allowing you to
> > redefine FD_SETSIZE in your own programs before you
>
> You can do this in Linux. And like in BSDI it doesnt work
> for all cases. the fd_set size is compiled into some libc
> functions (notably NIS stuff). You use fd 0-4093 and nis
> stops working cos its fd is outside its fdset size.
>
> glibc knows how to handle this right

No, it doesn't. e.g. the DNS resolver will stop working. I grepped 4-5
other usages of select in the sources (including the sunrpc code).
glibc limits you to 1024fds in the fd_set defintition anyways. The
correct way is to either use poll() everwhere or use dynamically allocated
fd_sets internally (that's easy with gcc's dynamic local arrays or
with alloca())

-Andi