Adapt to new OpenBSD kinfo_proc API.
Untested diff, but this is not linked to the build and we suspect it does not even compile anymore. 'looks plausible' sthen@ 'go ahead' jasper@
This commit is contained in:
parent
04ba7ac5e4
commit
6c02fdc3bc
@ -0,0 +1,56 @@
|
||||
$OpenBSD: patch-ksysguard_ksysguardd_OpenBSD_ProcessList_c,v 1.3 2011/07/08 10:27:23 dcoppa Exp $
|
||||
|
||||
Adapt to new OpenBSD kinfo_proc API.
|
||||
|
||||
--- ksysguard/ksysguardd/OpenBSD/ProcessList.c.orig Fri Jul 8 11:38:52 2011
|
||||
+++ ksysguard/ksysguardd/OpenBSD/ProcessList.c Fri Jul 8 11:40:10 2011
|
||||
@@ -155,7 +155,7 @@ findProcessInList(int pid)
|
||||
}
|
||||
|
||||
static void
|
||||
-fillProcessCmdline(char *cmdline, struct kinfo_proc2 *p, size_t maxlen)
|
||||
+fillProcessCmdline(char *cmdline, struct kinfo_proc *p, size_t maxlen)
|
||||
{
|
||||
int mib[4];
|
||||
int ret = -1;
|
||||
@@ -204,7 +204,7 @@ fillProcessCmdline(char *cmdline, struct kinfo_proc2 *
|
||||
}
|
||||
|
||||
static int
|
||||
-updateProcess(struct kinfo_proc2 *p)
|
||||
+updateProcess(struct kinfo_proc *p)
|
||||
{
|
||||
static const char * const statuses[] = { "idle","run","sleep","stop","zombie" };
|
||||
|
||||
@@ -317,14 +317,14 @@ updateProcessList(void)
|
||||
int mib[6];
|
||||
size_t len;
|
||||
size_t num;
|
||||
- struct kinfo_proc2 *p;
|
||||
+ struct kinfo_proc *p;
|
||||
|
||||
|
||||
mib[0] = CTL_KERN;
|
||||
- mib[1] = KERN_PROC2;
|
||||
+ mib[1] = KERN_PROC;
|
||||
mib[2] = KERN_PROC_ALL;
|
||||
mib[3] = 0;
|
||||
- mib[4] = sizeof(struct kinfo_proc2);
|
||||
+ mib[4] = sizeof(struct kinfo_proc);
|
||||
mib[5] = 0;
|
||||
if (sysctl(mib, 6, NULL, &len, NULL, 0) == -1)
|
||||
return 0;
|
||||
@@ -332,11 +332,11 @@ updateProcessList(void)
|
||||
p = malloc(len);
|
||||
if (!p)
|
||||
return 0;
|
||||
- mib[5] = len/ sizeof(struct kinfo_proc2);
|
||||
+ mib[5] = len/ sizeof(struct kinfo_proc);
|
||||
if (sysctl(mib, 6, p, &len, NULL, 0) == -1)
|
||||
return 0;
|
||||
|
||||
- for (num = 0; num < len / sizeof(struct kinfo_proc2); num++)
|
||||
+ for (num = 0; num < len / sizeof(struct kinfo_proc); num++)
|
||||
updateProcess(&p[num]);
|
||||
free(p);
|
||||
cleanupProcessList();
|
@ -1,16 +1,7 @@
|
||||
$OpenBSD: patch-libs_ksysguard_processcore_processes_openbsd_p_cpp,v 1.2 2010/06/18 18:15:51 espie Exp $
|
||||
--- libs/ksysguard/processcore/processes_openbsd_p.cpp.orig Fri Jun 18 15:39:01 2010
|
||||
+++ libs/ksysguard/processcore/processes_openbsd_p.cpp Fri Jun 18 15:44:23 2010
|
||||
@@ -37,6 +37,8 @@
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
+#define kinfo_proc2 kinfo_proc
|
||||
+#define KERN_PROC KERN_PROC2
|
||||
|
||||
|
||||
|
||||
@@ -284,6 +286,7 @@ long long ProcessesLocal::totalPhysicalMemory() {
|
||||
$OpenBSD: patch-libs_ksysguard_processcore_processes_openbsd_p_cpp,v 1.3 2011/07/08 10:27:23 dcoppa Exp $
|
||||
--- libs/ksysguard/processcore/processes_openbsd_p.cpp.orig Fri Feb 26 19:32:17 2010
|
||||
+++ libs/ksysguard/processcore/processes_openbsd_p.cpp Fri Jul 8 11:33:44 2011
|
||||
@@ -284,6 +284,7 @@ long long ProcessesLocal::totalPhysicalMemory() {
|
||||
return Total /= 1024;
|
||||
}
|
||||
|
||||
@ -18,7 +9,7 @@ $OpenBSD: patch-libs_ksysguard_processcore_processes_openbsd_p_cpp,v 1.2 2010/06
|
||||
long int KSysGuard::ProcessesLocal::numberProcessorCores()
|
||||
{
|
||||
int mib[2];
|
||||
@@ -298,6 +301,8 @@ long int KSysGuard::ProcessesLocal::numberProcessorCor
|
||||
@@ -298,6 +299,8 @@ long int KSysGuard::ProcessesLocal::numberProcessorCor
|
||||
return 1;
|
||||
return len;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user