public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* RE: FD_SETSIZE and sizeof(fd_set) - thanks for a simple solution
@ 2016-06-23 12:35 Steven Bardwell
  0 siblings, 0 replies; only message in thread
From: Steven Bardwell @ 2016-06-23 12:35 UTC (permalink / raw)
  To: cygwin

> > > > > > 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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2016-06-23 12:07 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-23 12:35 FD_SETSIZE and sizeof(fd_set) - thanks for a simple solution Steven Bardwell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).