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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
$NetBSD: patch-am,v 1.8 2008/07/15 09:14:01 adam Exp $
--- agent/mibgroup/host/hr_swrun.c.orig 2007-04-02 16:51:34 +0300
+++ agent/mibgroup/host/hr_swrun.c 2007-09-12 21:41:48 +0300
@@ -599,6 +599,8 @@
#elif HAVE_KVM_GETPROCS
#if defined(freebsd5) && __FreeBSD_version >= 500014
strcpy(string, proc_table[LowProcIndex].ki_comm);
+ #elif defined(dragonfly) && __DragonFly_version >= 190000
+ strcpy(string, proc_table[LowProcIndex].kp_comm);
#else
strcpy(string, proc_table[LowProcIndex].kp_proc.p_comm);
#endif
@@ -722,6 +724,8 @@
#elif HAVE_KVM_GETPROCS
#if defined(freebsd5) && __FreeBSD_version >= 500014
strcpy(string, proc_table[LowProcIndex].ki_comm);
+ #elif defined(dragonfly) && __DragonFly_version >= 190000
+ strcpy(string, proc_table[LowProcIndex].kp_comm);
#else
strcpy(string, proc_table[LowProcIndex].kp_proc.p_comm);
#endif
@@ -921,11 +925,17 @@
} else
long_return = 4; /* application */
#else
+ #if defined(dragonfly) && __DragonFly_version >= 190000
+ if (proc_table[LowProcIndex].kp_flags & P_SYSTEM)
+ #else
if (proc_table[LowProcIndex].kp_proc.p_flag & P_SYSTEM)
+ #endif
long_return = 2; /* operatingSystem */
else
long_return = 4; /* application */
#endif
+#elif defined darwin
+ long_return = -1;
#else
long_return = 4; /* application */
#endif
@@ -962,6 +972,8 @@
#if HAVE_KVM_GETPROCS
#if defined(freebsd5) && __FreeBSD_version >= 500014
switch (proc_table[LowProcIndex].ki_stat) {
+ #elif defined(dragonfly) && __DragonFly_version >= 190000
+ switch (proc_table[LowProcIndex].kp_stat) {
#else
switch (proc_table[LowProcIndex].kp_proc.p_stat) {
#endif
@@ -1069,6 +1081,14 @@
long_return = 0;
#elif defined(freebsd5)
long_return = proc_table[LowProcIndex].ki_runtime / 100000;
+ #elif defined(dragonfly) && __DragonFly_version >= 190000
+ long_return = proc_table[LowProcIndex].kp_lwp.kl_uticks +
+ proc_table[LowProcIndex].kp_lwp.kl_sticks +
+ proc_table[LowProcIndex].kp_lwp.kl_iticks;
+ #elif defined(dragonfly)
+ long_return = proc_table[LowProcIndex].kp_eproc.e_uticks +
+ proc_table[LowProcIndex].kp_eproc.e_sticks +
+ proc_table[LowProcIndex].kp_eproc.e_iticks;
#else
long_return = proc_table[LowProcIndex].kp_proc.p_uticks +
proc_table[LowProcIndex].kp_proc.p_sticks +
@@ -1157,6 +1177,8 @@
long_return =
#if defined(freebsd5)
proc_table[LowProcIndex].ki_size / 1024;
+ #elif defined(dragonfly) && __DragonFly_version >= 190000
+ proc_table[LowProcIndex].kp_vm_map_size / 1024;
#else
proc_table[LowProcIndex].kp_eproc.e_vm.vm_map.size / 1024;
#endif
@@ -1477,6 +1499,9 @@
#if defined(freebsd5) && __FreeBSD_version >= 500014
if (proc_table[current_proc_entry].ki_stat != 0)
return proc_table[current_proc_entry++].ki_pid;
+ #elif defined(dragonfly) && __DragonFly_version >= 190000
+ if (proc_table[current_proc_entry].kp_stat != 0)
+ return proc_table[current_proc_entry++].kp_pid;
#else
if (proc_table[current_proc_entry].kp_proc.p_stat != 0)
return proc_table[current_proc_entry++].kp_proc.p_pid;
|