[gnome-system-monitor/gnome-3-4] procproperties: unbreak on OpenBSD
- From: Chris KÃhl <chriskuehl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-system-monitor/gnome-3-4] procproperties: unbreak on OpenBSD
- Date: Tue, 17 Apr 2012 00:41:37 +0000 (UTC)
commit 581c2fa687495a99d5bce0b8bf255bfa4f81d850
Author: Antoine Jacoutot <ajacoutot gnome org>
Date: Fri Mar 30 10:55:08 2012 +0200
procproperties: unbreak on OpenBSD
The asm/param.h header is only found on Linux.
On OpenBSD, the HZ tick is not defined in any header but can be
retrieved from the running kernel using the sysctl(3) interface.
src/procproperties.cpp | 17 +++++++++++++++++
1 files changed, 17 insertions(+), 0 deletions(-)
---
diff --git a/src/procproperties.cpp b/src/procproperties.cpp
index ee1ced5..6821893 100644
--- a/src/procproperties.cpp
+++ b/src/procproperties.cpp
@@ -24,7 +24,12 @@
#include <glibtop/procmem.h>
#include <glibtop/procmap.h>
#include <glibtop/procstate.h>
+#if defined (__linux__)
#include <asm/param.h>
+#elif defined (__OpenBSD__)
+#include <sys/param.h>
+#include <sys/sysctl.h>
+#endif
#include "procman.h"
#include "procproperties.h"
@@ -109,6 +114,18 @@ fill_proc_properties (GtkWidget *tree, ProcInfo *info)
get_process_memory_info(info);
+#if defined (__OpenBSD__)
+ struct clockinfo cinf;
+ size_t size = sizeof (cinf);
+ int HZ;
+ int mib[] = { CTL_KERN, KERN_CLOCKRATE };
+
+ if (sysctl (mib, nitems(mib), &cinf, &size, NULL, 0) == -1)
+ HZ = 100;
+ else
+ HZ = cinf.hz;
+#endif
+
proc_arg proc_props[] = {
{ N_("Process Name"), g_strdup_printf("%s", info->name)},
{ N_("User"), g_strdup_printf("%s (%d)", info->user.c_str(), info->uid)},
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]