public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Ian Lance Taylor <ian@airs.com>
To: "Jim Stapleton" <stapleton.41@gmail.com>
Cc: gcc-help@gcc.gnu.org
Subject: Re: fd_sets and std[fd]
Date: Thu, 23 Feb 2006 18:11:00 -0000	[thread overview]
Message-ID: <m3k6bm6j31.fsf@gossamer.airs.com> (raw)
In-Reply-To: <80f4f2b20602230941y5b679796r1669430b4a6a4c31@mail.gmail.com>

"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

  reply	other threads:[~2006-02-23 18:11 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-02-23 17:41 Jim Stapleton
2006-02-23 18:11 ` Ian Lance Taylor [this message]
2006-02-27 12:49   ` Jim Stapleton
2006-02-28  6:08     ` Ian Lance Taylor

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=m3k6bm6j31.fsf@gossamer.airs.com \
    --to=ian@airs.com \
    --cc=gcc-help@gcc.gnu.org \
    --cc=stapleton.41@gmail.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).