9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: "Benjamin Huntsman" <BHuntsman@mail2.cu-portland.edu>
To: "Fans of the OS Plan 9 from Bell Labs" <9fans@9fans.net>
Subject: [9fans]  porting sam
Date: Fri, 27 Mar 2009 08:20:47 -0700	[thread overview]
Message-ID: <621112A569DAE948AD25CCDCF1C075331AB498@dolly.ntdom.cupdx> (raw)
In-Reply-To: <1aaf8be900d3496cca5353a9aa49bd3c@coraid.com>

[-- Attachment #1: Type: text/plain, Size: 1870 bytes --]

I figure I'm not the only person on this list who would find a newer copy of sam for Windows useful...
I know there's acme-sac, but I still find myself using the 9pm version of sam for remote connections and such.

So, I've been working on and off trying to get sam from plan9port going on Windows.  Currently, I'm using the Inferno hosted environment to do the port.  That may or may not have been a good idea.  I'm now stuck at the function bootterm, in io.c.  Code below.  I'm stuck at the point where sam forks (or proc's) to launch samterm, since Windows provides neither.  emu uses Windows' CreateThread in it's kproc code.  I'm wondering what the best approach here would be, but in the style of some of the other ported Inferno tools, I'm leaning toward implementing the required functions in a "Nt.c" file and building it in.  Using libkern and a few other bits from draterm might work too...

Thanks!
-Ben


void
bootterm(char *machine, char **argv)
{
    int ph2t[2], pt2h[2];

    if(machine){
        dup(remotefd0, 0);
        dup(remotefd1, 1);
        close(remotefd0);
        close(remotefd1);
        argv[0] = "samterm";
        execvp(samterm, argv);
        fprint(2, "can't exec %s: %r\n", samterm);
        _exits("damn");
    }
    if(pipe(ph2t)==-1 || pipe(pt2h)==-1)
        panic("pipe");
    switch(fork()){
    case 0:
        dup(ph2t[0], 0);
        dup(pt2h[1], 1);
        close(ph2t[0]);
        close(ph2t[1]);
        close(pt2h[0]);
        close(pt2h[1]);
        argv[0] = "samterm";
        execvp(samterm, argv);
        fprint(2, "can't exec: ");
        perror(samterm);
        _exits("damn");
    case -1:
        panic("can't fork samterm");
    }
    dup(pt2h[0], 0);
    dup(ph2t[1], 1);
    close(ph2t[0]);
    close(ph2t[1]);
    close(pt2h[0]);
    close(pt2h[1]);
}


[-- Attachment #2: winmail.dat --]
[-- Type: application/ms-tnef, Size: 3424 bytes --]

  reply	other threads:[~2009-03-27 15:20 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-26 23:11 [9fans] another webfs question Mathieu
2009-03-27 12:04 ` erik quanstrom
2009-03-27 12:52   ` Devon H. O'Dell
2009-03-27 13:10     ` Mathieu Lonjaret
2009-03-27 13:52     ` erik quanstrom
2009-03-27 14:07       ` Devon H. O'Dell
2009-03-27 14:35         ` erik quanstrom
2009-03-27 15:20           ` Benjamin Huntsman [this message]
2009-03-29 16:22             ` [9fans] porting sam Skip Tavakkolian
2009-04-03 18:00 Michael Teichgräber

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=621112A569DAE948AD25CCDCF1C075331AB498@dolly.ntdom.cupdx \
    --to=bhuntsman@mail2.cu-portland.edu \
    --cc=9fans@9fans.net \
    /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).