Date: Tue, 9 Apr 2002 13:29:37 -0700 (PDT) From: John Baldwin <jhb@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 9465 for review Message-ID: <200204092029.g39KTbt26226@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://people.freebsd.org/~peter/p4db/chv.cgi?CH=9465 Change 9465 by jhb@jhb_laptop on 2002/04/09 13:28:52 Push down Giant in settime() until we actually talk to the timecounters and time of day clocks to set the time. Also, push down Giant in the settimeofday() syscall until we set the 'tz' value. Affected files ... ... //depot/projects/smpng/sys/kern/kern_time.c#11 edit Differences ... ==== //depot/projects/smpng/sys/kern/kern_time.c#11 (text+ko) ==== @@ -132,11 +132,13 @@ ts.tv_sec = tv->tv_sec; ts.tv_nsec = tv->tv_usec * 1000; + mtx_lock(&Giant); tc_setclock(&ts); (void) splsoftclock(); lease_updatetime(delta.tv_sec); splx(s); resettodr(); + mtx_unlock(&Giant); return (0); } @@ -196,9 +198,7 @@ return (EINVAL); /* XXX Don't convert nsec->usec and back */ TIMESPEC_TO_TIMEVAL(&atv, &ats); - mtx_lock(&Giant); error = settime(td, &atv); - mtx_unlock(&Giant); return (error); } @@ -366,28 +366,26 @@ mtx_lock(&Giant); if ((error = suser(td))) - goto done2; + return (error); /* Verify all parameters before changing time. */ if (uap->tv) { if ((error = copyin((caddr_t)uap->tv, (caddr_t)&atv, - sizeof(atv)))) { - goto done2; - } - if (atv.tv_usec < 0 || atv.tv_usec >= 1000000) { - error = EINVAL; - goto done2; - } + sizeof(atv)))) + return (error); + if (atv.tv_usec < 0 || atv.tv_usec >= 1000000) + return (EINVAL); } if (uap->tzp && - (error = copyin((caddr_t)uap->tzp, (caddr_t)&atz, sizeof(atz)))) { - goto done2; - } + (error = copyin((caddr_t)uap->tzp, (caddr_t)&atz, sizeof(atz)))) + return (error); + if (uap->tv && (error = settime(td, &atv))) - goto done2; - if (uap->tzp) + return (error); + if (uap->tzp) { + mtx_lock(&Giant); tz = atz; -done2: - mtx_unlock(&Giant); + mtx_unlock(&Giant); + } return (error); } To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe p4-projects" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200204092029.g39KTbt26226>