From ca6df52f0bf910bf8dd464f10416c41f2129f7e2 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Tue, 7 Mar 2006 22:22:46 +0000 Subject: [PATCH] 2006-03-07 Till Strauman PR 830/filesystem * src/termios.c: termios ioctl(FIONREAD) reported wrong number of characters. So add chars in low-level/raw buffer to total count. --- cpukit/libcsupport/ChangeLog | 6 ++++++ cpukit/libcsupport/src/termios.c | 7 ++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/cpukit/libcsupport/ChangeLog b/cpukit/libcsupport/ChangeLog index 92bd4689f7..bce4d03274 100644 --- a/cpukit/libcsupport/ChangeLog +++ b/cpukit/libcsupport/ChangeLog @@ -1,3 +1,9 @@ +2006-03-07 Till Strauman + + PR 830/filesystem + * src/termios.c: termios ioctl(FIONREAD) reported wrong number of + characters. So add chars in low-level/raw buffer to total count. + 2006-03-07 Till Strauman PR 886/filesystem diff --git a/cpukit/libcsupport/src/termios.c b/cpukit/libcsupport/src/termios.c index a6040e24b8..58d6ccc666 100644 --- a/cpukit/libcsupport/src/termios.c +++ b/cpukit/libcsupport/src/termios.c @@ -646,8 +646,13 @@ rtems_termios_ioctl (void *arg) break; #endif case FIONREAD: + { + int rawnc = tty->rawInBuf.Tail - tty->rawInBuf.Head; + if ( rawnc < 0 ) + rawnc += tty->rawInBuf.Size; /* Half guess that this is the right operation */ - *(int *)args->buffer = tty->ccount - tty->cindex; + *(int *)args->buffer = tty->ccount - tty->cindex + rawnc; + } break; } rtems_semaphore_release (tty->osem);