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
|
$NetBSD: patch-an,v 1.4 2007/11/05 19:06:05 drochner Exp $
--- sysdeps/bsd/procstate.c.orig 2007-04-27 00:27:34.000000000 +0200
+++ sysdeps/bsd/procstate.c
@@ -54,7 +54,11 @@ glibtop_get_proc_state_p (glibtop *serve
glibtop_proc_state *buf,
pid_t pid)
{
+#if defined(__NetBSD__)
+ struct kinfo_proc2 *pinfo;
+#else
struct kinfo_proc *pinfo;
+#endif
int count = 0;
glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_PROC_STATE), 0);
@@ -65,7 +69,12 @@ glibtop_get_proc_state_p (glibtop *serve
if (pid == 0) return;
/* Get the process information */
+#if defined(__NetBSD__)
+ pinfo = kvm_getproc2 (server->machine.kd, KERN_PROC_PID, pid,
+ sizeof (*pinfo), &count);
+#else
pinfo = kvm_getprocs (server->machine.kd, KERN_PROC_PID, pid, &count);
+#endif
if ((pinfo == NULL) || (count != 1)) {
glibtop_warn_io_r (server, "kvm_getprocs (%d)", pid);
return;
@@ -79,6 +88,13 @@ glibtop_get_proc_state_p (glibtop *serve
#define PROC_RGID ki_rgid
#define PROC_STAT ki_stat
+#elif defined(__NetBSD__)
+
+#define PROC_COMM p_comm
+#define PROC_SVUID p_svuid
+#define PROC_SVGID p_svgid
+#define PROC_STAT p_stat
+
#else
#define PROC_COMM kp_proc.p_comm
#define PROC_SVUID kp_eproc.e_pcred.p_svuid
|