Subject: Re: sys_select() EBADF bug
To: None <itojun@iijlab.net>
From: David Laight <david@l8s.co.uk>
List: tech-kern
Date: 11/15/2002 20:25:21
> but,
> - we can have file descriptor larger than FD_SETSIZE.
> - we can pass fd_set bitmap larger than FD_SETSIZE okay.
> (see usr.sbin/traceroute6/traceroute6.c for instance)
> so i don't see the need for returning error when nfds > FD_SETSIZE.
No - that code is broken, or at least not fully portable.
Not least because is assumes the format of fd_set - which is not public.
If we want netbsd to be posix compliant (I suspect that is an aim)
then there is a requirement to error nfds > FD_SETSIZE.
It is perhaps unfortunate that select is part of the posix base
and not part of the networking section, otherwise we might have
fixed the definitions in XNET when sorting out the rest of XNS.
Definitions of FD_ALLOC(nfd) and FD_ZERO_N(p,nfd) would allow
code to portably use large fd sets. However I suspect there
is an intention to (slowly) depracate select in favour of poll.
I don't know whether it is valid to use a macro to define
select. The usual problem is that inclusion of the header files
may not be mandatory - certainly any X/Open test suits get VERY
confused when you start playing with macros in order to get the
desired prototype and/or external symbol.
David
--
David Laight: david@l8s.co.uk