This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: FD_SETSIZE and sizeof(fd_set) - thanks for a simple solution


> > > > > > Here is a "program" that shows the issue I am worried about. It is so
> simple
> > > > > that I must be overlooking something really obvious:
> > > > > >
> > > > > > #include <stdio.h>
> > > > > > #undef FD_SETSIZE
> > > > > > #define FD_SETSIZE 256
> > > > > > #include <sys/types.h>
> > > > > > #include <sys/select.h>
> > > > > >
> > > > > > main()
> > > > > > {
> > > > > >         fd_set rfds;
> > > > > >         fprintf(stdout, "FD_SETSIZE=%d\n", FD_SETSIZE);
> > > > > >         fprintf(stdout, "sizeof(fd_set)=%d\n", sizeof(fd_set));
> > > > > > }
> > > > > >
> > > > > > Steve Bardwell
> > > > > >
> > > > For what it's worth, this 'program' works as expected in SUA. The size
> > > > of the fd_set changes depending on the value of FD_SETSIZE.
> > >
 
> Oh yeah, the inclusion of stdio.h also includes sys/select.h so the
> first (default) definition of FD_SETSIZE to 64 rules.  In theory it
> shouldn't do that so we might have to change it in the newlib headers,
> but for th time being, just define FD_SETSIZE before including any
> system header.
> 
> 
> Corinna

Brilliant! Thanks so much for figuring this out.

Steve Bardwell


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