2003-09-30 17:47:42 +00:00
|
|
|
#include <lib9.h>
|
|
|
|
#include <thread.h>
|
|
|
|
extern int _threaddebuglevel;
|
|
|
|
|
|
|
|
void
|
|
|
|
doexec(void *v)
|
|
|
|
{
|
|
|
|
char **argv = v;
|
|
|
|
|
2003-11-23 18:18:00 +00:00
|
|
|
print("doexec\n");
|
2003-09-30 17:47:42 +00:00
|
|
|
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)
|
2003-11-23 18:18:00 +00:00
|
|
|
print("exec failed: %r\n");
|
2003-09-30 17:47:42 +00:00
|
|
|
else
|
2003-11-23 18:18:00 +00:00
|
|
|
print("%d %lud %lud %lud %s\n", w->pid, w->time[0], w->time[1], w->time[2], w->msg);
|
2003-09-30 17:47:42 +00:00
|
|
|
threadexits(nil);
|
|
|
|
}
|