summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authortjr <tjr@FreeBSD.org>2003-02-15 09:56:09 +0000
committertjr <tjr@FreeBSD.org>2003-02-15 09:56:09 +0000
commitc831929bbba4418d3580388349f25f7f5edebe49 (patch)
treea629ab4b95f86c0ba3866b6b0296ff16be470a9e /sys
parenta000ef163a3a61cd765e6cd7fe895bd5171574d0 (diff)
downloadFreeBSD-src-c831929bbba4418d3580388349f25f7f5edebe49.zip
FreeBSD-src-c831929bbba4418d3580388349f25f7f5edebe49.tar.gz
Acquire Giant around calls to kern_sigaction() in sigaction(),
freebsd4_sigaction() and osigaction() instead of around the whole body of those functions. They now no longer hold Giant around calls to copyin() and copyout(), and it is slightly more obvious what Giant is protecting.
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/kern_sig.c26
1 files changed, 9 insertions, 17 deletions
diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c
index 9950449..9ca2ff4 100644
--- a/sys/kern/kern_sig.c
+++ b/sys/kern/kern_sig.c
@@ -389,7 +389,6 @@ struct sigaction_args {
/*
* MPSAFE
*/
-/* ARGSUSED */
int
sigaction(td, uap)
struct thread *td;
@@ -399,21 +398,19 @@ sigaction(td, uap)
register struct sigaction *actp, *oactp;
int error;
- mtx_lock(&Giant);
-
actp = (uap->act != NULL) ? &act : NULL;
oactp = (uap->oact != NULL) ? &oact : NULL;
if (actp) {
error = copyin(uap->act, actp, sizeof(act));
if (error)
- goto done2;
+ return (error);
}
+ mtx_lock(&Giant);
error = kern_sigaction(td, uap->sig, actp, oactp, 0);
+ mtx_unlock(&Giant);
if (oactp && !error) {
error = copyout(oactp, uap->oact, sizeof(oact));
}
-done2:
- mtx_unlock(&Giant);
return (error);
}
@@ -428,7 +425,6 @@ struct freebsd4_sigaction_args {
/*
* MPSAFE
*/
-/* ARGSUSED */
int
freebsd4_sigaction(td, uap)
struct thread *td;
@@ -438,21 +434,20 @@ freebsd4_sigaction(td, uap)
register struct sigaction *actp, *oactp;
int error;
- mtx_lock(&Giant);
actp = (uap->act != NULL) ? &act : NULL;
oactp = (uap->oact != NULL) ? &oact : NULL;
if (actp) {
error = copyin(uap->act, actp, sizeof(act));
if (error)
- goto done2;
+ return (error);
}
+ mtx_lock(&Giant);
error = kern_sigaction(td, uap->sig, actp, oactp, KSA_FREEBSD4);
+ mtx_unlock(&Giant);
if (oactp && !error) {
error = copyout(oactp, uap->oact, sizeof(oact));
}
-done2:
- mtx_unlock(&Giant);
return (error);
}
#endif /* COMAPT_FREEBSD4 */
@@ -468,7 +463,6 @@ struct osigaction_args {
/*
* MPSAFE
*/
-/* ARGSUSED */
int
osigaction(td, uap)
struct thread *td;
@@ -485,25 +479,23 @@ osigaction(td, uap)
nsap = (uap->nsa != NULL) ? &nsa : NULL;
osap = (uap->osa != NULL) ? &osa : NULL;
- mtx_lock(&Giant);
-
if (nsap) {
error = copyin(uap->nsa, &sa, sizeof(sa));
if (error)
- goto done2;
+ return (error);
nsap->sa_handler = sa.sa_handler;
nsap->sa_flags = sa.sa_flags;
OSIG2SIG(sa.sa_mask, nsap->sa_mask);
}
+ mtx_lock(&Giant);
error = kern_sigaction(td, uap->signum, nsap, osap, KSA_OSIGSET);
+ mtx_unlock(&Giant);
if (osap && !error) {
sa.sa_handler = osap->sa_handler;
sa.sa_flags = osap->sa_flags;
SIG2OSIG(osap->sa_mask, sa.sa_mask);
error = copyout(&sa, uap->osa, sizeof(sa));
}
-done2:
- mtx_unlock(&Giant);
return (error);
}
OpenPOWER on IntegriCloud