Initialized tty->refcount to 0. When (for whatever reason) malloc()

returned a buffer which was not zero-filled, the reference count
was not correct.  When the application exitted, the "lastClose"
handler was not being called to flush the output.  This problem
had manifested itself on a variety of platforms.

The function rtems_termios_dequeue_characters() incorrectly incremented
the buffer pointers when it was invoked and there were no characters
in the ring buffer.  This problem had also manifested itself on a
variety of platforms.  The symptom was a strange repeating of the
data in the transmitter buffer when the transmitter serial device
was supposed to go idle.
This commit is contained in:
Joel Sherrill
1998-07-17 22:34:54 +00:00
parent 4fb08fd89e
commit 4555bc1eb5
3 changed files with 9 additions and 0 deletions

View File

@@ -219,6 +219,7 @@ rtems_termios_open (
tty->minor = minor;
tty->major = major;
tty->refcount = 0;
/*
* Set up mutex semaphores
@@ -922,6 +923,8 @@ rtems_termios_dequeue_characters (void *ttyp, int len)
if (tty->rawOutBufState == rob_wait)
rtems_semaphore_release (tty->rawOutBufSemaphore);
if ( tty->rawOutBufHead == tty->rawOutBufTail )
return;
newTail = (tty->rawOutBufTail + len) % RAW_OUTPUT_BUFFER_SIZE;
if (newTail == tty->rawOutBufHead) {
/*

View File

@@ -219,6 +219,7 @@ rtems_termios_open (
tty->minor = minor;
tty->major = major;
tty->refcount = 0;
/*
* Set up mutex semaphores
@@ -922,6 +923,8 @@ rtems_termios_dequeue_characters (void *ttyp, int len)
if (tty->rawOutBufState == rob_wait)
rtems_semaphore_release (tty->rawOutBufSemaphore);
if ( tty->rawOutBufHead == tty->rawOutBufTail )
return;
newTail = (tty->rawOutBufTail + len) % RAW_OUTPUT_BUFFER_SIZE;
if (newTail == tty->rawOutBufHead) {
/*

View File

@@ -219,6 +219,7 @@ rtems_termios_open (
tty->minor = minor;
tty->major = major;
tty->refcount = 0;
/*
* Set up mutex semaphores
@@ -922,6 +923,8 @@ rtems_termios_dequeue_characters (void *ttyp, int len)
if (tty->rawOutBufState == rob_wait)
rtems_semaphore_release (tty->rawOutBufSemaphore);
if ( tty->rawOutBufHead == tty->rawOutBufTail )
return;
newTail = (tty->rawOutBufTail + len) % RAW_OUTPUT_BUFFER_SIZE;
if (newTail == tty->rawOutBufHead) {
/*