This is the mail archive of the 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]

problem comport, iocl and FIONREAD

Hi all,

I'm seeing a problem with ioctl and FIONREAD, I use the
following code to check if there are any bytes in the
input buffer of a comport.

unsigned int SerialIO::getBufferSize()

int bufferedBytes = 0;

ioctl(IOPortHandle, FIONREAD, &bufferedBytes);

   if (bufferedBytes == -1)

      bufferedBytes = 0;
      /* log an error */


return (unsigned int)bufferedBytes;


the problem is that even when there is data in the buffer bufferedBytes has a value of zero.

Searching the net I've found an unresolved gcc bug report
on the same problem issued 2 months ago:

I'm wondering 1. If any cygwin users have encountered such a problem? 2. If they have, were they able to find a solution etc..

Any help would be very much appreciated



PS: I ran the same code on solaris and openbsd, seems to work fine...

Be one who knows what they don't know,
Instead of being one who knows not what they don't know,
Thinking they know everything about all things.


Get less junk mail with ninemsn Premium. Click here

-- Unsubscribe info: Problem reports: Documentation: FAQ:

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