From owner-freebsd-current Sat Oct 14 15:27:02 1995 Return-Path: owner-current Received: (from root@localhost) by freefall.freebsd.org (8.6.12/8.6.6) id PAA20057 for current-outgoing; Sat, 14 Oct 1995 15:27:02 -0700 Received: from godzilla.zeta.org.au (godzilla.zeta.org.au [203.2.228.19]) by freefall.freebsd.org (8.6.12/8.6.6) with ESMTP id PAA20050 for ; Sat, 14 Oct 1995 15:26:56 -0700 Received: (from bde@localhost) by godzilla.zeta.org.au (8.6.9/8.6.9) id IAA27494; Sun, 15 Oct 1995 08:26:21 +1000 Date: Sun, 15 Oct 1995 08:26:21 +1000 From: Bruce Evans Message-Id: <199510142226.IAA27494@godzilla.zeta.org.au> To: volf@oasis.IAEhv.nl Subject: Re: kern/781: MAX_OPEN and FD_SETSIZE Cc: current@freebsd.org Sender: owner-current@freebsd.org Precedence: bulk >>Description: > The OPEN_MAX define in the kernel configuration can be used to have > a large number of open file descriptors (e.g. 512), OPEN_MAX shouldn't be defined in the kernel configuration. Defining it there doesn't affect the value defined in , which may be relied on by applications. E.g., to fix the current problem (*), FD_SETSIZE could reasonably be min(256, OPEN_MAX). This number would then be compiled into binaries and would be invalid if OPEN_MAX was defined as more than 256 in the kernel config. (*) This doesn't actually fix the problem because OPEN_MAX isn't actually a constant. OPEN_MAX is only used in the kernel as the default (soft) limit on the number of fd's. setrlimit(RLIMIT_NOFILE, rlp), where *rlp specifies a large limit, has the same effect as defining OPEN_MAX to a large value only in the kernel. No good fix is evident. There is no such thing as a struct with variable length, so the fd_set type can't be resized at runtime. >... > The select() fails at runtime if it is called with a nfds > FD_SETSIZE, > because it is compiled with the FD_SETSIZE value, and does not > know about OPEN_MAX > 256 >>Fix: > > Preferable automatic generation of the types.h file from kernel > configuration by /usr/sbin/config. This doeesn't work because of the binary compatibility issues. >Please, let me know the status of this bug report (maybe I did something >wrong). All OK. Bruce