7 Jun 2006 13:31
Re: Inferno as network window system
> Originally I thought of some sort of server on the linux box which when
> connected to from inferno passed commands to the inferno window manger
> dsiplaying the pretty results..But now that I think about it a styx
> server on top of the hardware makes more sense in this case. Is this
> easy to do under Linux with C?? any examples???
if you can use the p9p port under your embedded linux, then you'd be able to
do things in a fairly clean way. what you want to do is quite straightforward,
especially if you provide a polling, rather than a blocking interface.
write the core of the code so it reads 9p messages on its
standard input and writes replies on its standard output.
that way another program can connect it to whatever export
mechanism you decide on (like the shell connects commands in a pipe).
you can use libp9 (see 9p(2)) if you think that makes things easier
(the end of the man page also has a list of a few nice example
servers).
start off by reading intro(5) (intro(9) in p9p). the protocol is really very simple.
the only difficulties come from flush, and if you're not blocking,
then there's not an issue there.
essentially all you have to do is:
read a message
do some appropriate action
reply accordingly
for all incoming messages.
section 5 of the manual tells you what's expected of each message.
it's not hard, particularly when you've got a fixed directory structure.
the most important bit is deciding on an appropriate interface.
i always start by asking myself "how would i *like* to be able
to interact with this service?"
look at sections 3 and 4 of the plan 9 and inferno manuals for
ideas of how to structure the namespace. there are various
"design patterns" (e.g. the clone file) which make a lot of sense
and are worth following if you feel they're appropriate.
cheers,
rog.
RSS Feed