diff options
author | Martin Baulig <martin@home-of-linux.org> | 1999-02-21 14:23:09 +0000 |
---|---|---|
committer | Martin Baulig <martin@src.gnome.org> | 1999-02-21 14:23:09 +0000 |
commit | d379bb6acbd7d385d43f67fe61ee6d9fa2831f22 (patch) | |
tree | 1e32dd930b94fca9714e77c0fb1d7a88f972846d | |
parent | 3ad9e069094efed609eecbb5591a9b3ab31ca11c (diff) | |
download | libgtop-d379bb6acbd7d385d43f67fe61ee6d9fa2831f22.tar.gz |
Applied patch from the FreeBSD 2.2.8 ports collection.
1999-02-21 Martin Baulig <martin@home-of-linux.org>
* prockernel.c, proctime.c: Applied patch from the FreeBSD 2.2.8
ports collection.
-rw-r--r-- | sysdeps/freebsd/ChangeLog | 3 | ||||
-rw-r--r-- | sysdeps/freebsd/prockernel.c | 16 | ||||
-rw-r--r-- | sysdeps/freebsd/proctime.c | 13 |
3 files changed, 19 insertions, 13 deletions
diff --git a/sysdeps/freebsd/ChangeLog b/sysdeps/freebsd/ChangeLog index 9c99977d..222a1f15 100644 --- a/sysdeps/freebsd/ChangeLog +++ b/sysdeps/freebsd/ChangeLog @@ -1,5 +1,8 @@ 1999-02-21 Martin Baulig <martin@home-of-linux.org> + * prockernel.c, proctime.c: Applied patch from the FreeBSD 2.2.8 + ports collection. + * procmap.c, procmem.c: Applied patch from Jeremy Lea; this patch is also included in the FreeBSD-current ports collection. diff --git a/sysdeps/freebsd/prockernel.c b/sysdeps/freebsd/prockernel.c index 7bc1e248..34728198 100644 --- a/sysdeps/freebsd/prockernel.c +++ b/sysdeps/freebsd/prockernel.c @@ -39,6 +39,7 @@ #include <unistd.h> #include <fcntl.h> +#include <osreldate.h> static const unsigned long _glibtop_sysdeps_proc_kernel_pstats = (1 << GLIBTOP_PROC_KERNEL_MIN_FLT) + @@ -146,17 +147,14 @@ glibtop_get_proc_kernel_p (glibtop *server, (unsigned long) &u_addr->u_pcb, (char *) &pcb, sizeof (pcb)) == sizeof (pcb)) { -#if (defined __FreeBSD__) && (__FreeBSD_version >= 300000) - - /* Sorry, don't know how to get it for - * FreeBSD 3.0 at the moment. - */ - -#elif (defined __FreeBSD__) +#ifdef __FreeBSD__ +#if (__FreeBSD_version >= 300003) + buf->kstk_esp = (u_int64_t) pcb.pcb_esp; + buf->kstk_eip = (u_int64_t) pcb.pcb_eip; +#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 #else buf->kstk_esp = (u_int64_t) pcb.pcb_tss.tss_esp0; buf->kstk_eip = (u_int64_t) pcb.pcb_tss.__tss_eip; diff --git a/sysdeps/freebsd/proctime.c b/sysdeps/freebsd/proctime.c index 5b9afc8c..dac2934a 100644 --- a/sysdeps/freebsd/proctime.c +++ b/sysdeps/freebsd/proctime.c @@ -19,6 +19,7 @@ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#include <osreldate.h> #include <glibtop.h> #include <glibtop/error.h> #include <glibtop/proctime.h> @@ -59,7 +60,10 @@ calcru(p, up, sp, ip) { quad_t totusec; u_quad_t u, st, ut, it, tot; - long sec, usec; +#if (__FreeBSD_version < 300003) + long sec, usec; +#endif + struct timeval tv; st = p->p_sticks; ut = p->p_uticks; @@ -71,7 +75,7 @@ calcru(p, up, sp, ip) tot = 1; } -#if (defined __FreeBSD__) && (__FreeBSD_version >= 300000) +#if (defined __FreeBSD__) && (__FreeBSD_version >= 300003) /* This was changed from a `struct timeval' into a `u_int64_t' * on FreeBSD 3.0 and renamed p_rtime -> p_runtime. @@ -83,13 +87,14 @@ calcru(p, up, sp, ip) usec = p->p_rtime.tv_usec; totusec = (quad_t)sec * 1000000 + usec; +#endif + if (totusec < 0) { /* XXX no %qd in kernel. Truncate. */ fprintf (stderr, "calcru: negative time: %ld usec\n", (long)totusec); totusec = 0; } -#endif u = totusec; @@ -171,7 +176,7 @@ glibtop_get_proc_time_p (glibtop *server, glibtop_proc_time *buf, glibtop_suid_leave (server); -#if (defined __FreeBSD__) && (__FreeBSD_version >= 300000) +#if (defined __FreeBSD__) && (__FreeBSD_version >= 300003) buf->rtime = pinfo [0].kp_proc.p_runtime; #else buf->rtime = tv2sec (pinfo [0].kp_proc.p_rtime); |