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.
This commit is contained in:
committed by
Martin Baulig
parent
3ad9e06909
commit
d379bb6acb
@@ -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.
|
||||
|
||||
|
@@ -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;
|
||||
|
@@ -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);
|
||||
|
Reference in New Issue
Block a user