Re: File Descriptors & Linux 2.0

Miquel van Smoorenburg (miquels@cistron.nl)
26 Jun 1996 20:59:38 +0200


In article <hpa.31d0f336.I.use.Linux@freya.yggdrasil.com>,
H. Peter Anvin <hpa@freya.yggdrasil.com> wrote:
>By author: David Schwartz <davids@wiznet.net>
>>
>> It used to be that under 1.3.65 through about 1.3.78 you could go
>> up to 1024 fd's per process by chaning NR_OPEN, NR_FILE, FD_SETSIZE, and
>> a few other little things. That doesn't seem to work on 2.0.0.
>
>"A few other little things" meaning recompiling libc and all your
>applications!

I just checked the Linux-2.0.0 kernel and the sys_select function never
writes further in your fd_set than the nr_fds argument to select(). This
means that if NR_OPEN is increased, and the size of fd_set increases with it,
it doesn't have consequences for older applications. The only thing is that
an old application can't handle a fd > 255 in a select() if one is passed
through fork()/exec() but I know of no applications that do this. So I think
you can do this without trouble.

If it's the other way around, and you try to pass a nr_fds > NR_OPEN to
select() the kernel sys_select function will round it down to NR_OPEN
quietly. So that doesn't cause trouble either.

Somehow I get the feeling that sys_select() was coded with this already
in mind..

Mike.

-- 
  Miquel van    | Cistron Internet Services   --    Alphen aan den Rijn.
  Smoorenburg,  | mailto:info@cistron.nl          http://www.cistron.nl/
miquels@het.net | Tel: +31-172-419445 (Voice) 430979 (Fax) 442580 (Data)