Experimental Physics and Industrial Control System
|
Hi Torsten,
On 18/06/2014 08:43, Torsten Bögershausen wrote:
thats
sounds too interesting to keep quiet.
;-)
What, more specific, do you want to do ?
Read a specific file line-by-line ?
Yes. Why not.
Do you need all the lines, or only a specifc one ?
Yes. Possibly both.
Do you want to read the file multiple times ?
Yes. Or maybe not?
In this case you could write a little daemon,
[...]
I could, but I don't want to...
Do you want to share more details ?
Sure.
My specific use case is reading statistics data from a file in the
/proc file system, using StreamDevice to pull the numbers out.
But, obviously, I want to have something that is more versatile,
maybe to an extent that it's worth adding it to the ASYN package.
So, I am thinking along the following lines.
st.cmd:
# drvAsynReadFilePortConfigure port fileName priority
Autoconnect noProcessEos
drvAsynReadFilePortConfigure("mem","/proc/meminfo",0,1,0)
connect/disconnect = open/close
statsfile.proto:
freshD { out "o\$1"; in "%*s%d" }
Control through writing:
g = goto line
o = reopen and goto line
line numbers: 0 = don't move (next line), negative = from the
end of the file
database:
record (longin, "memFree") {
field(DTYP, "stream")
field(INP, "@statsfile.proto freshD(2) mem")
}
Other applications could include refreshing the last n lines of some
(log) file into a char array, or ......
Windows/Linux line endings would be handled through EOS processing,
interpose layers could do interesting things.
An similar (slightly simpler) drvAsynWriteFilePort could allow
writing to a file (overwriting or appending).
File IO is something that is traditionally hard to do on an IOC -
this approach might provide an easy way for many use cases.
What do you think?
~Ralph
|
- Replies:
- Re: ASYN port driver for file IO? Benjamin Franksen
- References:
- ASYN port driver for file IO? Ralph Lange
- Re: ASYN port driver for file IO? Torsten Bögershausen
- Navigate by Date:
- Prev:
Re: ASYN port driver for file IO? Torsten Bögershausen
- Next:
Re: ASYN port driver for file IO? Benjamin Franksen
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
<2014>
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
- Navigate by Thread:
- Prev:
Re: ASYN port driver for file IO? Torsten Bögershausen
- Next:
Re: ASYN port driver for file IO? Benjamin Franksen
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
<2014>
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
|
ANJ, 17 Dec 2015 |
·
Home
·
News
·
About
·
Base
·
Modules
·
Extensions
·
Distributions
·
Download
·
·
Search
·
EPICS V4
·
IRMIS
·
Talk
·
Bugs
·
Documents
·
Links
·
Licensing
·
|