aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrsc <devnull@localhost>2005-01-06 23:07:19 +0000
committerrsc <devnull@localhost>2005-01-06 23:07:19 +0000
commitaf89fc108d61625959704a08ffdd44adfd86a9d4 (patch)
treeecb052f025f0a0724231b70f2ecc8fa2aa82eec2
parent9b4de09d413c43059afcd75ceba4d2adcdc0a0a8 (diff)
downloadplan9port-af89fc108d61625959704a08ffdd44adfd86a9d4.tar.gz
plan9port-af89fc108d61625959704a08ffdd44adfd86a9d4.tar.bz2
plan9port-af89fc108d61625959704a08ffdd44adfd86a9d4.zip
more debugging
-rw-r--r--src/libthread/ioproc.c2
-rw-r--r--src/libthread/iorw.c3
-rw-r--r--src/libthread/thread.c20
3 files changed, 19 insertions, 6 deletions
diff --git a/src/libthread/ioproc.c b/src/libthread/ioproc.c
index 0bf79468..30b031c7 100644
--- a/src/libthread/ioproc.c
+++ b/src/libthread/ioproc.c
@@ -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
diff --git a/src/libthread/iorw.c b/src/libthread/iorw.c
index 2ad80878..ce86d146 100644
--- a/src/libthread/iorw.c
+++ b/src/libthread/iorw.c
@@ -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
diff --git a/src/libthread/thread.c b/src/libthread/thread.c
index 1894259b..ee73f752 100644
--- a/src/libthread/thread.c
+++ b/src/libthread/thread.c
@@ -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*