paranoia
This commit is contained in:
parent
e9dbe11dbf
commit
37cc72d323
2 changed files with 17 additions and 2 deletions
|
|
@ -38,7 +38,15 @@ child(void)
|
||||||
raise(WTERMSIG(status));
|
raise(WTERMSIG(status));
|
||||||
_exit(98); /* not reached */
|
_exit(98); /* not reached */
|
||||||
}
|
}
|
||||||
fprint(2, "%s: wait pid %d status 0x%ux\n", pid, status);
|
if(WIFSTOPPED(status)){
|
||||||
|
fprint(2, "%s: wait pid %d stopped\n", argv0, pid);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(WIFCONTINUED(status)){
|
||||||
|
fprint(2, "%s: wait pid %d continued\n", argv0, pid);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
fprint(2, "%s: wait pid %d status 0x%ux\n", argv0, pid, status);
|
||||||
_exit(99);
|
_exit(99);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -112,12 +112,19 @@ threadalloc(void (*fn)(void*), void *arg, uint stack)
|
||||||
sigprocmask(SIG_BLOCK, &zero, &t->context.uc.uc_sigmask);
|
sigprocmask(SIG_BLOCK, &zero, &t->context.uc.uc_sigmask);
|
||||||
|
|
||||||
/* must initialize with current context */
|
/* must initialize with current context */
|
||||||
getcontext(&t->context.uc);
|
if(getcontext(&t->context.uc) < 0)
|
||||||
|
sysfatal("threadalloc getcontext: %r");
|
||||||
|
|
||||||
/* call makecontext to do the real work. */
|
/* call makecontext to do the real work. */
|
||||||
/* leave a few words open on both ends */
|
/* leave a few words open on both ends */
|
||||||
t->context.uc.uc_stack.ss_sp = t->stk+8;
|
t->context.uc.uc_stack.ss_sp = t->stk+8;
|
||||||
t->context.uc.uc_stack.ss_size = t->stksize-64;
|
t->context.uc.uc_stack.ss_size = t->stksize-64;
|
||||||
|
#ifdef __sun__ /* sigh */
|
||||||
|
/* can avoid this with __MAKECONTEXT_V2_SOURCE but only on SunOS 5.9 */
|
||||||
|
t->context.uc_stack.ss_sp =
|
||||||
|
(char*)t->context.uc_stack.ss_sp
|
||||||
|
+t->context.uc_stack.ss_size;
|
||||||
|
#endif
|
||||||
makecontext(&t->context.uc, (void(*)())threadstart, 1, t);
|
makecontext(&t->context.uc, (void(*)())threadstart, 1, t);
|
||||||
|
|
||||||
return t;
|
return t;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue