1 |
|
/* |
2 |
|
* i-scream central monitoring system |
3 |
< |
* http://www.i-scream.org.uk |
4 |
< |
* Copyright (C) 2000-2002 i-scream |
3 |
> |
* http://www.i-scream.org |
4 |
> |
* Copyright (C) 2000-2003 i-scream |
5 |
|
* |
6 |
|
* This program is free software; you can redistribute it and/or |
7 |
|
* modify it under the terms of the GNU General Public License |
142 |
|
kp_stats=kvm_getprocs(kvmd, KERN_PROC_ALL, 0, &procs); |
143 |
|
|
144 |
|
while(procs--){ |
145 |
+ |
#ifdef FREEBSD5 |
146 |
+ |
if (kp_stats[procs].ki_stat == SSLEEP) process_stat.sleeping++; |
147 |
+ |
if (kp_stats[procs].ki_stat == SRUN) process_stat.running++; |
148 |
+ |
if (kp_stats[procs].ki_stat == SIDL) process_stat.running++; |
149 |
+ |
if (kp_stats[procs].ki_stat == SZOMB) process_stat.zombie++; |
150 |
+ |
if (kp_stats[procs].ki_stat == SSTOP) process_stat.stopped++; |
151 |
+ |
#else |
152 |
|
if (kp_stats[procs].kp_proc.p_stat == SSLEEP) process_stat.sleeping++; |
153 |
|
if (kp_stats[procs].kp_proc.p_stat == SRUN) process_stat.running++; |
154 |
|
if (kp_stats[procs].kp_proc.p_stat == SIDL) process_stat.running++; |
155 |
|
if (kp_stats[procs].kp_proc.p_stat == SZOMB) process_stat.zombie++; |
156 |
|
if (kp_stats[procs].kp_proc.p_stat == SSTOP) process_stat.stopped++; |
157 |
+ |
process_stat.total++; |
158 |
+ |
#endif |
159 |
|
} |
160 |
|
|
161 |
|
kvm_close(kvmd); |
162 |
|
#endif |
163 |
|
|
164 |
+ |
#ifndef FREEBSD5 |
165 |
|
process_stat.total=process_stat.sleeping+process_stat.running+process_stat.zombie+process_stat.stopped; |
166 |
+ |
#endif |
167 |
+ |
|
168 |
|
return &process_stat; |
169 |
|
} |