summaryrefslogtreecommitdiffstats
path: root/sys/pc98
diff options
context:
space:
mode:
authordavidxu <davidxu@FreeBSD.org>2004-01-03 02:02:26 +0000
committerdavidxu <davidxu@FreeBSD.org>2004-01-03 02:02:26 +0000
commitf39653dda8a5ba30d080c073e76f4065a6bf4b48 (patch)
tree14d49d69e2829a6224271d42946d9bec5a5f9ada /sys/pc98
parent5b9bbee08a34c013ab6b7b6432dd37835012f868 (diff)
downloadFreeBSD-src-f39653dda8a5ba30d080c073e76f4065a6bf4b48.zip
FreeBSD-src-f39653dda8a5ba30d080c073e76f4065a6bf4b48.tar.gz
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. Reviewed by: deischen, dfr
Diffstat (limited to 'sys/pc98')
-rw-r--r--sys/pc98/i386/machdep.c44
-rw-r--r--sys/pc98/pc98/machdep.c44
2 files changed, 44 insertions, 44 deletions
diff --git a/sys/pc98/i386/machdep.c b/sys/pc98/i386/machdep.c
index 52b5fef..ab8bff3 100644
--- a/sys/pc98/i386/machdep.c
+++ b/sys/pc98/i386/machdep.c
@@ -285,12 +285,12 @@ osendsig(catcher, sig, mask, code)
oonstack = sigonstack(regs->tf_esp);
/* Allocate space for the signal handler context. */
- if ((p->p_flag & P_ALTSTACK) && !oonstack &&
+ if ((td->td_pflags & TDP_ALTSTACK) && !oonstack &&
SIGISMEMBER(psp->ps_sigonstack, sig)) {
- fp = (struct osigframe *)(p->p_sigstk.ss_sp +
- p->p_sigstk.ss_size - sizeof(struct osigframe));
+ fp = (struct osigframe *)(td->td_sigstk.ss_sp +
+ td->td_sigstk.ss_size - sizeof(struct osigframe));
#if defined(COMPAT_43) || defined(COMPAT_SUNOS)
- p->p_sigstk.ss_flags |= SS_ONSTACK;
+ td->td_sigstk.ss_flags |= SS_ONSTACK;
#endif
} else
fp = (struct osigframe *)regs->tf_esp - 1;
@@ -417,20 +417,20 @@ freebsd4_sendsig(catcher, sig, mask, code)
/* Save user context. */
bzero(&sf, sizeof(sf));
sf.sf_uc.uc_sigmask = *mask;
- sf.sf_uc.uc_stack = p->p_sigstk;
- sf.sf_uc.uc_stack.ss_flags = (p->p_flag & P_ALTSTACK)
+ sf.sf_uc.uc_stack = td->td_sigstk;
+ sf.sf_uc.uc_stack.ss_flags = (td->td_pflags & TDP_ALTSTACK)
? ((oonstack) ? SS_ONSTACK : 0) : SS_DISABLE;
sf.sf_uc.uc_mcontext.mc_onstack = (oonstack) ? 1 : 0;
sf.sf_uc.uc_mcontext.mc_gs = rgs();
bcopy(regs, &sf.sf_uc.uc_mcontext.mc_fs, sizeof(*regs));
/* Allocate space for the signal handler context. */
- if ((p->p_flag & P_ALTSTACK) != 0 && !oonstack &&
+ if ((td->td_pflags & TDP_ALTSTACK) != 0 && !oonstack &&
SIGISMEMBER(psp->ps_sigonstack, sig)) {
- sfp = (struct sigframe4 *)(p->p_sigstk.ss_sp +
- p->p_sigstk.ss_size - sizeof(struct sigframe4));
+ sfp = (struct sigframe4 *)(td->td_sigstk.ss_sp +
+ td->td_sigstk.ss_size - sizeof(struct sigframe4));
#if defined(COMPAT_43) || defined(COMPAT_SUNOS)
- p->p_sigstk.ss_flags |= SS_ONSTACK;
+ td->td_sigstk.ss_flags |= SS_ONSTACK;
#endif
} else
sfp = (struct sigframe4 *)regs->tf_esp - 1;
@@ -551,8 +551,8 @@ sendsig(catcher, sig, mask, code)
/* Save user context. */
bzero(&sf, sizeof(sf));
sf.sf_uc.uc_sigmask = *mask;
- sf.sf_uc.uc_stack = p->p_sigstk;
- sf.sf_uc.uc_stack.ss_flags = (p->p_flag & P_ALTSTACK)
+ sf.sf_uc.uc_stack = td->td_sigstk;
+ sf.sf_uc.uc_stack.ss_flags = (td->td_pflags & TDP_ALTSTACK)
? ((oonstack) ? SS_ONSTACK : 0) : SS_DISABLE;
sf.sf_uc.uc_mcontext.mc_onstack = (oonstack) ? 1 : 0;
sf.sf_uc.uc_mcontext.mc_gs = rgs();
@@ -562,12 +562,12 @@ sendsig(catcher, sig, mask, code)
fpstate_drop(td);
/* Allocate space for the signal handler context. */
- if ((p->p_flag & P_ALTSTACK) != 0 && !oonstack &&
+ if ((td->td_pflags & TDP_ALTSTACK) != 0 && !oonstack &&
SIGISMEMBER(psp->ps_sigonstack, sig)) {
- sp = p->p_sigstk.ss_sp +
- p->p_sigstk.ss_size - sizeof(struct sigframe);
+ sp = td->td_sigstk.ss_sp +
+ td->td_sigstk.ss_size - sizeof(struct sigframe);
#if defined(COMPAT_43) || defined(COMPAT_SUNOS)
- p->p_sigstk.ss_flags |= SS_ONSTACK;
+ td->td_sigstk.ss_flags |= SS_ONSTACK;
#endif
} else
sp = (char *)regs->tf_esp - sizeof(struct sigframe);
@@ -785,9 +785,9 @@ osigreturn(td, uap)
PROC_LOCK(p);
#if defined(COMPAT_43) || defined(COMPAT_SUNOS)
if (scp->sc_onstack & 1)
- p->p_sigstk.ss_flags |= SS_ONSTACK;
+ td->td_sigstk.ss_flags |= SS_ONSTACK;
else
- p->p_sigstk.ss_flags &= ~SS_ONSTACK;
+ td->td_sigstk.ss_flags &= ~SS_ONSTACK;
#endif
SIGSETOLD(td->td_sigmask, scp->sc_mask);
SIG_CANTMASK(td->td_sigmask);
@@ -892,9 +892,9 @@ freebsd4_sigreturn(td, uap)
PROC_LOCK(p);
#if defined(COMPAT_43) || defined(COMPAT_SUNOS)
if (ucp->uc_mcontext.mc_onstack & 1)
- p->p_sigstk.ss_flags |= SS_ONSTACK;
+ td->td_sigstk.ss_flags |= SS_ONSTACK;
else
- p->p_sigstk.ss_flags &= ~SS_ONSTACK;
+ td->td_sigstk.ss_flags &= ~SS_ONSTACK;
#endif
td->td_sigmask = ucp->uc_sigmask;
@@ -1002,9 +1002,9 @@ sigreturn(td, uap)
PROC_LOCK(p);
#if defined(COMPAT_43) || defined(COMPAT_SUNOS)
if (ucp->uc_mcontext.mc_onstack & 1)
- p->p_sigstk.ss_flags |= SS_ONSTACK;
+ td->td_sigstk.ss_flags |= SS_ONSTACK;
else
- p->p_sigstk.ss_flags &= ~SS_ONSTACK;
+ td->td_sigstk.ss_flags &= ~SS_ONSTACK;
#endif
td->td_sigmask = ucp->uc_sigmask;
diff --git a/sys/pc98/pc98/machdep.c b/sys/pc98/pc98/machdep.c
index 52b5fef..ab8bff3 100644
--- a/sys/pc98/pc98/machdep.c
+++ b/sys/pc98/pc98/machdep.c
@@ -285,12 +285,12 @@ osendsig(catcher, sig, mask, code)
oonstack = sigonstack(regs->tf_esp);
/* Allocate space for the signal handler context. */
- if ((p->p_flag & P_ALTSTACK) && !oonstack &&
+ if ((td->td_pflags & TDP_ALTSTACK) && !oonstack &&
SIGISMEMBER(psp->ps_sigonstack, sig)) {
- fp = (struct osigframe *)(p->p_sigstk.ss_sp +
- p->p_sigstk.ss_size - sizeof(struct osigframe));
+ fp = (struct osigframe *)(td->td_sigstk.ss_sp +
+ td->td_sigstk.ss_size - sizeof(struct osigframe));
#if defined(COMPAT_43) || defined(COMPAT_SUNOS)
- p->p_sigstk.ss_flags |= SS_ONSTACK;
+ td->td_sigstk.ss_flags |= SS_ONSTACK;
#endif
} else
fp = (struct osigframe *)regs->tf_esp - 1;
@@ -417,20 +417,20 @@ freebsd4_sendsig(catcher, sig, mask, code)
/* Save user context. */
bzero(&sf, sizeof(sf));
sf.sf_uc.uc_sigmask = *mask;
- sf.sf_uc.uc_stack = p->p_sigstk;
- sf.sf_uc.uc_stack.ss_flags = (p->p_flag & P_ALTSTACK)
+ sf.sf_uc.uc_stack = td->td_sigstk;
+ sf.sf_uc.uc_stack.ss_flags = (td->td_pflags & TDP_ALTSTACK)
? ((oonstack) ? SS_ONSTACK : 0) : SS_DISABLE;
sf.sf_uc.uc_mcontext.mc_onstack = (oonstack) ? 1 : 0;
sf.sf_uc.uc_mcontext.mc_gs = rgs();
bcopy(regs, &sf.sf_uc.uc_mcontext.mc_fs, sizeof(*regs));
/* Allocate space for the signal handler context. */
- if ((p->p_flag & P_ALTSTACK) != 0 && !oonstack &&
+ if ((td->td_pflags & TDP_ALTSTACK) != 0 && !oonstack &&
SIGISMEMBER(psp->ps_sigonstack, sig)) {
- sfp = (struct sigframe4 *)(p->p_sigstk.ss_sp +
- p->p_sigstk.ss_size - sizeof(struct sigframe4));
+ sfp = (struct sigframe4 *)(td->td_sigstk.ss_sp +
+ td->td_sigstk.ss_size - sizeof(struct sigframe4));
#if defined(COMPAT_43) || defined(COMPAT_SUNOS)
- p->p_sigstk.ss_flags |= SS_ONSTACK;
+ td->td_sigstk.ss_flags |= SS_ONSTACK;
#endif
} else
sfp = (struct sigframe4 *)regs->tf_esp - 1;
@@ -551,8 +551,8 @@ sendsig(catcher, sig, mask, code)
/* Save user context. */
bzero(&sf, sizeof(sf));
sf.sf_uc.uc_sigmask = *mask;
- sf.sf_uc.uc_stack = p->p_sigstk;
- sf.sf_uc.uc_stack.ss_flags = (p->p_flag & P_ALTSTACK)
+ sf.sf_uc.uc_stack = td->td_sigstk;
+ sf.sf_uc.uc_stack.ss_flags = (td->td_pflags & TDP_ALTSTACK)
? ((oonstack) ? SS_ONSTACK : 0) : SS_DISABLE;
sf.sf_uc.uc_mcontext.mc_onstack = (oonstack) ? 1 : 0;
sf.sf_uc.uc_mcontext.mc_gs = rgs();
@@ -562,12 +562,12 @@ sendsig(catcher, sig, mask, code)
fpstate_drop(td);
/* Allocate space for the signal handler context. */
- if ((p->p_flag & P_ALTSTACK) != 0 && !oonstack &&
+ if ((td->td_pflags & TDP_ALTSTACK) != 0 && !oonstack &&
SIGISMEMBER(psp->ps_sigonstack, sig)) {
- sp = p->p_sigstk.ss_sp +
- p->p_sigstk.ss_size - sizeof(struct sigframe);
+ sp = td->td_sigstk.ss_sp +
+ td->td_sigstk.ss_size - sizeof(struct sigframe);
#if defined(COMPAT_43) || defined(COMPAT_SUNOS)
- p->p_sigstk.ss_flags |= SS_ONSTACK;
+ td->td_sigstk.ss_flags |= SS_ONSTACK;
#endif
} else
sp = (char *)regs->tf_esp - sizeof(struct sigframe);
@@ -785,9 +785,9 @@ osigreturn(td, uap)
PROC_LOCK(p);
#if defined(COMPAT_43) || defined(COMPAT_SUNOS)
if (scp->sc_onstack & 1)
- p->p_sigstk.ss_flags |= SS_ONSTACK;
+ td->td_sigstk.ss_flags |= SS_ONSTACK;
else
- p->p_sigstk.ss_flags &= ~SS_ONSTACK;
+ td->td_sigstk.ss_flags &= ~SS_ONSTACK;
#endif
SIGSETOLD(td->td_sigmask, scp->sc_mask);
SIG_CANTMASK(td->td_sigmask);
@@ -892,9 +892,9 @@ freebsd4_sigreturn(td, uap)
PROC_LOCK(p);
#if defined(COMPAT_43) || defined(COMPAT_SUNOS)
if (ucp->uc_mcontext.mc_onstack & 1)
- p->p_sigstk.ss_flags |= SS_ONSTACK;
+ td->td_sigstk.ss_flags |= SS_ONSTACK;
else
- p->p_sigstk.ss_flags &= ~SS_ONSTACK;
+ td->td_sigstk.ss_flags &= ~SS_ONSTACK;
#endif
td->td_sigmask = ucp->uc_sigmask;
@@ -1002,9 +1002,9 @@ sigreturn(td, uap)
PROC_LOCK(p);
#if defined(COMPAT_43) || defined(COMPAT_SUNOS)
if (ucp->uc_mcontext.mc_onstack & 1)
- p->p_sigstk.ss_flags |= SS_ONSTACK;
+ td->td_sigstk.ss_flags |= SS_ONSTACK;
else
- p->p_sigstk.ss_flags &= ~SS_ONSTACK;
+ td->td_sigstk.ss_flags &= ~SS_ONSTACK;
#endif
td->td_sigmask = ucp->uc_sigmask;
OpenPOWER on IntegriCloud