Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 17 Oct 95 03:28:53 -0700
From:      Bakul Shah <bakul@netcom.com>
To:        Bruce Evans <bde@zeta.org.au>
Cc:        terry@lambert.org, current@freefall.freebsd.org, hackers@freefall.freebsd.org
Subject:   Re: getdtablesize() broken? 
Message-ID:  <199510171028.DAA04795@netcom5.netcom.com>
In-Reply-To: Your message of "Tue, 17 Oct 95 19:29:19 %2B1000." <199510170929.TAA03697@godzilla.zeta.org.au> 

next in thread | previous in thread | raw e-mail | index | archive | help
> 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]



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