I'm hacking on sshnet and have truncated it and ported it to linux, but it 
is not quite baked. One odd thing I've seen: I've truncated the last bit 
of it to this:

void
threadmain(int argc, char **argv)
{
        char *user, *service;
/*
        fmtinstall('B', mpfmt);
        fmtinstall('H', encodefmt);
*/
        service = nil;
        user = nil;
        ARGBEGIN{
        case 'B':       /* undocumented, debugging */
                doabort = 1;
                break;
        case 'D':       /* undocumented, debugging */
                debuglevel = strtol(EARGF(usage()), nil, 0);
                break;
        case '9':       /* undocumented, debugging */
                chatty9p++;
                break;
        case 's':
                service = EARGF(usage());
                break;
        default:
                usage();
        }ARGEND

        if(argc)
                usage();
//      sshmsgchan = chancreate(sizeof(Msg*), 16);
        fsreqchan = chancreate(sizeof(Req*), 0);
        fsreqwaitchan = chancreate(sizeof(void*), 0);
        fsclunkchan = chancreate(sizeof(Fid*), 0);
        fsclunkwaitchan = chancreate(sizeof(void*), 0);

        proccreate(fsnetproc, nil, 8192);

        threadpostmountsrv(&fs, service, nil, MREPL|MCREATE);
        fprint(2, "threadpostmountsrv RETURNS!~!!!!!!\n");
        threadexitsall(0);
}

If I run this program, the fsnetproc will get a SIGUSR1, but not long 
after, will get a SIGUSR2; in fact, it gets the SIGUSR2 after the first 
time the server sends it a send and the does a recv. If I do this:

.
.
.
        
        proccreate(fsnetproc, nil, 8192);
        
        threadpostmountsrv(&fs, service, nil, MREPL|MCREATE);
        fprint(2, "threadpostmountsrv RETURNS!~!!!!!!\n");
        while(1)
                yield();
        threadexitsall(0);
}


Then the program will run, just fine.

Any idea what I could have done to break things? I have also done this to 
fsnetproc:

void
fsnetproc(void*v)
{
        ulong path;
        Alt a[4];
        Fid *fid;
        Req *r;

        threadsetname("fsthread");

        a[0].op = CHANRCV;
        a[0].c = fsclunkchan;
        a[0].v = &fid;
        a[1].op = CHANRCV;
        a[1].c = fsreqchan;
        a[1].v = &r;
#ifdef NO
        a[2].op = CHANRCV;
        a[2].c = sshmsgchan;
        a[2].v = &m;
        a[3].op = CHANEND;
#endif

        for(;;){
.
.
.


So I don't think the unitialized sshmsgchan should be a problem. 

I'm actually more interested in this question: how do you go about 
debugging this sort of problem? What's your favorite way to see what's 
going on? strace is pretty good, but not perfect. Do you use acid, or ...

thanks

ron

Reply via email to