Date: Fri, 5 Apr 2002 15:14:24 -0800 (PST) From: John Baldwin <jhb@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 9150 for review Message-ID: <200204052314.g35NEOb18822@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://people.freebsd.org/~peter/p4db/chv.cgi?CH=9150 Change 9150 by jhb@jhb_laptop on 2002/04/05 15:13:26 Change settime() to take a thread as the first argument and push down Giant in the clock_settime() syscall. Affected files ... ... //depot/projects/smpng/sys/kern/kern_time.c#10 integrate Differences ... ==== //depot/projects/smpng/sys/kern/kern_time.c#10 (text+ko) ==== @@ -66,7 +66,7 @@ static int nanosleep1(struct thread *td, struct timespec *rqt, struct timespec *rmt); -static int settime(struct proc *, struct timeval *); +static int settime(struct thread *, struct timeval *); static void timevalfix(struct timeval *); static void no_lease_updatetime(int); @@ -79,8 +79,8 @@ void (*lease_updatetime)(int) = no_lease_updatetime; static int -settime(p, tv) - struct proc *p; +settime(td, tv) + struct thread *td; struct timeval *tv; { struct timeval delta, tv1, tv2; @@ -104,7 +104,7 @@ * than one second, nor more than once per second. This allows * a miscreant to make the clock march double-time, but no worse. */ - if (securelevel_gt(p->p_ucred, 1) != 0) { + if (securelevel_gt(td->td_ucred, 1) != 0) { if (delta.tv_sec < 0 || delta.tv_usec < 0) { /* * Update maxtime to latest time we've seen. @@ -186,23 +186,18 @@ struct timespec ats; int error; - mtx_lock(&Giant); if ((error = suser(td)) != 0) - goto done2; - if (SCARG(uap, clock_id) != CLOCK_REALTIME) { - error = EINVAL; - goto done2; - } + return (error); + if (SCARG(uap, clock_id) != CLOCK_REALTIME) + return (EINVAL); if ((error = copyin(SCARG(uap, tp), &ats, sizeof(ats))) != 0) - goto done2; - if (ats.tv_nsec < 0 || ats.tv_nsec >= 1000000000) { - error = EINVAL; - goto done2; - } + return (error); + if (ats.tv_nsec < 0 || ats.tv_nsec >= 1000000000) + return (EINVAL); /* XXX Don't convert nsec->usec and back */ TIMESPEC_TO_TIMEVAL(&atv, &ats); - error = settime(td->td_proc, &atv); -done2: + mtx_lock(&Giant); + error = settime(td, &atv); mtx_unlock(&Giant); return (error); } @@ -387,7 +382,7 @@ (error = copyin((caddr_t)uap->tzp, (caddr_t)&atz, sizeof(atz)))) { goto done2; } - if (uap->tv && (error = settime(td->td_proc, &atv))) + if (uap->tv && (error = settime(td, &atv))) goto done2; if (uap->tzp) tz = atz; 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?200204052314.g35NEOb18822>