public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Incorrect behavior in TIOCINQ ioctl
@ 2020-02-27 21:39 Åke Rehnman
  2020-02-28 19:23 ` Corinna Vinschen
  0 siblings, 1 reply; 4+ messages in thread
From: Åke Rehnman @ 2020-02-27 21:39 UTC (permalink / raw)
  To: cygwin

Hi,

I recently ran in to some troubles with the TIOCINQ ioctl. I am 
wondering if the cygwin implementation is correct... It seems if there 
were any existing framing overrun errors etc etc  before calling the 
TIOCINQ ioctl it is returning an error (EINVAL). Reading through linux 
implmentation of TIOCINQ does simply return number of pending chars 
without any clearing or checking for errors.

I suggest the whole if (ev & CE_FRAME  ...... ) is removed.

Excerpt from fhandler_serial.cc:

/* ioctl: */
int
fhandler_serial::ioctl (unsigned int cmd, void *buf)
{
.
.
   if (!ClearCommError (get_handle (), &ev, &st))
     {
       __seterrno ();
       res = -1;
     }
.
.
.
      case TIOCINQ:
        if (ev & CE_FRAME || ev & CE_IOE || ev & CE_OVERRUN || ev & 
CE_RXOVER
        || ev & CE_RXPARITY)
      {
        set_errno (EINVAL);    /* FIXME: Use correct errno */
        res = -1;
      }
      else
         ipbuf = st.cbInQue;
      break;



--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

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

end of thread, other threads:[~2020-03-02 16:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-27 21:39 Incorrect behavior in TIOCINQ ioctl Åke Rehnman
2020-02-28 19:23 ` Corinna Vinschen
2020-02-29 10:37   ` Åke Rehnman
2020-03-02 16:07     ` Corinna Vinschen

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