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>
|
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
|
* procmap.c, procmem.c: Applied patch from Jeremy Lea; this
|
||||||
patch is also included in the FreeBSD-current ports collection.
|
patch is also included in the FreeBSD-current ports collection.
|
||||||
|
|
||||||
|
@@ -39,6 +39,7 @@
|
|||||||
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
#include <osreldate.h>
|
||||||
|
|
||||||
static const unsigned long _glibtop_sysdeps_proc_kernel_pstats =
|
static const unsigned long _glibtop_sysdeps_proc_kernel_pstats =
|
||||||
(1 << GLIBTOP_PROC_KERNEL_MIN_FLT) +
|
(1 << GLIBTOP_PROC_KERNEL_MIN_FLT) +
|
||||||
@@ -146,17 +147,14 @@ 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))
|
||||||
{
|
{
|
||||||
#if (defined __FreeBSD__) && (__FreeBSD_version >= 300000)
|
#ifdef __FreeBSD__
|
||||||
|
#if (__FreeBSD_version >= 300003)
|
||||||
/* Sorry, don't know how to get it for
|
buf->kstk_esp = (u_int64_t) pcb.pcb_esp;
|
||||||
* FreeBSD 3.0 at the moment.
|
buf->kstk_eip = (u_int64_t) pcb.pcb_eip;
|
||||||
*/
|
#else
|
||||||
|
|
||||||
#elif (defined __FreeBSD__)
|
|
||||||
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;
|
||||||
|
#endif
|
||||||
buf->flags |= _glibtop_sysdeps_proc_kernel_pcb;
|
|
||||||
#else
|
#else
|
||||||
buf->kstk_esp = (u_int64_t) pcb.pcb_tss.tss_esp0;
|
buf->kstk_esp = (u_int64_t) pcb.pcb_tss.tss_esp0;
|
||||||
buf->kstk_eip = (u_int64_t) pcb.pcb_tss.__tss_eip;
|
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,
|
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
Boston, MA 02111-1307, USA. */
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
|
#include <osreldate.h>
|
||||||
#include <glibtop.h>
|
#include <glibtop.h>
|
||||||
#include <glibtop/error.h>
|
#include <glibtop/error.h>
|
||||||
#include <glibtop/proctime.h>
|
#include <glibtop/proctime.h>
|
||||||
@@ -59,7 +60,10 @@ calcru(p, up, sp, ip)
|
|||||||
{
|
{
|
||||||
quad_t totusec;
|
quad_t totusec;
|
||||||
u_quad_t u, st, ut, it, tot;
|
u_quad_t u, st, ut, it, tot;
|
||||||
|
#if (__FreeBSD_version < 300003)
|
||||||
long sec, usec;
|
long sec, usec;
|
||||||
|
#endif
|
||||||
|
struct timeval tv;
|
||||||
|
|
||||||
st = p->p_sticks;
|
st = p->p_sticks;
|
||||||
ut = p->p_uticks;
|
ut = p->p_uticks;
|
||||||
@@ -71,7 +75,7 @@ calcru(p, up, sp, ip)
|
|||||||
tot = 1;
|
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'
|
/* This was changed from a `struct timeval' into a `u_int64_t'
|
||||||
* on FreeBSD 3.0 and renamed p_rtime -> p_runtime.
|
* 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;
|
usec = p->p_rtime.tv_usec;
|
||||||
|
|
||||||
totusec = (quad_t)sec * 1000000 + usec;
|
totusec = (quad_t)sec * 1000000 + usec;
|
||||||
|
#endif
|
||||||
|
|
||||||
if (totusec < 0) {
|
if (totusec < 0) {
|
||||||
/* XXX no %qd in kernel. Truncate. */
|
/* XXX no %qd in kernel. Truncate. */
|
||||||
fprintf (stderr, "calcru: negative time: %ld usec\n",
|
fprintf (stderr, "calcru: negative time: %ld usec\n",
|
||||||
(long)totusec);
|
(long)totusec);
|
||||||
totusec = 0;
|
totusec = 0;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
u = totusec;
|
u = totusec;
|
||||||
@@ -171,7 +176,7 @@ 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)
|
#if (defined __FreeBSD__) && (__FreeBSD_version >= 300003)
|
||||||
buf->rtime = pinfo [0].kp_proc.p_runtime;
|
buf->rtime = pinfo [0].kp_proc.p_runtime;
|
||||||
#else
|
#else
|
||||||
buf->rtime = tv2sec (pinfo [0].kp_proc.p_rtime);
|
buf->rtime = tv2sec (pinfo [0].kp_proc.p_rtime);
|
||||||
|
Reference in New Issue
Block a user