From owner-freebsd-current Tue Oct 17 03:30:30 1995 Return-Path: owner-current Received: (from root@localhost) by freefall.freebsd.org (8.6.12/8.6.6) id DAA21907 for current-outgoing; Tue, 17 Oct 1995 03:30:30 -0700 Received: from netcom5.netcom.com (bakul@netcom5.netcom.com [192.100.81.113]) by freefall.freebsd.org (8.6.12/8.6.6) with ESMTP id DAA21888 ; Tue, 17 Oct 1995 03:30:23 -0700 Received: from localhost by netcom5.netcom.com (8.6.12/Netcom) id DAA04795; Tue, 17 Oct 1995 03:28:54 -0700 Message-Id: <199510171028.DAA04795@netcom5.netcom.com> To: Bruce Evans cc: terry@lambert.org, current@freefall.freebsd.org, hackers@freefall.freebsd.org Subject: Re: getdtablesize() broken? In-reply-to: Your message of "Tue, 17 Oct 95 19:29:19 +1000." <199510170929.TAA03697@godzilla.zeta.org.au> Date: Tue, 17 Oct 95 03:28:53 -0700 From: Bakul Shah Sender: owner-current@FreeBSD.org Precedence: bulk > I get 64. Perhaps you have a shell bug. Possible. Or may be there is an exra fd open. zsh seems to be the culprit here. > >It is this hardwired use of FD_SETSIZE *in* the kernel I am > >bitching about. > 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... But of course! [My fix was partial but if you decide to banish FD_SETSIZE removing all use of fd_set follows -- I should never respond when I am half asleep; but that is when I get some free time :-(] Anyway, instead of fd_set the kernel needs to use just int* (and allocate enough ints). Instead of macros FD_{SET,CLR,ISSET,ZERO} it can use #define SET_BIT(n, p) ((p)[(n)/NFDBITS] |= (1 << ((n) % NFDBITS))) #define CLR_BIT(n, p) ((p)[(n)/NFDBITS] &= ~(1 << ((n) % NFDBITS))) #define ISSET_BIT(n, p) ((p)[(n)/NFDBITS] & (1 << ((n) % NFDBITS))) #define ZERO_BITS(n, p) bzero((char*)(p), \ howmany((n), NFDBITS) * sizeof(fd_mask)) [Going off on another tangent -- I wish we can start using inline functions instead of such odious macros -- even though inline is not ISO sanctioned every compiler worth its salt provides it]