Module Name: src
Committed By: kre
Date: Sat Jan 18 21:53:13 UTC 2025
Modified Files:
src/sys/altq: altq_classq.h
Log Message:
Half revert the previous.
Only use cprng_fast32() for in kernel (ie: #ifdef _KERNEL) usages,
leave rump (and anything else userland) doing it the old way.
To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/altq/altq_classq.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/altq/altq_classq.h
diff -u src/sys/altq/altq_classq.h:1.10 src/sys/altq/altq_classq.h:1.11
--- src/sys/altq/altq_classq.h:1.10 Sat Jan 18 16:51:28 2025
+++ src/sys/altq/altq_classq.h Sat Jan 18 21:53:13 2025
@@ -1,4 +1,4 @@
-/* $NetBSD: altq_classq.h,v 1.10 2025/01/18 16:51:28 joe Exp $ */
+/* $NetBSD: altq_classq.h,v 1.11 2025/01/18 21:53:13 kre Exp $ */
/* $KAME: altq_classq.h,v 1.6 2003/01/07 07:33:38 kjc Exp $ */
/*
@@ -39,7 +39,9 @@
#ifndef _ALTQ_ALTQ_CLASSQ_H_
#define _ALTQ_ALTQ_CLASSQ_H_
+#ifdef _KERNEL
#include <sys/cprng.h>
+#endif
#ifdef __cplusplus
extern "C" {
@@ -157,7 +159,11 @@ _getq_random(class_queue_t *q)
else {
struct mbuf *prev = NULL;
+#ifdef _KERNEL
n = cprng_fast32() % qlen(q) + 1;
+#else
+ n = random() % qlen(q) + 1;
+#endif
for (i = 0; i < n; i++) {
prev = m;
m = m->m_nextpkt;