diff options
author | rsc <devnull@localhost> | 2006-06-12 17:20:42 +0000 |
---|---|---|
committer | rsc <devnull@localhost> | 2006-06-12 17:20:42 +0000 |
commit | d93cc14ecee8fbb0dc0fc746713aba7ee0979c4c (patch) | |
tree | 89da477c14aaea49d410be0422d48d9848083af4 /src/libthread | |
parent | 00c6cee80a371a38984a44945df40c4136173e81 (diff) | |
download | plan9port-d93cc14ecee8fbb0dc0fc746713aba7ee0979c4c.tar.gz plan9port-d93cc14ecee8fbb0dc0fc746713aba7ee0979c4c.tar.bz2 plan9port-d93cc14ecee8fbb0dc0fc746713aba7ee0979c4c.zip |
fix proc leak; add p9usepwlibrary
Diffstat (limited to 'src/libthread')
-rw-r--r-- | src/libthread/Linux.c | 2 | ||||
-rw-r--r-- | src/libthread/thread.c | 9 |
2 files changed, 9 insertions, 2 deletions
diff --git a/src/libthread/Linux.c b/src/libthread/Linux.c index 683ddd12..17e8c12b 100644 --- a/src/libthread/Linux.c +++ b/src/libthread/Linux.c @@ -378,7 +378,7 @@ myperproc(void) break; } } - fprint(2, "myperproc %d: cannot find self\n", pid); + fprint(2, "myperproc %d (%s): cannot find self\n", pid, argv0); abort(); return nil; } diff --git a/src/libthread/thread.c b/src/libthread/thread.c index ff748acc..acd56fa2 100644 --- a/src/libthread/thread.c +++ b/src/libthread/thread.c @@ -39,6 +39,11 @@ _threaddebug(char *fmt, ...) snprint(buf, sizeof buf, "/tmp/%s.tlog", p); if((fd = create(buf, OWRITE, 0666)) < 0) fd = open("/dev/null", OWRITE); + if(fd >= 0 && fd != 2){ + dup(fd, 2); + close(fd); + fd = 2; + } } va_start(arg, fmt); @@ -331,6 +336,7 @@ Out: threadexitsall(p->msg); unlock(&threadnproclock); unlock(&p->lock); + _threadsetproc(nil); free(p); } @@ -599,7 +605,7 @@ threadrwakeup(Rendez *r, int all, ulong pc) static int threadargc; static char **threadargv; int mainstacksize; - +extern int _p9usepwlibrary; /* getgrgid etc. smash the stack - tell _p9dir just say no */ static void threadmainstart(void *v) { @@ -613,6 +619,7 @@ threadmainstart(void *v) * This means the pthread implementation is not suitable for * running under libthread. Time to write your own. Sorry. */ + _p9usepwlibrary = 0; threadmainproc = proc(); threadmain(threadargc, threadargv); } |