fix proc leak; add p9usepwlibrary
This commit is contained in:
parent
00c6cee80a
commit
d93cc14ece
2 changed files with 9 additions and 2 deletions
|
|
@ -378,7 +378,7 @@ myperproc(void)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fprint(2, "myperproc %d: cannot find self\n", pid);
|
fprint(2, "myperproc %d (%s): cannot find self\n", pid, argv0);
|
||||||
abort();
|
abort();
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,11 @@ _threaddebug(char *fmt, ...)
|
||||||
snprint(buf, sizeof buf, "/tmp/%s.tlog", p);
|
snprint(buf, sizeof buf, "/tmp/%s.tlog", p);
|
||||||
if((fd = create(buf, OWRITE, 0666)) < 0)
|
if((fd = create(buf, OWRITE, 0666)) < 0)
|
||||||
fd = open("/dev/null", OWRITE);
|
fd = open("/dev/null", OWRITE);
|
||||||
|
if(fd >= 0 && fd != 2){
|
||||||
|
dup(fd, 2);
|
||||||
|
close(fd);
|
||||||
|
fd = 2;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
va_start(arg, fmt);
|
va_start(arg, fmt);
|
||||||
|
|
@ -331,6 +336,7 @@ Out:
|
||||||
threadexitsall(p->msg);
|
threadexitsall(p->msg);
|
||||||
unlock(&threadnproclock);
|
unlock(&threadnproclock);
|
||||||
unlock(&p->lock);
|
unlock(&p->lock);
|
||||||
|
_threadsetproc(nil);
|
||||||
free(p);
|
free(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -599,7 +605,7 @@ threadrwakeup(Rendez *r, int all, ulong pc)
|
||||||
static int threadargc;
|
static int threadargc;
|
||||||
static char **threadargv;
|
static char **threadargv;
|
||||||
int mainstacksize;
|
int mainstacksize;
|
||||||
|
extern int _p9usepwlibrary; /* getgrgid etc. smash the stack - tell _p9dir just say no */
|
||||||
static void
|
static void
|
||||||
threadmainstart(void *v)
|
threadmainstart(void *v)
|
||||||
{
|
{
|
||||||
|
|
@ -613,6 +619,7 @@ threadmainstart(void *v)
|
||||||
* This means the pthread implementation is not suitable for
|
* This means the pthread implementation is not suitable for
|
||||||
* running under libthread. Time to write your own. Sorry.
|
* running under libthread. Time to write your own. Sorry.
|
||||||
*/
|
*/
|
||||||
|
_p9usepwlibrary = 0;
|
||||||
threadmainproc = proc();
|
threadmainproc = proc();
|
||||||
threadmain(threadargc, threadargv);
|
threadmain(threadargc, threadargv);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue