From owner-p4-projects Tue Apr 9 13:29:51 2002 Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 7F06F37B417; Tue, 9 Apr 2002 13:29:38 -0700 (PDT) Delivered-To: perforce@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 786EE37B405 for ; Tue, 9 Apr 2002 13:29:37 -0700 (PDT) Received: (from perforce@localhost) by freefall.freebsd.org (8.11.6/8.11.6) id g39KTbt26226 for perforce@freebsd.org; Tue, 9 Apr 2002 13:29:37 -0700 (PDT) (envelope-from jhb@freebsd.org) Date: Tue, 9 Apr 2002 13:29:37 -0700 (PDT) Message-Id: <200204092029.g39KTbt26226@freefall.freebsd.org> X-Authentication-Warning: freefall.freebsd.org: perforce set sender to jhb@freebsd.org using -f From: John Baldwin Subject: PERFORCE change 9465 for review To: Perforce Change Reviews Sender: owner-p4-projects@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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