Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 17 Oct 1995 19:29:19 +1000
From:      Bruce Evans <bde@zeta.org.au>
To:        bakul@netcom.com, terry@lambert.org
Cc:        current@freefall.freebsd.org, hackers@freefall.freebsd.org
Subject:   Re: getdtablesize() broken?
Message-ID:  <199510170929.TAA03697@godzilla.zeta.org.au>

next in thread | raw e-mail | index | archive | help
>(BTW, If you don't change the limit, you will discover an off by
>one bug: the default limit is 64 but you can only open 63 fds)

I get 64.  Perhaps you have a shell bug.

>So I can do everything with fd > 255 except select().  This
>happens because of this line in /sys/kern/sys_generic.c:select()

>	if (uap->nd > FD_SETSIZE)

>It should be replaced with

>	if (uap->nd > p->fd->fd_nfiles)

>It is this hardwired use of FD_SETSIZE *in* the kernel I am
>bitching about.

This would just give random errors or clobber the kernel stack.
The limit is built in to the fd_set type.  The FD_SETSIZE check
just makes sure that all the bits fit in the kernel fd_set
variables.  The kernel needs to use dynamically allocated
arrays to hold more bits, and different methods to access the
bits...

Bruce



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