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.9 2008/09/08 12:58:09 adam Exp $
--- agent/mibgroup/host/hr_swrun.c.orig 2008-08-22 02:18:50.000000000 +0200
+++ agent/mibgroup/host/hr_swrun.c
@@ -599,6 +599,8 @@ var_hrswrun(struct variable * vp,
#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 @@ var_hrswrun(struct variable * vp,
#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
@@ -929,11 +933,17 @@ var_hrswrun(struct variable * vp,
} 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
@@ -970,6 +980,8 @@ var_hrswrun(struct variable * vp,
#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
@@ -1077,6 +1089,14 @@ var_hrswrun(struct variable * vp,
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 +
@@ -1169,6 +1189,8 @@ var_hrswrun(struct variable * vp,
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
@@ -1489,6 +1511,9 @@ Get_Next_HR_SWRun(void)
#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;
|