From 227ee8a188f0f8da52dabd7c2c13748a2578efce Mon Sep 17 00:00:00 2001 From: Poul-Henning Kamp Date: Mon, 30 Mar 1998 09:56:58 +0000 Subject: Eradicate the variable "time" from the kernel, using various measures. "time" wasn't a atomic variable, so splfoo() protection were needed around any access to it, unless you just wanted the seconds part. Most uses of time.tv_sec now uses the new variable time_second instead. gettime() changed to getmicrotime(0. Remove a couple of unneeded splfoo() protections, the new getmicrotime() is atomic, (until Bruce sets a breakpoint in it). A couple of places needed random data, so use read_random() instead of mucking about with time which isn't random. Add a new nfs_curusec() function. Mark a couple of bogosities involving the now disappeard time variable. Update ffs_update() to avoid the weird "== &time" checks, by fixing the one remaining call that passwd &time as args. Change profiling in ncr.c to use ticks instead of time. Resolution is the same. Add new function "tvtohz()" to avoid the bogus "splfoo(), add time, call hzto() which subtracts time" sequences. Reviewed by: bde --- sys/compat/linux/linux_misc.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'sys/compat/linux/linux_misc.c') diff --git a/sys/compat/linux/linux_misc.c b/sys/compat/linux/linux_misc.c index d26713016c68e..2ee3cb269fdbf 100644 --- a/sys/compat/linux/linux_misc.c +++ b/sys/compat/linux/linux_misc.c @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: linux_misc.c,v 1.33 1997/11/06 19:28:58 phk Exp $ + * $Id: linux_misc.c,v 1.34 1998/02/25 05:33:06 bde Exp $ */ #include @@ -73,9 +73,9 @@ linux_alarm(struct proc *p, struct linux_alarm_args *args) it.it_value.tv_usec = 0; it.it_interval.tv_sec = 0; it.it_interval.tv_usec = 0; - s = splclock(); + s = splclock(); /* XXX Still needed ? */ old_it = p->p_realtimer; - tv = time; + getmicrotime(&tv); if (timerisset(&old_it.it_value)) if (timercmp(&old_it.it_value, &tv, <)) timerclear(&old_it.it_value); @@ -84,10 +84,10 @@ linux_alarm(struct proc *p, struct linux_alarm_args *args) splx(s); if (itimerfix(&it.it_value) || itimerfix(&it.it_interval)) return EINVAL; - s = splclock(); + s = splclock(); /* XXX Still needed ? */ if (timerisset(&p->p_realtimer.it_value)) untimeout(realitexpire, (caddr_t)p, p->p_ithandle); - tv = time; + getmicrotime(&tv); if (timerisset(&it.it_value)) { timevaladd(&it.it_value, &tv); p->p_ithandle = timeout(realitexpire, (caddr_t)p, hzto(&it.it_value)); -- cgit v1.3