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.
This commit is contained in:
Joel Sherrill
2001-08-16 20:04:19 +00:00
parent 2fe224f2e2
commit 4b3c197fc0
4 changed files with 48 additions and 24 deletions

View File

@@ -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;
}

View File

@@ -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

View File

@@ -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;
}

View File

@@ -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;
}