mirror of
https://github.com/9fans/plan9port.git
synced 2025-01-15 11:20:03 +00:00
cd7ddc9b5f
remove clumsy stack hack. fix exec. fix nthreads maintenance. fix threadexitsall not to kill self. add sun support.
35 lines
559 B
C
35 lines
559 B
C
#include <lib9.h>
|
|
#include <thread.h>
|
|
extern int _threaddebuglevel;
|
|
|
|
void
|
|
doexec(void *v)
|
|
{
|
|
char **argv = v;
|
|
|
|
print("doexec\n");
|
|
procexec(nil, argv[0], argv);
|
|
sendp(threadwaitchan(), nil);
|
|
}
|
|
|
|
void
|
|
threadmain(int argc, char **argv)
|
|
{
|
|
Channel *c;
|
|
Waitmsg *w;
|
|
|
|
ARGBEGIN{
|
|
case 'D':
|
|
_threaddebuglevel = ~0;
|
|
break;
|
|
}ARGEND
|
|
|
|
c = threadwaitchan();
|
|
proccreate(doexec, argv, 8192);
|
|
w = recvp(c);
|
|
if(w == nil)
|
|
print("exec failed: %r\n");
|
|
else
|
|
print("%d %lud %lud %lud %s\n", w->pid, w->time[0], w->time[1], w->time[2], w->msg);
|
|
threadexits(nil);
|
|
}
|