aboutsummaryrefslogtreecommitdiff
path: root/sys/kern/kern_ntptime.c
diff options
context:
space:
mode:
authorMatthew Dillon <dillon@FreeBSD.org>2001-09-01 05:47:58 +0000
committerMatthew Dillon <dillon@FreeBSD.org>2001-09-01 05:47:58 +0000
commit6f1e8c186f9f87a6c385927f111f521470b00fff (patch)
treeb7aa248569b224dc69ea56ec3af0521cfaf9fe65 /sys/kern/kern_ntptime.c
parent3e443c051288d8fabd99d95c568b1ad6a529f339 (diff)
downloadsrc-6f1e8c186f9f87a6c385927f111f521470b00fff.tar.gz
src-6f1e8c186f9f87a6c385927f111f521470b00fff.zip
Pushdown Giant for: profil(), ntp_adjtime(), ogethostname(),
osethostname(), ogethostid(), osethostid()
Notes
Notes: svn path=/head/; revision=82717
Diffstat (limited to 'sys/kern/kern_ntptime.c')
-rw-r--r--sys/kern/kern_ntptime.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/sys/kern/kern_ntptime.c b/sys/kern/kern_ntptime.c
index 76814724650e..3d689db405fd 100644
--- a/sys/kern/kern_ntptime.c
+++ b/sys/kern/kern_ntptime.c
@@ -38,6 +38,8 @@
#include <sys/sysproto.h>
#include <sys/kernel.h>
#include <sys/proc.h>
+#include <sys/lock.h>
+#include <sys/mutex.h>
#include <sys/time.h>
#include <sys/timex.h>
#include <sys/timetc.h>
@@ -270,6 +272,9 @@ struct ntp_adjtime_args {
};
#endif
+/*
+ * MPSAFE
+ */
int
ntp_adjtime(struct proc *p, struct ntp_adjtime_args *uap)
{
@@ -292,11 +297,12 @@ ntp_adjtime(struct proc *p, struct ntp_adjtime_args *uap)
* the STA_PLL bit in the status word is cleared, the state and
* status words are reset to the initial values at boot.
*/
+ mtx_lock(&Giant);
modes = ntv.modes;
if (modes)
error = suser(p);
if (error)
- return (error);
+ goto done2;
s = splclock();
if (modes & MOD_MAXERROR)
time_maxerror = ntv.maxerror;
@@ -397,7 +403,7 @@ ntp_adjtime(struct proc *p, struct ntp_adjtime_args *uap)
error = copyout((caddr_t)&ntv, (caddr_t)uap->tp, sizeof(ntv));
if (error)
- return (error);
+ goto done2;
/*
* Status word error decode. See comments in
@@ -409,10 +415,13 @@ ntp_adjtime(struct proc *p, struct ntp_adjtime_args *uap)
(time_status & STA_PPSTIME &&
time_status & STA_PPSJITTER) ||
(time_status & STA_PPSFREQ &&
- time_status & (STA_PPSWANDER | STA_PPSERROR)))
+ time_status & (STA_PPSWANDER | STA_PPSERROR))) {
p->p_retval[0] = TIME_ERROR;
- else
+ } else {
p->p_retval[0] = time_state;
+ }
+done2:
+ mtx_unlock(&Giant);
return (error);
}