Adjust for the fact that regular users cannot read wchan anymore in OpenBSD 5.4.

This commit is contained in:
Jasper Lievisse Adriaanse
2013-04-01 13:40:11 +02:00
parent a44392d948
commit dc7eab4329

View File

@@ -78,15 +78,12 @@ glibtop_get_proc_kernel_p (glibtop *server,
return; return;
} }
buf->nwchan = pinfo[0].p_wchan; if (pinfo->p_wmesg[0])
if (pinfo[0].p_wchan && pinfo[0].p_wmesg) g_strlcpy(buf->wchan, pinfo->p_wmesg[0], sizeof(buf->wchan));
g_strlcpy(buf->wchan, pinfo[0].p_wmesg,
sizeof buf->wchan);
buf->min_flt = pinfo[0].p_uru_minflt; buf->min_flt = pinfo[0].p_uru_minflt;
buf->maj_flt = pinfo[0].p_uru_majflt; buf->maj_flt = pinfo[0].p_uru_majflt;
buf->flags |= (_glibtop_sysdeps_proc_kernel_wchan buf->flags |= (_glibtop_sysdeps_proc_kernel_wchan
| _glibtop_sysdeps_proc_kernel_pstats); | _glibtop_sysdeps_proc_kernel_pstats);
} }