tSmall tweaks to make things build again. - 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 f063dad96ec737db0ce213c4df32ecc600637881
 (DIR) parent 91c13e54b5d631b65e2f8344d5e0abd058f78ba1
 (HTM) Author: rsc <devnull@localhost>
       Date:   Sun, 29 Feb 2004 22:42:33 +0000
       
       Small tweaks to make things build again.
       
       Diffstat:
         M bin/B                               |      15 +++++++--------
         M src/cmd/9p.c                        |       5 +++--
         M src/cmd/9pserve.c                   |       2 +-
         M src/cmd/9term/mkfile                |       2 +-
         M src/cmd/dict/mkfile                 |       2 +-
         M src/cmd/diff/mkfile                 |       2 +-
         M src/cmd/hoc/mkfile                  |       2 +-
         M src/cmd/mk/mkfile                   |       2 +-
         M src/cmd/mkfile                      |       2 +-
         M src/cmd/plumb/fsys.c                |       6 +++---
         M src/cmd/plumb/match.c               |       4 ++--
         M src/cmd/plumb/mkfile                |       2 +-
         M src/cmd/plumb/plumb.c               |       5 +++--
         M src/cmd/plumb/plumber.c             |      30 ++++++++++++------------------
         M src/cmd/rc/mkfile                   |       2 +-
         M src/cmd/rc/syn.y                    |       2 +-
         M src/cmd/sam/mkfile                  |       2 +-
         M src/cmd/samterm/mkfile              |       4 ++--
       
       18 files changed, 43 insertions(+), 48 deletions(-)
       ---
 (DIR) diff --git a/bin/B b/bin/B
       t@@ -1,17 +1,14 @@
        #!/bin/sh
        
       +files=""
       +dest=""
       +
        if [ $# -eq 0 ]
        then
                echo 'usage: B file...' 2>&1
                exit 1
        fi
        
       -for i
       -do
       -        plumb $i
       -done
       -exit 0
       -
        if [ "x$DISPLAY" = "x" ]
        then
                sam="/tmp/.sam.$USER"
       t@@ -25,8 +22,10 @@ fi
        
        if [ ! -p $sam ]
        then
       -        echo could not find sam 2>&1
       -        exit 2
       +        for i
       +        do
       +                plumb -s B -d edit $i
       +        done
        else
                for i
                do
 (DIR) diff --git a/src/cmd/9p.c b/src/cmd/9p.c
       t@@ -2,6 +2,7 @@
        #include <libc.h>
        #include <fcall.h>
        #include <fs.h>
       +#include <thread.h>
        
        char *addr;
        
       t@@ -40,7 +41,7 @@ struct {
        };
        
        void
       -main(int argc, char **argv)
       +threadmain(int argc, char **argv)
        {
                char *cmd;
                int i;
       t@@ -60,7 +61,7 @@ main(int argc, char **argv)
                for(i=0; i<nelem(cmds); i++){
                        if(strcmp(cmds[i].s, cmd) == 0){
                                cmds[i].f(argc, argv);
       -                        exits(0);
       +                        threadexitsall(0);
                        }
                }
                usage();        
 (DIR) diff --git a/src/cmd/9pserve.c b/src/cmd/9pserve.c
       t@@ -750,7 +750,7 @@ inputthread(void *arg)
                                sendq(m->c->outq, m);
                }
                closeioproc(io);
       -        fprint(2, "input eof\n");
       +        //fprint(2, "input eof\n");
                threadexitsall(0);
        }
        
 (DIR) diff --git a/src/cmd/9term/mkfile b/src/cmd/9term/mkfile
       t@@ -9,5 +9,5 @@ OFILES=\
        
        <$PLAN9/src/mkone
        
       -LDFLAGS=-lframe -ldraw -lplumb -lfs -lmux -lthread -l9 -lfmt -lutf -L$X11/lib -lX11 -lutil
       +LDFLAGS=-lframe -ldraw -lplumb -lfs -lmux -lthread -l9 -L$X11/lib -lX11 -lutil
        
 (DIR) diff --git a/src/cmd/dict/mkfile b/src/cmd/dict/mkfile
       t@@ -11,7 +11,7 @@ OFILES=dict.$O\
        
        HFILES=dict.h kuten.h
        
       -LDFLAGS=$LDFLAGS -lbio -l9 -lregexp9 -lfmt -lutf
       +LDFLAGS=$LDFLAGS -lbio -lregexp9 -l9
        <$PLAN9/src/mkone
        
        mkindex: mkindex.$O $LFILES utils.$O
 (DIR) diff --git a/src/cmd/diff/mkfile b/src/cmd/diff/mkfile
       t@@ -12,4 +12,4 @@ HFILES=diff.h
        
        <$PLAN9/src/mkone
        
       -LDFLAGS=$LDFLAGS -lbio -l9 -lfmt -lutf
       +LDFLAGS=$LDFLAGS -lbio -l9
 (DIR) diff --git a/src/cmd/hoc/mkfile b/src/cmd/hoc/mkfile
       t@@ -17,4 +17,4 @@ YFILES=hoc.y\
        
        <$PLAN9/src/mkone
        
       -LDFLAGS=$LDFLAGS -lbio -l9 -lfmt -lutf
       +LDFLAGS=$LDFLAGS -lbio -l9
 (DIR) diff --git a/src/cmd/mk/mkfile b/src/cmd/mk/mkfile
       t@@ -31,7 +31,7 @@ HFILES=\
                mk.h\
                fns.h\
        
       -LDFLAGS=$LDFLAGS -lregexp9 -lbio -lfmt -lutf
       +LDFLAGS=$LDFLAGS -lregexp9 -lbio -l9
        
        <$PLAN9/src/mkone
        
 (DIR) diff --git a/src/cmd/mkfile b/src/cmd/mkfile
       t@@ -2,7 +2,7 @@ PLAN9=../..
        <$PLAN9/src/mkhdr
        
        TARG=`ls *.c | sed 's/\.c//'`
       -LDFLAGS=$LDFLAGS -lthread -lsec -lfs -lmux -lregexp9 -lbio -l9
       +LDFLAGS=$LDFLAGS -lsec -lfs -lmux -lregexp9 -lthread -lbio -l9
        
        <$PLAN9/src/mkmany
        
 (DIR) diff --git a/src/cmd/plumb/fsys.c b/src/cmd/plumb/fsys.c
       t@@ -195,7 +195,7 @@ startfsys(void)
                if(post9pservice(p[1], "plumb") < 0)
                        sysfatal("post9pservice plumb: %r");
                close(p[1]);
       -        proccreate(fsysproc, nil, Stack);
       +        threadcreate(fsysproc, nil, Stack);
        }
        
        static void
       t@@ -213,14 +213,14 @@ fsysproc(void *v)
                        if(buf == nil)
                                error("malloc failed: %r");
                        qlock(&readlock);
       -                n = read9pmsg(srvfd, buf, messagesize);
       +                n = threadread9pmsg(srvfd, buf, messagesize);
                        if(n <= 0){
                                if(n < 0)
                                        error("i/o error on server channel");
                                threadexitsall("unmounted");
                        }
                        if(readlock.head == nil)        /* no other processes waiting to read; start one */
       -                        proccreate(fsysproc, nil, Stack);
       +                        threadcreate(fsysproc, nil, Stack);
                        qunlock(&readlock);
                        if(t == nil)
                                t = emalloc(sizeof(Fcall));
 (DIR) diff --git a/src/cmd/plumb/match.c b/src/cmd/plumb/match.c
       t@@ -431,7 +431,7 @@ execproc(void *v)
                av = v;
                stackargv(av, args, argc);
                free(av);
       -        procexec(nil, fd, args[0], args);
       +        threadexec(nil, fd, args[0], args);
                threadexits("can't exec");
        }
        
       t@@ -458,6 +458,6 @@ Found:
                argv = buildargv(rs->act[i]->arg, e);
                if(argv[0] == nil)
                        return "empty argument list";
       -        proccreate(execproc, argv, EXECSTACK);
       +        threadcreate(execproc, argv, EXECSTACK);
                return nil;
        }
 (DIR) diff --git a/src/cmd/plumb/mkfile b/src/cmd/plumb/mkfile
       t@@ -14,4 +14,4 @@ $PLUMB:                $HFILES
        $O.plumb:        $PLUMB
        $O.plumber:        $PLUMBER
        
       -LDFLAGS=$LDFLAGS -lplumb -lfs -lmux -lthread -lregexp9 -l9 -lbio -lfmt -lutf
       +LDFLAGS=$LDFLAGS -lplumb -lfs -lmux -lthread -lregexp9 -lbio -l9
 (DIR) diff --git a/src/cmd/plumb/plumb.c b/src/cmd/plumb/plumb.c
       t@@ -1,6 +1,7 @@
        #include <u.h>
        #include <libc.h>
        #include <plumb.h>
       +#include <thread.h>
        
        char *plumbfile = nil;
        Plumbmsg m;
       t@@ -36,7 +37,7 @@ gather(void)
        }
        
        void
       -main(int argc, char *argv[])
       +threadmain(int argc, char *argv[])
        {
                char buf[1024], *p;
                int fd, i, input;
       t@@ -115,5 +116,5 @@ main(int argc, char *argv[])
                                exits("error");
                        }
                }
       -        exits(nil);
       +        threadexitsall(nil);
        }
 (DIR) diff --git a/src/cmd/plumb/plumber.c b/src/cmd/plumb/plumber.c
       t@@ -26,23 +26,10 @@ makeports(Ruleset *rules[])
        }
        
        void
       -mainproc(void *v)
       -{
       -        Channel *c;
       -
       -        c = v;
       -        printerrors = 0;
       -        makeports(rules);
       -        startfsys();
       -        sendp(c, nil);
       -}
       -
       -void
        threadmain(int argc, char *argv[])
        {
                char buf[512];
                int fd;
       -        Channel *c;
        
                progname = "plumber";
        
       t@@ -79,11 +66,18 @@ threadmain(int argc, char *argv[])
                 * Start all processes and threads from other proc
                 * so we (main pid) can return to user.
                 */
       -        c = chancreate(sizeof(void*), 0);
       -        proccreate(mainproc, c, 8192);
       -        recvp(c);
       -        chanfree(c);
       -        threadexits(nil);
       +        switch(fork()){
       +        case -1:
       +                sysfatal("fork: %r");
       +        case 0:
       +                break;
       +        default:
       +                _exit(0);
       +        }
       +
       +        printerrors = 0;
       +        makeports(rules);
       +        startfsys();
        }
        
        void
 (DIR) diff --git a/src/cmd/rc/mkfile b/src/cmd/rc/mkfile
       t@@ -31,7 +31,7 @@ HFILES=\
        
        YFILES=syn.y
        
       -LDFLAGS=$LDFLAGS -l9 -lfmt -lutf
       +LDFLAGS=$LDFLAGS -l9
        
        <$PLAN9/src/mkone
        
 (DIR) diff --git a/src/cmd/rc/syn.y b/src/cmd/rc/syn.y
       t@@ -7,7 +7,7 @@
        %left BANG SUBSHELL
        %left PIPE
        %left '^'
       -%right '$' COUNT '\"'
       +%right '$' COUNT '"'
        %left SUB
        %{
        #include "rc.h"
 (DIR) diff --git a/src/cmd/sam/mkfile b/src/cmd/sam/mkfile
       t@@ -28,6 +28,6 @@ HFILES=sam.h\
                errors.h\
                mesg.h\
        
       -LDFLAGS=$LDFLAGS -l9 -lfmt -lutf
       +LDFLAGS=$LDFLAGS -l9
        
        <$PLAN9/src/mkone
 (DIR) diff --git a/src/cmd/samterm/mkfile b/src/cmd/samterm/mkfile
       t@@ -22,8 +22,8 @@ HFILES=\
                $PLAN9/include/draw.h\
        
        CFLAGS=$CFLAGS -I../sam
       -LDFLAGS=$LDFLAGS -lframe -ldraw -lthread -l9 -lregexp9 \
       -        -lbio -lfmt -lutf -L$X11/lib -lX11 -lm
       +LDFLAGS=$LDFLAGS -lframe -ldraw -lthread -lregexp9 \
       +        -lbio -l9 -L$X11/lib -lX11 -lm
        
        o.samterm: $PLAN9/lib/libframe.a $PLAN9/lib/libdraw.a $PLAN9/lib/libthread.a