URI: 
       tuse new thread library - plan9port - [fork] Plan 9 from user space
  HTML git clone git://src.adamsgaard.dk/plan9port
   DIR Log
   DIR Files
   DIR Refs
   DIR README
   DIR LICENSE
       ---
   DIR commit 9939daadf495628fbfcbc2d773983b1fb3d22a60
   DIR parent 8cd00113239c76acd0ce7c1ae90d26705a83cc80
  HTML Author: rsc <devnull@localhost>
       Date:   Mon, 27 Dec 2004 16:56:16 +0000
       
       use new thread library
       
       Diffstat:
         M src/cmd/9pserve.c                   |     154 +------------------------------
       
       1 file changed, 1 insertion(+), 153 deletions(-)
       ---
   DIR diff --git a/src/cmd/9pserve.c b/src/cmd/9pserve.c
       t@@ -189,7 +189,7 @@ mainproc(void *v)
                nn = write(1, vbuf, n);
                if(n != nn)
                        sysfatal("error writing Tversion: %r\n");
       -        n = threadread9pmsg(0, vbuf, sizeof vbuf);
       +        n = read9pmsg(0, vbuf, sizeof vbuf);
                if(convM2S(vbuf, n, &f) != n)
                        sysfatal("convM2S failure");
                if(f.msize < msize)
       t@@ -1150,157 +1150,6 @@ rewritehdr(Fcall *f, uchar *pkt)
                }
        }
        
       -#ifdef _LIBC_H_
       -/* unix select-based polling */
       -struct Ioproc
       -{
       -        Channel *c;
       -        Ioproc *next;
       -        int index;
       -};
       -
       -Ioproc*
       -ioproc(void)
       -{
       -        return (Ioproc*)-1;
       -}
       -
       -void
       -closeioproc(Ioproc *io)
       -{
       -}
       -
       -long
       -ioread(Ioproc *io, int fd, void *v, long n)
       -{
       -        USED(io);
       -
       -        return threadread(fd, v, n);
       -}
       -
       -long
       -ioreadn(Ioproc *io, int fd, void *v, long n)
       -{
       -        long tot, m;
       -        uchar *u;
       -
       -        u = v;
       -        for(tot=0; tot<n; tot+=m){
       -                m = ioread(io, fd, u+tot, n-tot);
       -                if(m <= 0){
       -                        if(tot)
       -                                break;
       -                        return m;
       -                }
       -        }
       -        return tot;
       -}
       -
       -int
       -iorecvfd(Ioproc *io, int fd)
       -{
       -        int r;
       -
       -        threadfdnoblock(fd);
       -        while((r=recvfd(fd)) < 0){
       -                if(errno == EINTR)
       -                        continue;
       -                if(errno == EWOULDBLOCK || errno == EAGAIN){
       -                        threadfdwait(fd, 'r');
       -                        continue;
       -                }
       -                break;
       -        }
       -        return r;
       -}
       -
       -int
       -iosendfd(Ioproc *io, int s, int fd)
       -{
       -        int r;
       -
       -        threadfdnoblock(s);
       -        while((r=sendfd(s, fd)) < 0){
       -                if(errno == EINTR)
       -                        continue;
       -                if(errno == EWOULDBLOCK || errno == EAGAIN){
       -                        threadfdwait(fd, 'w');
       -                        continue;
       -                }
       -                break;
       -        }
       -        return r;
       -}
       -
       -static long
       -_iowrite(Ioproc *io, int fd, void *v, long n)
       -{
       -        USED(io);
       -        return threadwrite(fd, v, n);
       -}
       -
       -long
       -iowrite(Ioproc *io, int fd, void *v, long n)
       -{
       -        long tot, m;
       -        uchar *u;
       -
       -        u = v;
       -        for(tot=0; tot<n; tot+=m){
       -                m = _iowrite(io, fd, u+tot, n-tot);
       -                if(m < 0){
       -                        if(tot)
       -                                break;
       -                        return m;
       -                }
       -        }
       -        return tot;
       -}
       -
       -int
       -iolisten(Ioproc *io, char *dir, char *ndir)
       -{
       -        int fd;
       -        int r;
       -        extern int _p9netfd(char*);
       -        USED(io);
       -
       -        if((fd = _p9netfd(dir)) < 0)
       -                return -1;
       -        threadfdnoblock(fd);
       -        while((r=listen(dir, ndir)) < 0){
       -                if(errno == EINTR)
       -                        continue;
       -                if(errno == EWOULDBLOCK || errno == EAGAIN){
       -                        threadfdwait(fd, 'r');
       -                        continue;
       -                }
       -                break;
       -        }
       -        return r;
       -}
       -
       -int
       -ioaccept(Ioproc *io, int fd, char *dir)
       -{
       -        int r;
       -        USED(io);
       -
       -        threadfdnoblock(fd);
       -        while((r=accept(fd, dir)) < 0){
       -                if(errno == EINTR)
       -                        continue;
       -                if(errno == EWOULDBLOCK || errno == EAGAIN){
       -                        threadfdwait(fd, 'r');
       -                        continue;
       -                }
       -                break;
       -        }
       -        return r;
       -}
       -
       -#else
       -/* real plan 9 io procs */
        static long
        _iolisten(va_list *arg)
        {
       t@@ -1333,4 +1182,3 @@ ioaccept(Ioproc *io, int fd, char *dir)
        {
                return iocall(io, _ioaccept, fd, dir);
        }
       -#endif