9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: Russ Cox <rsc@swtch.com>
To: 9fans <9fans@cse.psu.edu>
Subject: [9fans] vnc-like cpu service
Date: Thu, 13 Oct 2005 11:11:26 -0400	[thread overview]
Message-ID: <ee9e417a0510130811w7377c13al9d21c5025ca1342b@mail.gmail.com> (raw)

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


             reply	other threads:[~2005-10-13 15:11 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-13 15:11 Russ Cox [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ee9e417a0510130811w7377c13al9d21c5025ca1342b@mail.gmail.com \
    --to=rsc@swtch.com \
    --cc=9fans@cse.psu.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).