Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Mark Kettenis <mark.kettenis@xs4all.nl>
To: brobecker@adacore.com
Cc: gdb-patches@sourceware.org
Subject: Re: [RFA/commit] Handle EOF on terminals opened with ENONBLOCK...
Date: Thu, 23 Apr 2009 19:35:00 -0000	[thread overview]
Message-ID: <200904231934.n3NJY7j7006691@brahms.sibelius.xs4all.nl> (raw)
In-Reply-To: <20090423191446.GB7512@adacore.com> (message from Joel Brobecker 	on Thu, 23 Apr 2009 12:14:46 -0700)

> Date: Thu, 23 Apr 2009 12:14:46 -0700
> From: Joel Brobecker <brobecker@adacore.com>
> 
> What happens is that, by the time GDB makes a read on the pseudo-
> terminal, there is nothing to read yet, and thus gets EOF back.
> The thing to do, to detect our case, is to check the errno value,
> and try again a little later if it's EAGAIN.
> 
> 2009-04-23  Joel Brobecker   <brobecker@adacore.com>
> 
>         * utils.c: Add include of gdb_usleep.h.
>         (defaulted_query): Detect false EOF conditions that happen
>         on terminals opened with the O_NONBLOCK flag when there is
>         nothing to read.
> 
> We've tested this patch on all the hosts that AdaCore supports.
> This includes GNU/Linux, Solaris, AIX, Tru64, MinGW...
> Would it be OK to commit?

Ugh, yuck, this is gross!

I suppose the errno == EAGAIN is supposed to check whether fgetc()
failed.  However, your code has an ferror() in between, which could
clobber errno.  So perhaps it is better to reverse those checks.


  reply	other threads:[~2009-04-23 19:35 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-23 19:14 Joel Brobecker
2009-04-23 19:35 ` Mark Kettenis [this message]
2009-04-23 20:37   ` Joel Brobecker
2009-04-23 20:45     ` Mark Kettenis
2009-04-24 10:20 ` Eli Zaretskii
2009-05-06 23:02 ` Joel Brobecker
2009-05-07  3:13   ` Eli Zaretskii

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=200904231934.n3NJY7j7006691@brahms.sibelius.xs4all.nl \
    --to=mark.kettenis@xs4all.nl \
    --cc=brobecker@adacore.com \
    --cc=gdb-patches@sourceware.org \
    /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