[libgtop] openbsd: better handling of p_wchan



commit c99ceeaa65a5482db2b5b3b677a8c4b40acc8eb8
Author: Antoine Jacoutot <ajacoutot gnome org>
Date:   Sat Feb 1 19:09:21 2014 +0100

    openbsd: better handling of p_wchan

 sysdeps/openbsd/prockernel.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/sysdeps/openbsd/prockernel.c b/sysdeps/openbsd/prockernel.c
index e2a1b67..9d1a214 100644
--- a/sysdeps/openbsd/prockernel.c
+++ b/sysdeps/openbsd/prockernel.c
@@ -76,12 +76,14 @@ glibtop_get_proc_kernel_p (glibtop *server,
                return;
        }
 
-       if (pinfo->p_wmesg)
-               g_strlcpy(buf->wchan, pinfo->p_wmesg, sizeof(buf->wchan));
-
        buf->min_flt = pinfo[0].p_uru_minflt;
        buf->maj_flt = pinfo[0].p_uru_majflt;
 
+       buf->nwchan = pinfo[0].p_wchan;
+       if (pinfo[0].p_wchan && pinfo[0].p_wmesg)
+               g_strlcpy(buf->wchan, pinfo[0].p_wmesg,
+                         sizeof buf->wchan);
+
        buf->flags |= (_glibtop_sysdeps_proc_kernel_wchan
                | _glibtop_sysdeps_proc_kernel_pstats);
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]