* fhandler_serial.cc (fhandler_serial::raw_read): Always find number of bytes

ready to be read whether overlapped_armed or not.
This commit is contained in:
Christopher Faylor 2000-12-20 05:57:59 +00:00
parent b92b863bbf
commit 2bfdcd8a5f
3 changed files with 16 additions and 10 deletions

View File

@ -1,3 +1,8 @@
Wed Dec 20 00:57:10 2000 Christopher Faylor <cgf@cygnus.com>
* fhandler_serial.cc (fhandler_serial::raw_read): Always find number of
bytes ready to be read whether overlapped_armed or not.
Tue Dec 19 21:39:00 2000 Corinna Vinschen <corinna@vinschen.de> Tue Dec 19 21:39:00 2000 Corinna Vinschen <corinna@vinschen.de>
* syscalls.cc (remove): New function, overriding the newlib * syscalls.cc (remove): New function, overriding the newlib

View File

@ -1072,8 +1072,8 @@ events_terminate (void)
#define pid_offset (unsigned)(((_pinfo *)NULL)->pid) #define pid_offset (unsigned)(((_pinfo *)NULL)->pid)
extern "C" { extern "C" {
static void __stdcall reset_signal_arrived () __attribute__ ((unused)); static void volatile __stdcall reset_signal_arrived () __attribute__ ((unused));
static void __stdcall static void volatile __stdcall
reset_signal_arrived () reset_signal_arrived ()
{ {
(void) ResetEvent (signal_arrived); (void) ResetEvent (signal_arrived);

View File

@ -79,15 +79,16 @@ fhandler_serial::raw_read (void *ptr, size_t ulen)
// if vmin > ulen then things won't work right. // if vmin > ulen then things won't work right.
overlapped_armed = -1; overlapped_armed = -1;
} }
if (!overlapped_armed)
if (!ClearCommError (get_handle (), &ev, &st))
goto err;
else if (ev)
termios_printf ("error detected %x", ev);
else if (st.cbInQue)
inq = st.cbInQue;
else if (!overlapped_armed)
{ {
if (!ClearCommError (get_handle (), &ev, &st)) if ((size_t)tot >= minchars)
goto err;
else if (ev)
termios_printf ("error detected %x", ev);
else if (st.cbInQue)
inq = st.cbInQue;
else if ((size_t)tot >= minchars)
break; break;
else if (WaitCommEvent (get_handle (), &ev, &io_status)) else if (WaitCommEvent (get_handle (), &ev, &io_status))
{ {