tsync with plan 9 - 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 6ce75e8dc072178f410db9a6ae7d70a5101e640c
 (DIR) parent 35a80291f7c4efbb34e784528682ef02bce09d72
 (HTM) Author: rsc <devnull@localhost>
       Date:   Sat, 21 Apr 2007 19:43:09 +0000
       
       sync with plan 9
       
       Diffstat:
         M src/libventi/cache.c                |       8 +-------
         M src/libventi/file.c                 |       2 +-
         M src/libventi/hangup.c               |       6 +++++-
         M src/libventi/log.c                  |       1 -
         M src/libventi/packet.c               |      12 ++----------
       
       5 files changed, 9 insertions(+), 20 deletions(-)
       ---
 (DIR) diff --git a/src/libventi/cache.c b/src/libventi/cache.c
       t@@ -158,20 +158,14 @@ cachecheck(VtCache *c)
                        else if(b->addr != NilBlock)
                                refed++;
                }
       -if(c->nheap + refed != c->nblock){
       -fprint(2, "cachecheck: nheap %d refed %d nblocks %d\n", c->nheap, refed, c->nblock);
       -/*vtcachedump(c); */
       -}
                assert(c->nheap + refed == c->nblock);
                refed = 0;
                for(i = 0; i < c->nblock; i++){
                        b = &c->block[i];
                        if(b->ref){
       -if(1)fprint(2, "a=%ud %V ref=%d pc=%#lux\n", b->addr, b->score, b->ref, (ulong)b->pc);
                                refed++;
                        }
                }
       -if(refed > 0)fprint(2, "cachecheck: in used %d\n", refed);
        }
        
        static int
       t@@ -353,7 +347,7 @@ vtcacheallocblock(VtCache *c, int type)
        
                qlock(&b->lk);
                b->nlock = 1;
       -        b->pc = getcallerpc(&b);
       +        b->pc = getcallerpc(&c);
                return b;
        }
        
 (DIR) diff --git a/src/libventi/file.c b/src/libventi/file.c
       t@@ -1041,7 +1041,7 @@ filewrite1(VtFile *f, void *data, long count, vlong offset)
        
                vtfilegetentry(f, &e);
                if(count < 0 || offset < 0){
       -                werrstr("bad offset or count");
       +                werrstr("vtfilewrite: bad offset or count");
                        return -1;
                }
        
 (DIR) diff --git a/src/libventi/hangup.c b/src/libventi/hangup.c
       t@@ -1,5 +1,7 @@
        #include <u.h>
       +#ifdef PLAN9PORT
        #include <sys/socket.h>
       +#endif
        #include <libc.h>
        #include <venti.h>
        #include "queue.h"
       t@@ -9,9 +11,11 @@ vthangup(VtConn *z)
        {
                qlock(&z->lk);
                z->state = VtStateClosed;
       -        /* try to make the read in vtsendproc fail */
       +#ifdef PLAN9PORT
       +        /* try to make the read in vtrecvproc fail */
                shutdown(SHUT_WR, z->infd);
                shutdown(SHUT_WR, z->outfd);
       +#endif
                if(z->infd >= 0)
                        close(z->infd);
                if(z->outfd >= 0 && z->outfd != z->infd)
 (DIR) diff --git a/src/libventi/log.c b/src/libventi/log.c
       t@@ -50,7 +50,6 @@ vtlognames(int *pn)
                a = (char*)(s+nname);
                e = (char*)s+nname*sizeof(char*)+size;
        
       -        size = 0;
                nname = 0;
                for(i=0; i<nelem(vl.hash); i++)
                for(l=vl.hash[i]; l; l=l->next){
 (DIR) diff --git a/src/libventi/packet.c b/src/libventi/packet.c
       t@@ -75,7 +75,7 @@ static char EPacketSize[] = "bad packet size";
        static char EPacketOffset[] = "bad packet offset";
        static char EBadSize[] = "bad size";
        
       -#if 0
       +#ifdef NOTDEF
        static void checkpacket(Packet*);
        #endif
        
       t@@ -126,8 +126,6 @@ packetalloc(void)
                p->next = nil;
                p->pc = getcallerpc((char*)&p+8);        /* might not work, but fine */
        
       -/*if(0)fprint(2, "packetalloc %p from %08lux %08lux %08lux\n", p, *((uint*)&p+2), *((uint*)&p+3), *((uint*)&p+4)); */
       -
                NOTFREE(p);
                return p;
        }
       t@@ -137,8 +135,6 @@ packetfree(Packet *p)
        {
                Frag *f, *ff;
        
       -/*if(1)fprint(2, "packetfree %p from %08lux\n", p, getcallerpc(&p)); */
       -
                if(p == nil)
                        return;
        
       t@@ -216,7 +212,6 @@ packetsplit(Packet *p, int n)
                Packet *pp;
                Frag *f, *ff;
        
       -        if(0) fprint(2, "packetsplit %p %d\n", p, n);
                NOTFREE(p);
                if(n < 0 || n > p->size) {
                        werrstr(EPacketSize);
       t@@ -265,7 +260,6 @@ packetsplit(Packet *p, int n)
        int
        packetconsume(Packet *p, uchar *buf, int n)
        {
       -        if(0) fprint(2, "packetconsume %p %d\n", p, n);
                NOTFREE(p);
                if(buf && packetcopy(p, buf, 0, n) < 0)
                        return -1;
       t@@ -277,7 +271,6 @@ packettrim(Packet *p, int offset, int n)
        {
                Frag *f, *ff;
        
       -        if(0) fprint(2, "packettrim %p %d %d\n", p, offset, n);
                NOTFREE(p);
                if(offset < 0 || offset > p->size) {
                        werrstr(EPacketOffset);
       t@@ -377,7 +370,6 @@ packettrailer(Packet *p, int n)
                Mem *m;
                Frag *f;
        
       -        if(0) fprint(2, "packettrailer %p %d\n", p, n);
                NOTFREE(p);
                if(n <= 0 || n > MaxFragSize) {
                        werrstr(EPacketSize);
       t@@ -1009,7 +1001,7 @@ memtail(Mem *m, uchar *wp, int n)
                return 0;
        }
        
       -#if 0
       +#ifdef NOTDEF
        static void
        checkpacket(Packet *p)
        {