This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
RE: select () confusion
- To: "'Jonathan Larmour'" <jlarmour at redhat dot com>
- Subject: RE: [ECOS] select () confusion
- From: "Trenton D. Adams" <tadams at extremeeng dot com>
- Date: Thu, 2 Aug 2001 15:55:55 -0600
- Cc: "'eCos Discussion'" <ecos-discuss at sourceware dot cygnus dot com>
- Organization: Extreme Engineering
>
> Yes. Normally you track the largest fd you've ever had, or keep a
list
> of
> fds. Or just use FD_SETSIZE if you're lazy IIRC.
>
IIRC?
> > Anyhow, I thought that the first parameter was the number of file
> > descriptors in the fd_set. It makes no sense to have to calculate
> what
> > the highest numbered socket descriptor is before calling select
().
>
> It's standard BSD select() use.
>
Not *_ALL_* standards are a good idea! ;)
I personally like the windows, BSD *compatible*, select better. The
first parameter is there only for compatibility. Since FD_SET always
increments the fd count anyhow, I don't see a point in even using the
first parameter.
> > On
> > top of that, the example at the bottom of the documentation for
select
> > () is not very good. It passes a 1 in as the first parameter
which is
> > exactly why I thought it was the number of file descriptors and
not
> the
> > highest numbered one.
>
> Ah, that's because it happens to choose stdin, which is always fd 0.
>
Oh, I see.