Unbreak sigaltstack syscall. sigonstack is now a function and

want proc lock be held.
This commit is contained in:
David Xu 2003-04-19 05:04:06 +00:00
parent 588257e810
commit 06ce69a720
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=113706

View file

@ -1228,15 +1228,13 @@ kern_sigaltstack(struct thread *td, stack_t *ss, stack_t *oss)
int error = 0; int error = 0;
mtx_lock(&Giant); mtx_lock(&Giant);
PROC_LOCK(p);
oonstack = sigonstack(cpu_getstack(td)); oonstack = sigonstack(cpu_getstack(td));
if (oss != NULL) { if (oss != NULL) {
PROC_LOCK(p);
*oss = p->p_sigstk; *oss = p->p_sigstk;
oss->ss_flags = (p->p_flag & P_ALTSTACK) oss->ss_flags = (p->p_flag & P_ALTSTACK)
? ((oonstack) ? SS_ONSTACK : 0) : SS_DISABLE; ? ((oonstack) ? SS_ONSTACK : 0) : SS_DISABLE;
PROC_UNLOCK(p);
} }
if (ss != NULL) { if (ss != NULL) {
@ -1253,17 +1251,14 @@ kern_sigaltstack(struct thread *td, stack_t *ss, stack_t *oss)
error = ENOMEM; error = ENOMEM;
goto done2; goto done2;
} }
PROC_LOCK(p);
p->p_sigstk = *ss; p->p_sigstk = *ss;
p->p_flag |= P_ALTSTACK; p->p_flag |= P_ALTSTACK;
PROC_UNLOCK(p);
} else { } else {
PROC_LOCK(p);
p->p_flag &= ~P_ALTSTACK; p->p_flag &= ~P_ALTSTACK;
PROC_UNLOCK(p);
} }
} }
done2: done2:
PROC_UNLOCK(p);
mtx_unlock(&Giant); mtx_unlock(&Giant);
return (error); return (error);
} }