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  <20082009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  <20082009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: RE: stdout being changed in EPICS
From: "Mark Rivers" <[email protected]>
To: "EPICS tech-talk" <[email protected]>
Date: Thu, 17 Jul 2008 08:31:04 -0500

I’ve done some more investigation of this.  It appears that stdout is being closed and re-opened when the vxWorks startup script completes.  Does anyone know if this is true?  If so, I don’t understand why.  I can understand why stdin may be reopened, changing from the startup script to the console.  But why stdout?  Is there a way to open a file descriptor to the console that will not be closed and re-opened when the startup script completes?

 

Thanks,

Mark

 

 


From: Mark Rivers
Sent: Wednesday, July 16, 2008 7:07 PM
To: EPICS tech-talk
Subject: stdout being changed in EPICS

 

Folks,

 

I have run into a problem with the value of stdout being changed some time after iocInit is called.  This is happening at least on vxWorks, I have not checked other platforms.

 

This is a real problem, because I have a vendor library that assigns a file descriptor to the value of stdout before iocInit is run, and then does fprintf() to that file descriptor for logging purposes.  This works fine until just after iocInit is called, at which point that file descriptor is invalid (fprintf returns an error), and the value of stdout has changed to a new value.

 

One can easily reproduce this problem with the example application that EPICS base generates.  I just added this small global function show_stdout() to the end of devXxxSoft.c

 

corvette> tail devXxxSoft.c

    /*If return was succesful then set undefined false*/

    if(!status) pxxx->udf = FALSE;

    return(0);

}

 

int show_stdout()

{

    printf("stdout=%p\n", stdout);

    return(0);

}

 

Here is what I see at the end of the st.cmd file, to which I added calls to show_stdout just before and after iocInit:

 

****************************************************************************************************

show_stdout

stdout=0x1d0e290

value = 0 = 0x0

iocInit()

Starting iocInit

############################################################################

###  EPICS IOC CORE built on Jun  9 2008

###  EPICS R3.14.8.2 $R3-14-8-2$ $2006/01/06 15:55:13$

############################################################################

iocInit: All initialization complete

value = 0 = 0x0

show_stdout

stdout=0x1d0e290

value = 0 = 0x0

 

## Start any sequence programs

seq &sncExample,"user=epics"

SEQ Version 2.0.11: Mon Jun  9 16:03:45 2008

Spawning state program "sncExample", thread 0x1c2e7c0: "sncExample"

value = 29550528 = 0x1c2e7c0

 

Done executing startup script /home/epics/devel/example/iocBoot/iocexample/st.cmd

iocexample> show_stdout

stdout=0x1ffe738

value = 0 = 0x0

 

******************************************************************************************

 

Note that the value of stdout is 0x1d0e290 before the call to iocInit, and just after iocInit returns.  However, the value has changed to 0x1ffe738 when I type the show_stdout command manually a few seconds after I get the vxWorks prompt.  This happens whether or not the SNL program is run (comment out the seq call).

 

Does anyone know why the value of stdout is changing?  It is a real problem for software that uses the value of stdout through a call to iocInit.

 

Thanks,

Mark

 

 


Replies:
Re: stdout being changed in EPICS J. Lewis Muir
References:
stdout being changed in EPICS Mark Rivers

Navigate by Date:
Prev: RE: EPICS-Problem Dalesio, Leo
Next: VXI resource manger converted to R3.14? Nicholas P. DiMonte
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  <20082009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: stdout being changed in EPICS Mark Rivers
Next: Re: stdout being changed in EPICS J. Lewis Muir
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  <20082009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 02 Sep 2010 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·