9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] vnc-like cpu service
@ 2005-10-13 15:11 Russ Cox
  2005-10-13 15:40 ` andrey mirtchovski
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Russ Cox @ 2005-10-13 15:11 UTC (permalink / raw)
  To: 9fans

If anyone is looking for an interesting project, here's a simple
way to get a vnc-like cpu service for Plan 9.  This would let you
drawterm in to a session, then later drawterm in from somewhere
else and get the same rio workspace.  (The first session would
disconnect at that point if it hadn't already.)  It's like VNC, but
you get to keep /mnt/term.

The hard part is to write a file server aux/redraw, which mounts
itself on /dev and serves the usual console-related files:
/dev/cons, /dev/consctl, /dev/mouse, and /dev/draw.
These get redirected to the corresponding files in /mnt/term/dev,
but redraw snoops on the draw state, keeping a copy tucked away.
If you write "refresh" to /dev/consctl, redraw reopens all the
/mnt/term files and reestablishes the /dev/draw state in
/mnt/term/dev/draw.

Then the vnc-like cpu service just runs a loop like this:

    system("aux/redraw");
    announce();
    for(;;){
        fd = accept();
        fd = cpuprotocol(fd);
        unmount("/mnt/term");
        mount(fd, "/mnt/term");
        fd = open("/dev/consctl");
        write(fd, "refresh", 7);
        close(fd);
    }

The draw protocol is completely detailed in draw(3) and one
could certainly adapt devdraw.c as first cut at aux/redraw.

Any takers?
Russ


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2005-10-15  2:07 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-10-13 15:11 [9fans] vnc-like cpu service Russ Cox
2005-10-13 15:40 ` andrey mirtchovski
2005-10-13 18:52 ` rog
2005-10-14 23:05 ` McLone
2005-10-15  2:07   ` Russ Cox

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).