tdebugging for sam, and an old fix forgotten - plan9port - [fork] Plan 9 from user space
 (HTM) git clone git://src.adamsgaard.dk/plan9port
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit a19ff5b204a5e36ae522feb4acc0f31542b95f38
 (DIR) parent b80755cf2d7bfaed4c8120cbd9b874f799e65644
 (HTM) Author: rsc <devnull@localhost>
       Date:   Fri,  7 Jan 2005 18:03:36 +0000
       
       debugging for sam, and an old fix forgotten
       
       Diffstat:
         M bin/g                               |       2 +-
         M bin/slay                            |       2 +-
         M include/libc.h                      |       1 +
         M src/cmd/9term/rcstart.c             |       1 +
         M src/cmd/mkfile                      |       2 +-
         M src/cmd/samterm/io.c                |       9 ++++++++-
         M src/cmd/samterm/main.c              |      10 +++++++++-
         M src/cmd/samterm/plan9.c             |       2 +-
         M src/lib9/open.c                     |       4 ++++
         A src/libmach/SunOS.c                 |       0 
         M src/libmach/mkfile                  |       2 +-
       
       11 files changed, 28 insertions(+), 7 deletions(-)
       ---
 (DIR) diff --git a/bin/g b/bin/g
       t@@ -1,4 +1,4 @@
       -#!/usr/local/plan9/bin/rc
       +#!/mit/rsc/plan9/bin/rc
        
        flags=()
        while(! ~ $#* 1 && ~ $1 -*){
 (DIR) diff --git a/bin/slay b/bin/slay
       t@@ -1,3 +1,3 @@
        #!/bin/sh
        
       -exec /usr/local/plan9/bin/kill -9 "$@"
       +exec $PLAN9/bin/kill -9 "$@"
 (DIR) diff --git a/include/libc.h b/include/libc.h
       t@@ -590,6 +590,7 @@ extern        void                freenetconninfo(NetConnInfo*);
        #define        OCEXEC        32        /* or'ed in, close on exec */
        #define        ORCLOSE        64        /* or'ed in, remove on close */
        #define        ODIRECT        128        /* or'ed in, direct access */
       +#define ONONBLOCK 256        /* or'ed in, non-blocking call */
        #define        OEXCL        0x1000        /* or'ed in, exclusive use (create only) */
        #define        OLOCK        0x2000        /* or'ed in, lock after opening */
        
 (DIR) diff --git a/src/cmd/9term/rcstart.c b/src/cmd/9term/rcstart.c
       t@@ -24,6 +24,7 @@ sys(char *buf, int devnull)
                        _exit(2);
                default:
                        waitpid();
       +fprint(2, "done waiting\n");
                }
        }
        
 (DIR) diff --git a/src/cmd/mkfile b/src/cmd/mkfile
       t@@ -4,7 +4,7 @@ TARG=`ls *.[cy] | grep -v "\.tab\.c$" | sed 's/\.[cy]//'`
        
        <$PLAN9/src/mkmany
        
       -BUGGERED='CVS|faces|factotum|mailfs|page|scat|upas|venti|vncv|postscript|mnihongo|mpm|index'
       +BUGGERED='CVS|acid|db|faces|factotum|mailfs|page|scat|upas|venti|vncv|postscript|mnihongo|mpm|index'
        DIRS=lex `ls -l |sed -n 's/^d.* //p' |egrep -v "^($BUGGERED)$"|egrep -v '^lex$'`
        
        <$PLAN9/src/mkdirs
 (DIR) diff --git a/src/cmd/samterm/io.c b/src/cmd/samterm/io.c
       t@@ -33,20 +33,27 @@ void
        initio(void)
        {
                threadsetname("main");
       +        if(protodebug) print("mouse\n");
                mousectl = initmouse(nil, display->image);
                if(mousectl == nil){
                        fprint(2, "samterm: mouse init failed: %r\n");
                        threadexitsall("mouse");
                }
                mousep = &mousectl->m;
       +        if(protodebug) print("kbd\n");
                keyboardctl = initkeyboard(nil);
                if(keyboardctl == nil){
                        fprint(2, "samterm: keyboard init failed: %r\n");
                        threadexitsall("kbd");
                }
       +        if(protodebug) print("hoststart\n");
                hoststart();
       -        if(plumbstart() < 0)
       +        if(protodebug) print("plumbstart\n");
       +        if(plumbstart() < 0){
       +                if(protodebug) print("extstart\n");
                        extstart();
       +        }
       +        if(protodebug) print("initio done\n");
        }
        
        void
 (DIR) diff --git a/src/cmd/samterm/main.c b/src/cmd/samterm/main.c
       t@@ -44,15 +44,22 @@ threadmain(int argc, char *argv[])
                close(0);
                close(1);
                open("/dev/null", OREAD);
       -        dup(2, 1);
       +        if(open("/dev/tty", OWRITE) < 0)
       +                open("/dev/null", OWRITE);
       +dup(2, 1);
        
       +        if(protodebug) print("getscreen\n");
                getscreen(argc, argv);
       +        if(protodebug) print("iconinit\n");
                iconinit();
       +        if(protodebug) print("initio\n");
                initio();
       +        if(protodebug) print("scratch\n");
                scratch = alloc(100*RUNESIZE);
                nscralloc = 100;
                r = screen->r;
                r.max.y = r.min.y+Dy(r)/5;
       +        if(protodebug) print("flstart\n");
                flstart(screen->clipr);
                rinit(&cmd.rasp);
                flnew(&cmd.l[0], gettext, 1, &cmd);
       t@@ -64,6 +71,7 @@ threadmain(int argc, char *argv[])
                startnewfile(Tstartcmdfile, &cmd);
        
                got = 0;
       +        if(protodebug) print("loop\n");
                for(;;got = waitforio()){
                        if(hasunlocked && RESIZED())
                                resize();
 (DIR) diff --git a/src/cmd/samterm/plan9.c b/src/cmd/samterm/plan9.c
       t@@ -158,7 +158,7 @@ extstart(void)
                        }
                }
        
       -        fd = open(exname, OREAD|O_NONBLOCK);
       +        fd = open(exname, OREAD|ONONBLOCK);
                if(fd == -1){
                        removeextern();
                        return;
 (DIR) diff --git a/src/lib9/open.c b/src/lib9/open.c
       t@@ -28,6 +28,10 @@ p9open(char *name, int mode)
                        umode |= O_DIRECT;
                        mode ^= ODIRECT;
                }
       +        if(mode&ONONBLOCK){
       +                umode |= O_NONBLOCK;
       +                mode ^= ONONBLOCK;
       +        }
                if(mode){
                        werrstr("mode 0x%x not supported", mode);
                        return -1;
 (DIR) diff --git a/src/libmach/SunOS.c b/src/libmach/SunOS.c
 (DIR) diff --git a/src/libmach/mkfile b/src/libmach/mkfile
       t@@ -67,7 +67,7 @@ elfnm: elfnm.o $LIBDIR/$LIB
                $LD -o $target $prereq -l9
        
        
       -SunOS.$O: nosys.c
       +#SunOS.$O: nosys.c
        Darwin.$O: nosys.c
        OpenBSD.$O: nosys.c
        NetBSD.$O: nosys.c