2003-08-16 08:53:52 +00:00
|
|
|
--- agent/mibgroup/host/hr_swrun.c.orig Fri Dec 20 00:07:30 2002
|
|
|
|
+++ agent/mibgroup/host/hr_swrun.c Sat Aug 16 17:10:54 2003
|
|
|
|
@@ -561,7 +561,11 @@
|
|
|
|
string[ sizeof(string)-1 ] = 0;
|
2001-02-02 01:18:45 +00:00
|
|
|
#endif
|
|
|
|
#elif HAVE_KVM_GETPROCS
|
|
|
|
+#if defined(freebsd5) && __FreeBSD_version >= 500014
|
|
|
|
+ strcpy(string, proc_table[LowProcIndex].ki_comm);
|
|
|
|
+#else
|
2002-05-15 06:41:00 +00:00
|
|
|
strcpy(string, proc_table[LowProcIndex].kp_proc.p_comm);
|
2001-02-02 01:18:45 +00:00
|
|
|
+#endif
|
|
|
|
#elif defined(linux)
|
2002-05-15 06:41:00 +00:00
|
|
|
sprintf(string, "/proc/%d/status", pid);
|
|
|
|
if ((fp = fopen(string, "r")) == NULL)
|
2003-08-16 08:53:52 +00:00
|
|
|
@@ -666,7 +670,11 @@
|
2002-05-15 06:41:00 +00:00
|
|
|
*cp1 = 0;
|
2001-02-02 01:18:45 +00:00
|
|
|
#endif
|
|
|
|
#elif HAVE_KVM_GETPROCS
|
|
|
|
+#if defined(freebsd5) && __FreeBSD_version >= 500014
|
|
|
|
+ strcpy(string, proc_table[LowProcIndex].ki_comm);
|
|
|
|
+#else
|
2002-05-15 06:41:00 +00:00
|
|
|
strcpy(string, proc_table[LowProcIndex].kp_proc.p_comm);
|
2001-02-02 01:18:45 +00:00
|
|
|
+#endif
|
|
|
|
#elif defined(linux)
|
2002-05-15 06:41:00 +00:00
|
|
|
sprintf(string, "/proc/%d/cmdline", pid);
|
|
|
|
if ((fp = fopen(string, "r")) == NULL)
|
2003-08-16 08:53:52 +00:00
|
|
|
@@ -857,7 +865,11 @@
|
2002-05-15 06:41:00 +00:00
|
|
|
}
|
2001-02-02 01:18:45 +00:00
|
|
|
#else
|
|
|
|
#if HAVE_KVM_GETPROCS
|
|
|
|
+#if defined(freebsd5) && __FreeBSD_version >= 500014
|
|
|
|
+ switch ( proc_table[LowProcIndex].ki_stat ) {
|
|
|
|
+#else
|
2002-05-15 06:41:00 +00:00
|
|
|
switch (proc_table[LowProcIndex].kp_proc.p_stat) {
|
2001-02-02 01:18:45 +00:00
|
|
|
+#endif
|
2002-04-09 00:31:17 +00:00
|
|
|
#elif defined(dynix)
|
2002-05-15 06:41:00 +00:00
|
|
|
switch (lowpsinfo.pr_state) {
|
2001-02-02 01:18:45 +00:00
|
|
|
#elif defined(solaris2)
|
2003-08-16 08:53:52 +00:00
|
|
|
@@ -952,9 +964,17 @@
|
2002-05-15 06:41:00 +00:00
|
|
|
long_return = proc_buf->p_utime * 100 + proc_buf->p_stime * 100;
|
2001-02-02 01:18:45 +00:00
|
|
|
#endif
|
|
|
|
#elif HAVE_KVM_GETPROCS
|
|
|
|
+#if defined(freebsd5) && __FreeBSD_version >= 500014
|
2001-02-02 02:39:45 +00:00
|
|
|
+ /* XXX: Accessing ki_paddr causes sig10 ...
|
2001-02-02 01:18:45 +00:00
|
|
|
+ long_return = proc_table[LowProcIndex].ki_paddr->p_uticks +
|
|
|
|
+ proc_table[LowProcIndex].ki_paddr->p_sticks +
|
2001-02-02 02:39:45 +00:00
|
|
|
+ proc_table[LowProcIndex].ki_paddr->p_iticks; */
|
|
|
|
+ long_return = 0;
|
2001-02-02 01:18:45 +00:00
|
|
|
+#else
|
2002-05-15 06:41:00 +00:00
|
|
|
long_return = proc_table[LowProcIndex].kp_proc.p_uticks +
|
|
|
|
proc_table[LowProcIndex].kp_proc.p_sticks +
|
|
|
|
proc_table[LowProcIndex].kp_proc.p_iticks;
|
2001-02-02 01:18:45 +00:00
|
|
|
+#endif
|
|
|
|
#elif defined(linux)
|
2002-05-15 06:41:00 +00:00
|
|
|
sprintf(string, "/proc/%d/stat", pid);
|
|
|
|
if ((fp = fopen(string, "r")) == NULL)
|
2003-08-16 08:53:52 +00:00
|
|
|
@@ -1023,7 +1043,14 @@
|
|
|
|
long_return = proc_buf->p_swrss;
|
|
|
|
#endif
|
|
|
|
#elif HAVE_KVM_GETPROCS
|
|
|
|
-#if defined(freebsd3) && !defined(darwin)
|
|
|
|
+#if defined(freebsd5) && __FreeBSD_version >= 500014
|
2001-02-02 02:39:45 +00:00
|
|
|
+ /* XXX
|
2001-02-02 01:18:45 +00:00
|
|
|
+ long_return = proc_table[LowProcIndex].ki_vmspace->vm_tsize +
|
|
|
|
+ proc_table[LowProcIndex].ki_vmspace->vm_ssize +
|
|
|
|
+ proc_table[LowProcIndex].ki_vmspace->vm_dsize;
|
2001-02-02 02:39:45 +00:00
|
|
|
+ long_return = long_return * (getpagesize() / 1024); */
|
|
|
|
+ long_return = 0;
|
2003-08-16 08:53:52 +00:00
|
|
|
+#elif defined(freebsd3) && !defined(darwin)
|
|
|
|
long_return =
|
|
|
|
proc_table[LowProcIndex].kp_eproc.e_vm.vm_map.size / 1024;
|
2001-02-02 01:18:45 +00:00
|
|
|
#else
|
2003-08-16 08:53:52 +00:00
|
|
|
@@ -1303,8 +1330,13 @@
|
2001-02-02 01:18:45 +00:00
|
|
|
#elif defined(solaris2)
|
2002-05-15 06:41:00 +00:00
|
|
|
return proc_table[current_proc_entry++];
|
2001-02-02 01:18:45 +00:00
|
|
|
#elif HAVE_KVM_GETPROCS
|
|
|
|
+#if defined(freebsd5) && __FreeBSD_version >= 500014
|
|
|
|
+ if ( proc_table[current_proc_entry].ki_stat != 0 )
|
|
|
|
+ return proc_table[current_proc_entry++].ki_pid;
|
|
|
|
+#else
|
2002-05-15 06:41:00 +00:00
|
|
|
if (proc_table[current_proc_entry].kp_proc.p_stat != 0)
|
|
|
|
return proc_table[current_proc_entry++].kp_proc.p_pid;
|
2001-02-02 01:18:45 +00:00
|
|
|
+#endif
|
|
|
|
#else
|
2002-05-15 06:41:00 +00:00
|
|
|
if (proc_table[current_proc_entry].p_stat != 0)
|
|
|
|
return proc_table[current_proc_entry++].p_pid;
|