Gabriel Diaz wrote:
Hello
Using "normal" files is quite easy to do like ramfs does,
but if you write commands to a file that should be parsed,
you should choose when will your parser run, just
in the fswrite call? if you receive multiple writes, may be
you end with a split command and your parser returning error.
So you might need a state machine in the thing that handles write for
your ctl file.
If you're worried about conflicting writes from different writers, maybe
you can set the '1' attribute and then only one person gets to open it
and write to it?
We've had this problem in other circumstances (servers hanging off a TCP
line, integral commands not guaranteed) and it's pretty easy to handle
it. Also, take a look at, e.g., the TCL command interpreter -- same
exact problem: you get bits and pieces of a command, and you don't want
to fire until you get the whole thing. It's just a state machine approach.
ron