From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: Date: Thu, 13 Oct 2005 11:11:26 -0400 From: Russ Cox To: 9fans <9fans@cse.psu.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Subject: [9fans] vnc-like cpu service Topicbox-Message-UUID: 9a24b490-ead0-11e9-9d60-3106f5b1d025 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 =3D accept(); fd =3D cpuprotocol(fd); unmount("/mnt/term"); mount(fd, "/mnt/term"); fd =3D 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