Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/kern itimer(9): Sprinkle some more assertions.



details:   https://anonhg.NetBSD.org/src/rev/e96d8521a524
branches:  trunk
changeset: 373651:e96d8521a524
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Thu Feb 23 02:57:17 2023 +0000

description:
itimer(9): Sprinkle some more assertions.

diffstat:

 sys/kern/kern_time.c |  10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diffs (53 lines):

diff -r d3b93427b711 -r e96d8521a524 sys/kern/kern_time.c
--- a/sys/kern/kern_time.c      Thu Feb 23 02:56:25 2023 +0000
+++ b/sys/kern/kern_time.c      Thu Feb 23 02:57:17 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_time.c,v 1.220 2023/02/23 02:56:25 riastradh Exp $        */
+/*     $NetBSD: kern_time.c,v 1.221 2023/02/23 02:57:17 riastradh Exp $        */
 
 /*-
  * Copyright (c) 2000, 2004, 2005, 2007, 2008, 2009, 2020
@@ -62,7 +62,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_time.c,v 1.220 2023/02/23 02:56:25 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_time.c,v 1.221 2023/02/23 02:57:17 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/resourcevar.h>
@@ -809,7 +809,10 @@
 static void
 itimer_arm_real(struct itimer * const it)
 {
+
        KASSERT(!it->it_dying);
+       KASSERT(!CLOCK_VIRTUAL_P(it->it_clockid));
+       KASSERT(!callout_pending(&it->it_ch));
 
        /*
         * Don't need to check tshzto() return value, here.
@@ -907,6 +910,7 @@
        struct itlist *itl;
 
        KASSERT(itimer_lock_held());
+       KASSERT(!it->it_dying);
 
        if (!CLOCK_VIRTUAL_P(it->it_clockid)) {
                /*
@@ -918,6 +922,7 @@
                 */
                if (callout_halt(&it->it_ch, &itimer_mutex))
                        return ERESTART;
+               KASSERT(!it->it_dying);
 
                /* Now we can touch it and start it up again. */
                if (timespecisset(&it->it_time.it_value))
@@ -973,6 +978,7 @@
        struct itimer *itn;
 
        KASSERT(itimer_lock_held());
+       KASSERT(!it->it_dying);
 
        *aits = it->it_time;
        if (!CLOCK_VIRTUAL_P(it->it_clockid)) {



Home | Main Index | Thread Index | Old Index