summaryrefslogtreecommitdiffstats
path: root/c
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2005-08-19 16:19:48 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2005-08-19 16:19:48 +0000
commite7d06758120d8753bb1b46be9461a4a247a28af8 (patch)
tree17b435691468f23c27134c9a275fefdc4b1282ae /c
parent2005-08-18 Karel Gardas <kgardas@objectsecurity.com> (diff)
downloadrtems-e7d06758120d8753bb1b46be9461a4a247a28af8.tar.bz2
2005-08-19 Cedric Aubert <cedric_aubert@yahoo.fr>
PR 577/bsps * console.c: The console_close() method currently calls StopRemoteTx() on all invocations. It should should be ok for last close only but not for any others. If you open a port multiple times, you only want to call StopRemoteTx() only as part of the last close.
Diffstat (limited to 'c')
-rw-r--r--c/src/lib/libbsp/shared/ChangeLog8
-rw-r--r--c/src/lib/libbsp/shared/console.c13
2 files changed, 17 insertions, 4 deletions
diff --git a/c/src/lib/libbsp/shared/ChangeLog b/c/src/lib/libbsp/shared/ChangeLog
index 3218f4b7db..b79628c8c1 100644
--- a/c/src/lib/libbsp/shared/ChangeLog
+++ b/c/src/lib/libbsp/shared/ChangeLog
@@ -1,3 +1,11 @@
+2005-08-19 Cedric Aubert <cedric_aubert@yahoo.fr>
+
+ PR 577/bsps
+ * console.c: The console_close() method currently calls StopRemoteTx()
+ on all invocations. It should should be ok for last close only but
+ not for any others. If you open a port multiple times, you only want
+ to call StopRemoteTx() only as part of the last close.
+
2005-04-15 Jennifer Averett <jennifer.averett@oarcorp.com>
PR 779/bsp
diff --git a/c/src/lib/libbsp/shared/console.c b/c/src/lib/libbsp/shared/console.c
index c897544a79..e294fc1714 100644
--- a/c/src/lib/libbsp/shared/console.c
+++ b/c/src/lib/libbsp/shared/console.c
@@ -128,10 +128,15 @@ rtems_device_driver console_close(
{
rtems_libio_open_close_args_t *args = arg;
- if ( (args->iop->flags&LIBIO_FLAGS_READ) &&
- Console_Port_Tbl[minor].pDeviceFlow &&
- Console_Port_Tbl[minor].pDeviceFlow->deviceStopRemoteTx) {
- Console_Port_Tbl[minor].pDeviceFlow->deviceStopRemoteTx(minor);
+ /* Get the tty refcount to determine if we need to do deviceStopRemoteTx.
+ * Stop only if it's the last one opened.
+ */
+ if ( (current_tty->refcount == 1) ) {
+ if ( (args->iop->flags&LIBIO_FLAGS_READ) &&
+ Console_Port_Tbl[minor].pDeviceFlow &&
+ Console_Port_Tbl[minor].pDeviceFlow->deviceStopRemoteTx) {
+ Console_Port_Tbl[minor].pDeviceFlow->deviceStopRemoteTx(minor);
+ }
}
return rtems_termios_close (arg);