public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* fd_sets and std[fd]
@ 2006-02-23 17:41 Jim Stapleton
  2006-02-23 18:11 ` Ian Lance Taylor
  0 siblings, 1 reply; 4+ messages in thread
From: Jim Stapleton @ 2006-02-23 17:41 UTC (permalink / raw)
  To: gcc-help

can you put stdin/stdout/stderr in an fdset (well, really only
interested in stdin) and then use it in select?

I'm curious because these are pointers to struct and not actual
integers like sockets, but some documentation I read said you could do
this, and shows socket fd's and these structure pointers used
interchangeably, which just confuses me. Every fiber of my programming
being wants to put stdin->_fileno in their instead, as sockets and
filenumbers are supposed to be the same according to the
documentation.

Can someone unconfuse me?

Thanks,
-Jim

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: fd_sets and std[fd]
  2006-02-23 17:41 fd_sets and std[fd] Jim Stapleton
@ 2006-02-23 18:11 ` Ian Lance Taylor
  2006-02-27 12:49   ` Jim Stapleton
  0 siblings, 1 reply; 4+ messages in thread
From: Ian Lance Taylor @ 2006-02-23 18:11 UTC (permalink / raw)
  To: Jim Stapleton; +Cc: gcc-help

"Jim Stapleton" <stapleton.41@gmail.com> writes:

> can you put stdin/stdout/stderr in an fdset (well, really only
> interested in stdin) and then use it in select?
> 
> I'm curious because these are pointers to struct and not actual
> integers like sockets, but some documentation I read said you could do
> this, and shows socket fd's and these structure pointers used
> interchangeably, which just confuses me. Every fiber of my programming
> being wants to put stdin->_fileno in their instead, as sockets and
> filenumbers are supposed to be the same according to the
> documentation.

Wrong mailing list.  This is a Unix programming question, not a gcc
question.

Here is my answer, but please don't followup to the list, and please
don't followup to me personally.  Go to a Unix programming list.
Thanks.

Yes, you can put fileno(stdin) in an fd_set.  But it may not tell you
exactly what you want, as there may be some data buffered up to read
in the STDIO structure.  In that case, select would indicate that
there is no data to be read, but in fact there would be some
available.

Ian

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: fd_sets and std[fd]
  2006-02-23 18:11 ` Ian Lance Taylor
@ 2006-02-27 12:49   ` Jim Stapleton
  2006-02-28  6:08     ` Ian Lance Taylor
  0 siblings, 1 reply; 4+ messages in thread
From: Jim Stapleton @ 2006-02-27 12:49 UTC (permalink / raw)
  To: gcc-help

I appologize, I was reading something, and what I found in the GCC
standard headers, and a couple of test outputs, didn't quite fit with
what I was reading on networked/IO things, and therefore, I concluded
there was something specific to the GCC implementation, and hence this
list seemed the most appropriate.

Also, a Unix mailing list would be less appropriate, as this isn't
Unix specific. Assuming my question weren't related to GCCs
implementation of this part of the C networking library, I'd want a
networking/IO based mailing list.

-Jim Stapleton

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: fd_sets and std[fd]
  2006-02-27 12:49   ` Jim Stapleton
@ 2006-02-28  6:08     ` Ian Lance Taylor
  0 siblings, 0 replies; 4+ messages in thread
From: Ian Lance Taylor @ 2006-02-28  6:08 UTC (permalink / raw)
  To: Jim Stapleton; +Cc: gcc-help

"Jim Stapleton" <stapleton.41@gmail.com> writes:

> I appologize, I was reading something, and what I found in the GCC
> standard headers, and a couple of test outputs, didn't quite fit with
> what I was reading on networked/IO things, and therefore, I concluded
> there was something specific to the GCC implementation, and hence this
> list seemed the most appropriate.
> 
> Also, a Unix mailing list would be less appropriate, as this isn't
> Unix specific. Assuming my question weren't related to GCCs
> implementation of this part of the C networking library, I'd want a
> networking/IO based mailing list.

gcc doesn't implement a C networking library.

You may be thinking of glibc, which is a separate project.

Ian

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2006-02-28  6:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-02-23 17:41 fd_sets and std[fd] Jim Stapleton
2006-02-23 18:11 ` Ian Lance Taylor
2006-02-27 12:49   ` Jim Stapleton
2006-02-28  6:08     ` Ian Lance Taylor

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