Source-Changes-HG archive

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

[src/trunk]: src/sys/kern adjust kq_check() (enabled with DEBUG) to new reali...



details:   https://anonhg.NetBSD.org/src/rev/58329d97dc3b
branches:  trunk
changeset: 980056:58329d97dc3b
user:      jdolecek <jdolecek%NetBSD.org@localhost>
date:      Thu Jan 21 18:09:23 2021 +0000

description:
adjust kq_check() (enabled with DEBUG) to new reality - it's now perfectly
normal to have kq_count bigger than number of the linked entries
on the kqueue

PR kern/50094, problem pointed out by Chuck Silvers

diffstat:

 sys/kern/kern_event.c |  15 +++++++--------
 1 files changed, 7 insertions(+), 8 deletions(-)

diffs (50 lines):

diff -r a20a185a9aef -r 58329d97dc3b sys/kern/kern_event.c
--- a/sys/kern/kern_event.c     Thu Jan 21 18:09:10 2021 +0000
+++ b/sys/kern/kern_event.c     Thu Jan 21 18:09:23 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_event.c,v 1.111 2021/01/20 21:39:09 jdolecek Exp $        */
+/*     $NetBSD: kern_event.c,v 1.112 2021/01/21 18:09:23 jdolecek Exp $        */
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_event.c,v 1.111 2021/01/20 21:39:09 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_event.c,v 1.112 2021/01/21 18:09:23 jdolecek Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -1322,6 +1322,7 @@
        return (error);
 }
 
+#define DEBUG
 #if defined(DEBUG)
 #define KN_FMT(buf, kn) \
     (snprintb((buf), sizeof(buf), __KN_FLAG_BITS, (kn)->kn_status), buf)
@@ -1356,7 +1357,10 @@
                        }
                        count++;
                        if (count > kq->kq_count) {
-                               goto bad;
+                               panic("%s,%zu: kq=%p kq->kq_count(%d) != "
+                                   "count(%d), nmarker=%d",
+                                   func, line, kq, kq->kq_count, count,
+                                   nmarker);
                        }
                } else {
                        nmarker++;
@@ -1370,11 +1374,6 @@
 #endif
                }
        }
-       if (kq->kq_count != count) {
-bad:
-               panic("%s,%zu: kq=%p kq->kq_count(%d) != count(%d), nmarker=%d",
-                   func, line, kq, kq->kq_count, count, nmarker);
-       }
 }
 #define kq_check(a) kqueue_check(__func__, __LINE__, (a))
 #else /* defined(DEBUG) */



Home | Main Index | Thread Index | Old Index