summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2001-08-16 20:04:19 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2001-08-16 20:04:19 +0000
commit4b3c197fc0912a22b07affd7caef344ce301840a (patch)
treeb4e9b758d389c5c1dc6dd9eb2a850488d5dc8b3b
parent2001-08-16 Joel Sherrill <joel@OARcorp.com> (diff)
downloadrtems-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/exec/libcsupport/src/termios.c19
-rw-r--r--c/src/lib/ChangeLog15
-rw-r--r--c/src/lib/libc/termios.c19
-rw-r--r--cpukit/libcsupport/src/termios.c19
4 files changed, 48 insertions, 24 deletions
diff --git a/c/src/exec/libcsupport/src/termios.c b/c/src/exec/libcsupport/src/termios.c
index cf0c4984eb..0a23d5bc32 100644
--- a/c/src/exec/libcsupport/src/termios.c
+++ b/c/src/exec/libcsupport/src/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;
}
diff --git a/c/src/lib/ChangeLog b/c/src/lib/ChangeLog
index a4d4064130..4581a619bd 100644
--- a/c/src/lib/ChangeLog
+++ b/c/src/lib/ChangeLog
@@ -1,3 +1,18 @@
+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.
+
2001-08-09 Fernando-Ruiz Casas <correo@fernando-ruiz.com>
* libc/getgrent.c, libc/getpwent.c: the 'ls' and more related command
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;
}
diff --git a/cpukit/libcsupport/src/termios.c b/cpukit/libcsupport/src/termios.c
index cf0c4984eb..0a23d5bc32 100644
--- a/cpukit/libcsupport/src/termios.c
+++ b/cpukit/libcsupport/src/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;
}