summaryrefslogtreecommitdiff
path: root/sysutils/libgtop/patches/patch-aj
blob: 35d410bd6bbe4915ad4cb9f449b5a7427399cfac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
$NetBSD: patch-aj,v 1.4 2007/11/05 19:06:04 drochner Exp $

--- sysdeps/bsd/proclist.c.orig	2007-05-19 20:59:37.000000000 +0200
+++ sysdeps/bsd/proclist.c
@@ -56,11 +56,15 @@ _glibtop_init_proclist_p (glibtop *serve
 	server->sysdeps.proclist = _glibtop_sysdeps_proclist;
 }
 
-unsigned *
+pid_t *
 glibtop_get_proclist_p (glibtop *server, glibtop_proclist *buf,
 			gint64 real_which, gint64 arg)
 {
+#if defined(__NetBSD__)
+	struct kinfo_proc2 *pinfo;
+#else
 	struct kinfo_proc *pinfo;
+#endif
 	unsigned *pids = NULL;
 	int which, count;
 	int i,j;
@@ -72,7 +76,12 @@ glibtop_get_proclist_p (glibtop *server,
 	which = (int)(real_which & GLIBTOP_KERN_PROC_MASK);
 
 	/* Get the process data */
+#if defined(__NetBSD__)
+	pinfo = kvm_getproc2 (server->machine.kd, which, arg,
+			      sizeof (*pinfo), &count);
+#else
 	pinfo = kvm_getprocs (server->machine.kd, which, arg, &count);
+#endif
 	if ((pinfo == NULL) || (count < 1)) {
 		glibtop_warn_io_r (server, "kvm_getprocs (proclist)");
 		return NULL;
@@ -89,6 +98,12 @@ glibtop_get_proclist_p (glibtop *server,
 #define PROC_RUID	ki_ruid
 #define PROC_PID	ki_pid
 
+#elif defined(__NetBSD__)
+
+#define PROC_STAT	p_stat
+#define PROC_RUID	p_ruid
+#define PROC_PID	p_pid
+
 #else
 #define PROC_STAT	kp_proc.p_stat
 #define PROC_RUID	kp_eproc.e_pcred.p_ruid