This is the mail archive of the libc-hacker@sourceware.cygnus.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: OPEN_MAX/FOPEN_MAX is dynamic?


> The "dynamic" adaption of the __fd_set size can be very easily done by
> adding #ifndef __FD_SETSIZE around the definition in bits/types.h to
> allow the user to define this value.  This would be trivial.
> 
> Unfortunately it is not possible to define __FD_SETSIZE as something like
> 
> 	#define __FD_SETSIZE (__magically_get_value_from_kernel ())
> 
> since it must be a compile time constant.

Not true.  There is no need to get a magic value, because it does not need
to be constant.  That is, FD_SETSIZE needs to be constant because it's used
in the __fd_set data type definition, but the size in that definition
constrains nothing except statically-sized variable definitions and the
FD_ZERO macro.

If you dynamically allocate a bit vector big enough for the maxfd you are
passing to select, you are fine.  This is the way select was originally
intended to be used, since 4.2 BSD.

That is what I think glibc ought to do.  The poll interface is very
wasteful of memory.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]