Make sigaltstack as per-threaded, because per-process sigaltstack state
is useless for threaded programs, multiple threads can not share same stack. The alternative signal stack is private for thread, no lock is needed, the orignal P_ALTSTACK is now moved into td_pflags and renamed to TDP_ALTSTACK. For single thread or Linux clone() based threaded program, there is no semantic changed, because those programs only have one kernel thread in every process.
This commit is contained in:
parent
9b778a1611
commit
51362c2d8a
@ -485,11 +485,11 @@ osf1_sendsig(sig_t catcher, int sig, sigset_t *mask, u_long code)
|
|||||||
* and the useracc() check will fail if the process has not already
|
* and the useracc() check will fail if the process has not already
|
||||||
* allocated the space with a `brk'.
|
* allocated the space with a `brk'.
|
||||||
*/
|
*/
|
||||||
if ((p->p_flag & P_ALTSTACK) && !oonstack &&
|
if ((td->td_pflags & TDP_ALTSTACK) && !oonstack &&
|
||||||
SIGISMEMBER(psp->ps_sigonstack, sig)) {
|
SIGISMEMBER(psp->ps_sigonstack, sig)) {
|
||||||
sip = (osiginfo_t *)((caddr_t)p->p_sigstk.ss_sp +
|
sip = (osiginfo_t *)((caddr_t)td->td_sigstk.ss_sp +
|
||||||
p->p_sigstk.ss_size - rndfsize);
|
td->td_sigstk.ss_size - rndfsize);
|
||||||
p->p_sigstk.ss_flags |= SS_ONSTACK;
|
td->td_sigstk.ss_flags |= SS_ONSTACK;
|
||||||
} else
|
} else
|
||||||
sip = (osiginfo_t *)(alpha_pal_rdusp() - rndfsize);
|
sip = (osiginfo_t *)(alpha_pal_rdusp() - rndfsize);
|
||||||
mtx_unlock(&psp->ps_mtx);
|
mtx_unlock(&psp->ps_mtx);
|
||||||
@ -588,9 +588,9 @@ osf1_sigreturn(struct thread *td,
|
|||||||
*/
|
*/
|
||||||
PROC_LOCK(p);
|
PROC_LOCK(p);
|
||||||
if (ksc.sc_onstack)
|
if (ksc.sc_onstack)
|
||||||
p->p_sigstk.ss_flags |= SS_ONSTACK;
|
td->td_sigstk.ss_flags |= SS_ONSTACK;
|
||||||
else
|
else
|
||||||
p->p_sigstk.ss_flags &= ~SS_ONSTACK;
|
td->td_sigstk.ss_flags &= ~SS_ONSTACK;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* longjmp is still implemented by calling osigreturn. The new
|
* longjmp is still implemented by calling osigreturn. The new
|
||||||
|
Loading…
x
Reference in New Issue
Block a user