diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 2001-08-16 20:04:19 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 2001-08-16 20:04:19 +0000 |
commit | 4b3c197fc0912a22b07affd7caef344ce301840a (patch) | |
tree | b4e9b758d389c5c1dc6dd9eb2a850488d5dc8b3b /c/src/lib/libc | |
parent | 2001-08-16 Joel Sherrill <joel@OARcorp.com> (diff) | |
download | rtems-4b3c197fc0912a22b07affd7caef344ce301840a.tar.bz2 |
2001-08-16 Mike Siers <mikes@poliac.com>
* libc/termios.c: Fix a bug in the termios implementation in
the following scenario:
The General Terminal Interface document that me states that
if VMIN = 0 and VTIME = 0, then read() should return the minimum
of two values:
a) number of bytes available
b) number of bytes requested (I assume from the read call)
The current implementation of the fillBufferQueue() in termios.c is
always return 1 character with these setting values. I know the
termios buffer has more than one character available and my read()
call is requesting 1024 bytes.
Diffstat (limited to '')
-rw-r--r-- | c/src/lib/libc/termios.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/c/src/lib/libc/termios.c b/c/src/lib/libc/termios.c index cf0c4984eb..0a23d5bc32 100644 --- a/c/src/lib/libc/termios.c +++ b/c/src/lib/libc/termios.c @@ -982,8 +982,9 @@ fillBufferQueue (struct rtems_termios_tty *tty) { rtems_interval timeout = tty->rawInBufSemaphoreFirstTimeout; rtems_status_code sc; + int wait = (int)1; - for (;;) { + while ( wait ) { /* * Process characters read from raw queue */ @@ -1020,12 +1021,12 @@ fillBufferQueue (struct rtems_termios_tty *tty) /* continue processing new character */ if (tty->termios.c_lflag & ICANON) { if (siproc (c, tty)) - return RTEMS_SUCCESSFUL; + wait = 0; } else { siproc (c, tty); if (tty->ccount >= tty->termios.c_cc[VMIN]) - return RTEMS_SUCCESSFUL; + wait = 0; } timeout = tty->rawInBufSemaphoreTimeout; } @@ -1033,11 +1034,13 @@ fillBufferQueue (struct rtems_termios_tty *tty) /* * Wait for characters */ - sc = rtems_semaphore_obtain (tty->rawInBuf.Semaphore, - tty->rawInBufSemaphoreOptions, - timeout); - if (sc != RTEMS_SUCCESSFUL) - break; + if ( wait ) { + sc = rtems_semaphore_obtain (tty->rawInBuf.Semaphore, + tty->rawInBufSemaphoreOptions, + timeout); + if (sc != RTEMS_SUCCESSFUL) + break; + } } return RTEMS_SUCCESSFUL; } |