EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  <20152016  2017  2018  2019  2020  2021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  <20152016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: epicsExit (); function exits the IOC but the Linux console requires a resest to be operative
From: Andrew Johnson <[email protected]>
To: <[email protected]>
Date: Tue, 30 Jun 2015 13:55:01 -0500
Hi again,

On 06/30/2015 01:25 PM, Andrew Johnson wrote:
> I can think of a few ways around the problem, at least one of which we
> ought to implement, but it would be simplest for you to start the IOC
> from a script which runs 'stty sane' immediately after the IOC exits.
> That command should be sufficient and is a little less severe than a
> full terminal reset.

Or you could apply this patch to base...

- Andrew

-- 
Light thinks it travels faster than anything but it is wrong.
No matter how fast light travels, it finds the darkness has
always got there first, and is waiting for it.
    -- Terry Pratchett, Reaper Man
=== modified file 'src/libCom/osi/os/default/epicsReadline.c'
--- src/libCom/osi/os/default/epicsReadline.c	2012-08-31 21:05:14 +0000
+++ src/libCom/osi/os/default/epicsReadline.c	2015-06-30 18:48:04 +0000
@@ -14,6 +14,7 @@
 
 #define epicsExportSharedSymbols
 #include "envDefs.h"
+#include "epicsExit.h"
 #include "epicsReadline.h"
 
 #define EPICS_COMMANDLINE_LIBRARY_EPICS     0
@@ -84,6 +85,14 @@
     char    *line;
 };
 
+static enum {rlNone, rlIdle, rlBusy} rlState = rlNone;
+
+static void rlExit(void *dummy) {
+    if (rlState == rlBusy)
+        rl_cleanup_after_signal();
+}
+
+
 /*
  * Create a command-line context
  */
@@ -92,6 +101,11 @@
 {
     struct readlineContext *readlineContext;
 
+    if (rlState == rlNone) {
+        epicsAtExit(rlExit, NULL);
+        rlState = rlIdle;
+    }
+
     readlineContext = malloc(sizeof *readlineContext);
     if (readlineContext != NULL) {
         readlineContext->in = in;
@@ -124,7 +138,9 @@
     free (readlineContext->line);
     readlineContext->line = NULL;
     if (readlineContext->in == NULL) {
+        rlState = rlBusy;
         line = readline (prompt);
+        rlState = rlIdle;
     }
     else {
         line = (char *)malloc (linesize * sizeof *line);


Replies:
Re: epicsExit (); function exits the IOC but the Linux console requires a resest to be operative Diego Sanz
References:
epicsExit (); function exits the IOC but the Linux console requires a resest to be operative Diego Sanz
Re: epicsExit (); function exits the IOC but the Linux console requires a resest to be operative Andrew Johnson

Navigate by Date:
Prev: Re: epicsExit (); function exits the IOC but the Linux console requires a resest to be operative Andrew Johnson
Next: Re: epicsExit (); function exits the IOC but the Linux console requires a resest to be operative Diego Sanz
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  <20152016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Re: epicsExit (); function exits the IOC but the Linux console requires a resest to be operative Andrew Johnson
Next: Re: epicsExit (); function exits the IOC but the Linux console requires a resest to be operative Diego Sanz
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  <20152016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 16 Dec 2015 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·