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/netkey/key.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'sys/netkey') diff --git a/sys/netkey/key.c b/sys/netkey/key.c index 508c8dedf64e..6b0a2f149650 100644 --- a/sys/netkey/key.c +++ b/sys/netkey/key.c @@ -1254,7 +1254,7 @@ key_getspi(type, vers, src, dst, lowval, highval, spi) * reasons. This is another task that key_reaper can * do once we have it coded. */ - secassoc->lifetime1 += time.tv_sec + maxlarvallifetime; + secassoc->lifetime1 += time_second + maxlarvallifetime; if (!(keynode = key_addnode(indx, secassoc))) { DPRINTF(IDL_ERROR,("key_getspi: can't add node\n")); @@ -1498,7 +1498,7 @@ key_acquire(type, src, dst) if (addrpart_equal(dst, ap->target) && (etype == ap->type)) { DPRINTF(IDL_EVENT,("acquire message previously sent!\n")); - if (ap->expiretime < time.tv_sec) { + if (ap->expiretime < time_second) { DPRINTF(IDL_EVENT,("acquire message has expired!\n")); ap->count = 0; break; @@ -1508,7 +1508,7 @@ key_acquire(type, src, dst) break; } return(0); - } else if (ap->expiretime < time.tv_sec) { + } else if (ap->expiretime < time_second) { /* * Since we're already looking at the list, we may as * well delete expired entries as we scan through the list. @@ -1594,7 +1594,7 @@ key_acquire(type, src, dst) } DPRINTF(IDL_GROSS_EVENT,("Updating acquire counter, expiration time\n")); ap->count++; - ap->expiretime = time.tv_sec + maxacquiretime; + ap->expiretime = time_second + maxacquiretime; } DPRINTF(IDL_EVENT,("key_acquire: done! success=%d\n",success)); return(success ? 0 : -1); -- cgit v1.2.3