From 9b703b14551addf9806978973e2ddc427d4908b4 Mon Sep 17 00:00:00 2001 From: phk 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') diff --git a/sys/compat/linux/linux_misc.c b/sys/compat/linux/linux_misc.c index d267130..2ee3cb2 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.1