Great !!! It's working on my FreeBSD 3.0 machine now ... !!!

This commit is contained in:
Martin Baulig
1998-11-17 23:15:12 +00:00
parent 92f1bf261c
commit 7a0a779311
5 changed files with 49 additions and 3 deletions

View File

@@ -1,3 +1,7 @@
1998-11-17 Martin Baulig <martin@home-of-linux.org>
* Make it work with FreeBSD 3.0.
1998-11-11 Martin Baulig <martin@home-of-linux.org>
* *.c: It does not work to get information about the swapper task

View File

@@ -28,6 +28,11 @@
#include <net/if.h>
#include <net/if_dl.h>
#include <net/if_types.h>
#ifdef HAVE_NET_IF_VAR_H
#include <net/if_var.h>
#endif
#include <netinet/in.h>
#include <netinet/in_var.h>
@@ -102,7 +107,11 @@ glibtop_get_netload_p (glibtop *server, glibtop_netload *buf,
tname, 16) != 16))
glibtop_error_io_r (server, "kvm_read (ifnetaddr)");
#if (defined __FreeBSD__) && (__FreeBSD_version >= 300000)
ifaddraddr = (u_long) ifnet.if_addrhead.tqh_first;
#else
ifaddraddr = (u_long) ifnet.if_addrlist;
#endif
}
if (ifaddraddr) {
@@ -172,9 +181,17 @@ glibtop_get_netload_p (glibtop *server, glibtop_netload *buf,
return;
}
#if (defined __FreeBSD__) && (__FreeBSD_version >= 300000)
ifaddraddr = (u_long)ifaddr.ifa.ifa_link.tqe_next;
#else
ifaddraddr = (u_long)ifaddr.ifa.ifa_next;
#endif
}
#if (defined __FreeBSD__) && (__FreeBSD_version >= 300000)
ifnetaddr = (u_long) ifnet.if_link.tqe_next;
#else
ifnetaddr = (u_long) ifnet.if_next;
#endif
}
}

View File

@@ -29,6 +29,11 @@
#include <net/if.h>
#include <net/if_types.h>
#ifdef HAVE_NET_IF_VAR_H
#include <net/if_var.h>
#endif
#include <net/netisr.h>
#include <net/route.h>

View File

@@ -142,12 +142,18 @@ glibtop_get_proc_kernel_p (glibtop *server,
(unsigned long) &u_addr->u_pcb,
(char *) &pcb, sizeof (pcb)) == sizeof (pcb))
{
/* Same like with pstats above. */
#if (defined __FreeBSD__) && (__FreeBSD_version >= 300000)
/* Sorry, don't know how to get it for
* FreeBSD 3.0 at the moment.
*/
#else
buf->kstk_esp = (u_int64_t) pcb.pcb_ksp;
buf->kstk_eip = (u_int64_t) pcb.pcb_pc;
buf->flags |= _glibtop_sysdeps_proc_kernel_pcb;
#endif
}
/* Taken from `wchan ()' in `/usr/src/bin/ps/print.c'. */

View File

@@ -71,6 +71,14 @@ calcru(p, up, sp, ip)
tot = 1;
}
#if (defined __FreeBSD__) && (__FreeBSD_version >= 300000)
/* This was changed from a `struct timeval' into a `u_int64_t'
* on FreeBSD 3.0 and renamed p_rtime -> p_runtime.
*/
totusec = (u_quad_t) p->p_runtime;
#else
sec = p->p_rtime.tv_sec;
usec = p->p_rtime.tv_usec;
@@ -81,6 +89,8 @@ calcru(p, up, sp, ip)
(long)totusec);
totusec = 0;
}
#endif
u = totusec;
st = (u * st) / tot;
@@ -161,7 +171,11 @@ glibtop_get_proc_time_p (glibtop *server, glibtop_proc_time *buf,
glibtop_suid_leave (server);
#if (defined __FreeBSD__) && (__FreeBSD_version >= 300000)
buf->rtime = pinfo [0].kp_proc.p_runtime;
#else
buf->rtime = tv2sec (pinfo [0].kp_proc.p_rtime);
#endif
buf->frequency = 1000000;