Hello,

this diff changes timeout_add(9) to timeout_add_msec(9).
Since the changes are fairly short, I took the liberty to put
all diffs of sys/kern/ into this mail.
If you want me to send indiviual mails please say so.

While there I zapped two whitespaces.

There are a couple multiplications by 10 in the diffs,
would it be of interest to have a function like NetBSDs

#define mstohz(ms) ((unsigned int)((ms + 0ul) * hz / 1000ul))
or
#define hztoms(t) ((unsigned int)(((t) + 0ul) * 1000ul / hz))
?

http://bxr.su/NetBSD/sys/sys/param.h#497

The e.g. timeout_add(x, 0) to timeout_add_msec(x, 0) changes should
not matter on any platform I suppose. I'm not sure about the other
platforms and their rates though.

Thank you
Jan


diff --git sys/kern/kern_event.c sys/kern/kern_event.c
index f0224b6ea2b..9a5009e54ee 100644
--- sys/kern/kern_event.c
+++ sys/kern/kern_event.c
@@ -359,7 +359,7 @@ filt_timer_timeout_add(struct knote *kn)
        /* Remove extra tick from tvtohz() if timeout has fired before. */
        if (timeout_triggered(to))
                tticks--;
-       timeout_add(to, (tticks > 0) ? tticks : 1);
+       timeout_add_msec(to, (tticks > 0) ? tticks * 10 : 10);
 }
 
 void
diff --git sys/kern/kern_sig.c sys/kern/kern_sig.c
index 5f831c1727b..e6c6555a885 100644
--- sys/kern/kern_sig.c
+++ sys/kern/kern_sig.c
@@ -2,7 +2,7 @@
 /*     $NetBSD: kern_sig.c,v 1.54 1996/04/22 01:38:32 christos Exp $   */
 
 /*
- * Copyright (c) 1997 Theo de Raadt. All rights reserved. 
+ * Copyright (c) 1997 Theo de Raadt. All rights reserved.
  * Copyright (c) 1982, 1986, 1989, 1991, 1993
  *     The Regents of the University of California.  All rights reserved.
  * (c) UNIX System Laboratories, Inc.
@@ -1327,7 +1327,7 @@ proc_stop(struct proc *p, int sw)
        atomic_setbits_int(&pr->ps_flags, PS_STOPPED);
        atomic_setbits_int(&p->p_flag, P_SUSPSIG);
        if (!timeout_pending(&proc_stop_to)) {
-               timeout_add(&proc_stop_to, 0);
+               timeout_add_msec(&proc_stop_to, 0);
                /*
                 * We need this soft interrupt to be handled fast.
                 * Extra calls to softclock don't hurt.
diff --git sys/kern/kern_srp.c sys/kern/kern_srp.c
index 52fb4490047..4e60ccf01f4 100644
--- sys/kern/kern_srp.c
+++ sys/kern/kern_srp.c
@@ -161,7 +161,7 @@ srp_v_gc_start(struct srp_gc *srp_gc, struct srp *srp, void 
*v)
        ctx->hzrd.sh_v = v;
 
        timeout_set(&ctx->tick, srp_v_gc, ctx);
-       timeout_add(&ctx->tick, 1);
+       timeout_add_msec(&ctx->tick, 10);
 }
 
 void
@@ -171,7 +171,7 @@ srp_v_gc(void *x)
 
        if (srp_v_referenced(ctx->hzrd.sh_p, ctx->hzrd.sh_v)) {
                /* oh well, try again later */
-               timeout_add(&ctx->tick, 1);
+               timeout_add_msec(&ctx->tick, 10);
                return;
        }
 
diff --git sys/kern/kern_synch.c sys/kern/kern_synch.c
index ae6ca786eb7..b051b86d22a 100644
--- sys/kern/kern_synch.c
+++ sys/kern/kern_synch.c
@@ -407,7 +407,7 @@ sleep_setup_timeout(struct sleep_state *sls, int timo)
        if (timo) {
                KASSERT((p->p_flag & P_TIMEOUT) == 0);
                sls->sls_timeout = 1;
-               timeout_add(&p->p_sleep_to, timo);
+               timeout_add_msec(&p->p_sleep_to, timo * 10);
        }
 }
 
diff --git sys/kern/kern_time.c sys/kern/kern_time.c
index 06dabb1fdfb..da4b8c335eb 100644
--- sys/kern/kern_time.c
+++ sys/kern/kern_time.c
@@ -50,7 +50,7 @@
 #include <sys/mount.h>
 #include <sys/syscallargs.h>
 
-/* 
+/*
  * Time of day and interval timer support.
  *
  * These routines provide the kernel entry points to get and set
@@ -598,7 +598,7 @@ sys_setitimer(struct proc *p, void *v, register_t *retval)
                getnanouptime(&cts);
                if (timespecisset(&aits.it_value)) {
                        timo = tstohz(&aits.it_value);
-                       timeout_add(&pr->ps_realit_to, timo);
+                       timeout_add_msec(&pr->ps_realit_to, timo * 10);
                        timespecadd(&aits.it_value, &cts, &aits.it_value);
                }
                pr->ps_timer[ITIMER_REAL] = aits;
@@ -643,7 +643,7 @@ realitexpire(void *arg)
                        if (timo <= 0)
                                timo = 1;
                        if ((pr->ps_flags & PS_EXITING) == 0)
-                               timeout_add(&pr->ps_realit_to, timo);
+                               timeout_add_msec(&pr->ps_realit_to, timo * 10);
                        return;
                }
        }
diff --git sys/kern/uipc_domain.c sys/kern/uipc_domain.c
index 8cb2c77dc60..71f8c13785a 100644
--- sys/kern/uipc_domain.c
+++ sys/kern/uipc_domain.c
@@ -101,8 +101,8 @@ domaininit(void)
        max_hdr = max_linkhdr + max_protohdr;
        timeout_set_proc(&pffast_timeout, pffasttimo, &pffast_timeout);
        timeout_set_proc(&pfslow_timeout, pfslowtimo, &pfslow_timeout);
-       timeout_add(&pffast_timeout, 1);
-       timeout_add(&pfslow_timeout, 1);
+       timeout_add_msec(&pffast_timeout, 10);
+       timeout_add_msec(&pfslow_timeout, 10);
 }
 
 struct domain *
diff --git sys/kern/uipc_socket.c sys/kern/uipc_socket.c
index 58d78fbd5d4..88eaa468a56 100644
--- sys/kern/uipc_socket.c
+++ sys/kern/uipc_socket.c
@@ -257,7 +257,7 @@ sofree(struct socket *so, int s)
        if (so->so_sp) {
                /* Reuse splice idle, sounsplice() has been called before. */
                timeout_set_proc(&so->so_sp->ssp_idleto, soreaper, so);
-               timeout_add(&so->so_sp->ssp_idleto, 0);
+               timeout_add_msec(&so->so_sp->ssp_idleto, 0);
        } else
 #endif /* SOCKET_SPLICE */
        {

Reply via email to