From f6930d670aeb0a4c981e4d49221494c53da27d49 Mon Sep 17 00:00:00 2001 From: infirit Date: Fri, 19 Dec 2014 01:03:48 +0100 Subject: 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. Taken from GSM commit: 94be681c159b56ad42afb13c3e18d59be4422558 From: Antoine Jacoutot --- src/procproperties.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/procproperties.cpp b/src/procproperties.cpp index 0020782..b378dc6 100644 --- a/src/procproperties.cpp +++ b/src/procproperties.cpp @@ -24,7 +24,12 @@ #include #include #include +#if defined (__linux__) #include +#elif defined (__OpenBSD__) +#include +#include +#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)}, -- cgit v1.2.1