public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Steven Bardwell <SBardwell@lbmsys.com>
To: "cygwin@cygwin.com" <cygwin@cygwin.com>
Subject: RE: FD_SETSIZE and sizeof(fd_set) - thanks for a simple solution
Date: Thu, 23 Jun 2016 12:35:00 -0000	[thread overview]
Message-ID: <DM3PR18MB0841748253525B0F97E55939DB2D0@DM3PR18MB0841.namprd18.prod.outlook.com> (raw)

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


                 reply	other threads:[~2016-06-23 12:07 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DM3PR18MB0841748253525B0F97E55939DB2D0@DM3PR18MB0841.namprd18.prod.outlook.com \
    --to=sbardwell@lbmsys.com \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).