From owner-p4-projects Fri Apr 5 15:14:34 2002 Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 01DCF37B416; Fri, 5 Apr 2002 15:14:25 -0800 (PST) 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 28C5D37B404 for ; Fri, 5 Apr 2002 15:14:25 -0800 (PST) Received: (from perforce@localhost) by freefall.freebsd.org (8.11.6/8.11.6) id g35NEOb18822 for perforce@freebsd.org; Fri, 5 Apr 2002 15:14:24 -0800 (PST) (envelope-from jhb@freebsd.org) Date: Fri, 5 Apr 2002 15:14:24 -0800 (PST) Message-Id: <200204052314.g35NEOb18822@freefall.freebsd.org> X-Authentication-Warning: freefall.freebsd.org: perforce set sender to jhb@freebsd.org using -f From: John Baldwin Subject: PERFORCE change 9150 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=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