more debugging

This commit is contained in:
rsc 2005-01-06 23:07:19 +00:00
parent 9b4de09d41
commit af89fc108d
3 changed files with 18 additions and 5 deletions

View file

@ -13,7 +13,7 @@ iointerrupt(Ioproc *io)
{
if(!io->inuse)
return;
fprint(2, "bug: cannot iointerrupt yet\n");
fprint(2, "bug: cannot iointerrupt %p yet\n", io);
}
static void

View file

@ -123,7 +123,8 @@ _iowrite(va_list *arg)
long
iowrite(Ioproc *io, int fd, void *a, long n)
{
return iocall(io, _iowrite, fd, a, n);
n = iocall(io, _iowrite, fd, a, n);
return n;
}
static long

View file

@ -23,17 +23,29 @@ _threaddebug(char *fmt, ...)
va_list arg;
char buf[128];
_Thread *t;
char *p;
static int fd = -1;
return;
return;
if(fd < 0){
p = strrchr(argv0, '/');
if(p)
p++;
else
p = argv0;
snprint(buf, sizeof buf, "/tmp/%s.tlog", p);
if((fd = create(buf, OWRITE, 0666)) < 0)
fd = open("/dev/null", OWRITE);
}
va_start(arg, fmt);
vsnprint(buf, sizeof buf, fmt, arg);
va_end(arg);
t = proc()->thread;
if(t)
fprint(2, "%d.%d: %s\n", getpid(), t->id, buf);
fprint(fd, "%d.%d: %s\n", getpid(), t->id, buf);
else
fprint(2, "%d._: %s\n", getpid(), buf);
fprint(fd, "%d._: %s\n", getpid(), buf);
}
static _Thread*