This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Incorrect behavior in TIOCINQ ioctl


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]