sync with plan 9

This commit is contained in:
rsc 2007-04-21 19:43:09 +00:00
parent 35a80291f7
commit 6ce75e8dc0
5 changed files with 9 additions and 20 deletions

View file

@ -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
@ -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;
}

View file

@ -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;
}

View file

@ -1,5 +1,7 @@
#include <u.h>
#ifdef PLAN9PORT
#include <sys/socket.h>
#endif
#include <libc.h>
#include <venti.h>
#include "queue.h"
@ -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)

View file

@ -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){

View file

@ -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
@ -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;
}
@ -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;
@ -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);
@ -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;
@ -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);
@ -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);
@ -1009,7 +1001,7 @@ memtail(Mem *m, uchar *wp, int n)
return 0;
}
#if 0
#ifdef NOTDEF
static void
checkpacket(Packet *p)
{