Great !!! It's working on my FreeBSD 3.0 machine now ... !!!
This commit is contained in:
@@ -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>
|
1998-11-11 Martin Baulig <martin@home-of-linux.org>
|
||||||
|
|
||||||
* *.c: It does not work to get information about the swapper task
|
* *.c: It does not work to get information about the swapper task
|
||||||
|
@@ -28,6 +28,11 @@
|
|||||||
#include <net/if.h>
|
#include <net/if.h>
|
||||||
#include <net/if_dl.h>
|
#include <net/if_dl.h>
|
||||||
#include <net/if_types.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.h>
|
||||||
#include <netinet/in_var.h>
|
#include <netinet/in_var.h>
|
||||||
|
|
||||||
@@ -102,7 +107,11 @@ glibtop_get_netload_p (glibtop *server, glibtop_netload *buf,
|
|||||||
tname, 16) != 16))
|
tname, 16) != 16))
|
||||||
glibtop_error_io_r (server, "kvm_read (ifnetaddr)");
|
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;
|
ifaddraddr = (u_long) ifnet.if_addrlist;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ifaddraddr) {
|
if (ifaddraddr) {
|
||||||
@@ -171,10 +180,18 @@ glibtop_get_netload_p (glibtop *server, glibtop_netload *buf,
|
|||||||
buf->flags = _glibtop_sysdeps_netload;
|
buf->flags = _glibtop_sysdeps_netload;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if (defined __FreeBSD__) && (__FreeBSD_version >= 300000)
|
||||||
|
ifaddraddr = (u_long)ifaddr.ifa.ifa_link.tqe_next;
|
||||||
|
#else
|
||||||
ifaddraddr = (u_long)ifaddr.ifa.ifa_next;
|
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;
|
ifnetaddr = (u_long) ifnet.if_next;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -29,6 +29,11 @@
|
|||||||
|
|
||||||
#include <net/if.h>
|
#include <net/if.h>
|
||||||
#include <net/if_types.h>
|
#include <net/if_types.h>
|
||||||
|
|
||||||
|
#ifdef HAVE_NET_IF_VAR_H
|
||||||
|
#include <net/if_var.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <net/netisr.h>
|
#include <net/netisr.h>
|
||||||
#include <net/route.h>
|
#include <net/route.h>
|
||||||
|
|
||||||
|
@@ -142,12 +142,18 @@ glibtop_get_proc_kernel_p (glibtop *server,
|
|||||||
(unsigned long) &u_addr->u_pcb,
|
(unsigned long) &u_addr->u_pcb,
|
||||||
(char *) &pcb, sizeof (pcb)) == sizeof (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_esp = (u_int64_t) pcb.pcb_ksp;
|
||||||
buf->kstk_eip = (u_int64_t) pcb.pcb_pc;
|
buf->kstk_eip = (u_int64_t) pcb.pcb_pc;
|
||||||
|
|
||||||
buf->flags |= _glibtop_sysdeps_proc_kernel_pcb;
|
buf->flags |= _glibtop_sysdeps_proc_kernel_pcb;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Taken from `wchan ()' in `/usr/src/bin/ps/print.c'. */
|
/* Taken from `wchan ()' in `/usr/src/bin/ps/print.c'. */
|
||||||
|
@@ -71,6 +71,14 @@ calcru(p, up, sp, ip)
|
|||||||
tot = 1;
|
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;
|
sec = p->p_rtime.tv_sec;
|
||||||
usec = p->p_rtime.tv_usec;
|
usec = p->p_rtime.tv_usec;
|
||||||
|
|
||||||
@@ -81,6 +89,8 @@ calcru(p, up, sp, ip)
|
|||||||
(long)totusec);
|
(long)totusec);
|
||||||
totusec = 0;
|
totusec = 0;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
u = totusec;
|
u = totusec;
|
||||||
st = (u * st) / tot;
|
st = (u * st) / tot;
|
||||||
@@ -161,7 +171,11 @@ glibtop_get_proc_time_p (glibtop *server, glibtop_proc_time *buf,
|
|||||||
|
|
||||||
glibtop_suid_leave (server);
|
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);
|
buf->rtime = tv2sec (pinfo [0].kp_proc.p_rtime);
|
||||||
|
#endif
|
||||||
|
|
||||||
buf->frequency = 1000000;
|
buf->frequency = 1000000;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user