| Date: Thu, 6 Jan 2005 23:07:19 +0000
more debugging
Diffstat:
M src/libthread/ioproc.c | 2 +-
M src/libthread/iorw.c | 3 ++-
M src/libthread/thread.c | 20 ++++++++++++++++----
3 files changed, 19 insertions(+), 6 deletions(-)
--- |
| t@@ -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 |
| t@@ -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 |
| t@@ -23,17 +23,29 @@ _threaddebug(char *fmt, ...)
va_list arg;
char buf[128];
_Thread *t;
-
- return;
+ char *p;
+ static int fd = -1;
+
+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* |