Source-Changes-HG archive

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

[.joined/src/trunk]: .joined/src/sys/dev/sysmon sysmon(9): Fix mistake in sys...



details:   https://anonhg.NetBSD.org/.joined/src/rev/24b8e699d8c0
branches:  trunk
changeset: 359349:24b8e699d8c0
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Fri Dec 31 14:29:14 2021 +0000

description:
sysmon(9): Fix mistake in sysmon_task_queue_barrier.

Need to allocate the task structure with malloc(9), not on the stack;
the task thread will free it with free(9).  Forgot to squash this
into previous commit.

diffstat:

 sys/dev/sysmon/sysmon_taskq.c |  15 ++++++++-------
 1 files changed, 8 insertions(+), 7 deletions(-)

diffs (44 lines):

diff -r 661076791f2d -r 24b8e699d8c0 sys/dev/sysmon/sysmon_taskq.c
--- a/sys/dev/sysmon/sysmon_taskq.c     Fri Dec 31 14:26:29 2021 +0000
+++ b/sys/dev/sysmon/sysmon_taskq.c     Fri Dec 31 14:29:14 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sysmon_taskq.c,v 1.22 2021/12/31 14:22:11 riastradh Exp $      */
+/*     $NetBSD: sysmon_taskq.c,v 1.23 2021/12/31 14:29:14 riastradh Exp $      */
 
 /*
  * Copyright (c) 2001, 2003 Wasabi Systems, Inc.
@@ -41,7 +41,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sysmon_taskq.c,v 1.22 2021/12/31 14:22:11 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sysmon_taskq.c,v 1.23 2021/12/31 14:29:14 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/malloc.h>
@@ -280,7 +280,7 @@
 void
 sysmon_task_queue_barrier(u_int pri)
 {
-       struct sysmon_task st;
+       struct sysmon_task *st;
        struct tqbarrier bar;
 
        (void)RUN_ONCE(&once_tq, tq_preinit);
@@ -292,11 +292,12 @@
        cv_init(&bar.cv, "sysmontq");
        bar.done = false;
 
-       st.st_func = &tqbarrier_task;
-       st.st_arg = &bar;
-       st.st_pri = pri;
+       st = malloc(sizeof(*st), M_TEMP, M_WAITOK);
+       st->st_func = &tqbarrier_task;
+       st->st_arg = &bar;
+       st->st_pri = pri;
 
-       sysmon_task_queue_sched_task(&st);
+       sysmon_task_queue_sched_task(st);
 
        mutex_enter(&bar.lock);
        while (!bar.done)



Home | Main Index | Thread Index | Old Index