diff options
author | marcus <marcus@FreeBSD.org> | 2002-10-06 00:21:50 +0800 |
---|---|---|
committer | marcus <marcus@FreeBSD.org> | 2002-10-06 00:21:50 +0800 |
commit | b0e96b99808813f2415ab529cdfb4c659a687919 (patch) | |
tree | 345f593cdc1b59be62c8f3c10cdfda1f25405ede | |
parent | 3748796334ba83e3105a53adee1bd711a41b638d (diff) | |
download | freebsd-ports-gnome-b0e96b99808813f2415ab529cdfb4c659a687919.tar.gz freebsd-ports-gnome-b0e96b99808813f2415ab529cdfb4c659a687919.tar.zst freebsd-ports-gnome-b0e96b99808813f2415ab529cdfb4c659a687919.zip |
Fix build on -CURRENT by moving to a pure libkvm API. Thanks to julian for
pointing me in this direction. This should hopefully be more portable
moving forward. Bump PORTREVISION since the changes affect -stable as well.
-rw-r--r-- | devel/libgtop/Makefile | 2 | ||||
-rw-r--r-- | devel/libgtop/files/patch-ah | 37 | ||||
-rw-r--r-- | devel/libgtop/files/patch-sysdeps::freebsd::proctime.c | 100 | ||||
-rw-r--r-- | devel/libgtop2/Makefile | 2 | ||||
-rw-r--r-- | devel/libgtop2/files/patch-ah | 39 | ||||
-rw-r--r-- | devel/libgtop2/files/patch-sysdeps::freebsd::proctime.c | 102 |
6 files changed, 219 insertions, 63 deletions
diff --git a/devel/libgtop/Makefile b/devel/libgtop/Makefile index 05587a5aba4b..92e36a0d8ab2 100644 --- a/devel/libgtop/Makefile +++ b/devel/libgtop/Makefile @@ -7,7 +7,7 @@ PORTNAME= libgtop PORTVERSION= 1.0.13 -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= devel gnome MASTER_SITES= ${MASTER_SITE_GNOME} MASTER_SITE_SUBDIR= sources/libgtop/1.0 diff --git a/devel/libgtop/files/patch-ah b/devel/libgtop/files/patch-ah index 3fa66d354b33..c538326abc1d 100644 --- a/devel/libgtop/files/patch-ah +++ b/devel/libgtop/files/patch-ah @@ -1,6 +1,8 @@ ---- sysdeps/freebsd/procmap.c.orig Thu May 27 13:56:48 1999 -+++ sysdeps/freebsd/procmap.c Thu Mar 1 17:29:02 2001 -@@ -35,3 +35,7 @@ +--- sysdeps/freebsd/procmap.c.orig Mon Nov 26 17:37:59 2001 ++++ sysdeps/freebsd/procmap.c Wed Oct 2 21:28:31 2002 +@@ -33,7 +33,11 @@ + #include <sys/proc.h> + #include <sys/resource.h> #include <vm/vm_object.h> +#if (__FreeBSD_version >= 400011) +#include <vm/vm.h> @@ -8,11 +10,19 @@ #include <vm/vm_prot.h> +#endif #include <vm/vm_map.h> -@@ -94,3 +98,2 @@ + + #include <sys/vnode.h> +@@ -92,7 +96,6 @@ + #if defined __FreeBSD__ + struct vnode vnode; struct inode inode; - struct mount mount; #endif -@@ -116,3 +119,7 @@ + int count, i = 0; + int update = 0; +@@ -114,7 +117,11 @@ + /* Now we get the memory maps. */ + if (kvm_read (server->machine.kd, +#if (__FreeBSD_version >= 500013) + (unsigned long) pinfo [0].ki_vmspace, @@ -20,7 +30,20 @@ (unsigned long) pinfo [0].kp_proc.p_vmspace, +#endif (char *) &vmspace, sizeof (vmspace)) != sizeof (vmspace)) -@@ -253,7 +260,2 @@ + glibtop_error_io_r (server, "kvm_read (vmspace)"); + +@@ -217,7 +224,7 @@ + if (!vnode.v_uvm.u_flags & UVM_VNODE_VALID) + continue; + +- if ((vnode.v_type != VREG) || (vnode.v_tag != VT_UFS) || ++ if ((vnode.v_type != VREG) || strcmp("ufs", vnode.v_tag) || + !vnode.v_data) continue; + + if (kvm_read (server->machine.kd, +@@ -251,11 +258,6 @@ + (unsigned long) vnode.v_data, + &inode, sizeof (inode)) != sizeof (inode)) glibtop_error_io_r (server, "kvm_read (inode)"); - - if (kvm_read (server->machine.kd, @@ -28,3 +51,5 @@ - &mount, sizeof (mount)) != sizeof (mount)) - glibtop_error_io_r (server, "kvm_read (mount)"); + maps [i-1].inode = inode.i_number; + maps [i-1].device = inode.i_dev; diff --git a/devel/libgtop/files/patch-sysdeps::freebsd::proctime.c b/devel/libgtop/files/patch-sysdeps::freebsd::proctime.c index 5176f869ca23..5b3debc61dcf 100644 --- a/devel/libgtop/files/patch-sysdeps::freebsd::proctime.c +++ b/devel/libgtop/files/patch-sysdeps::freebsd::proctime.c @@ -1,6 +1,14 @@ --- sysdeps/freebsd/proctime.c.orig Mon Nov 26 17:37:59 2001 -+++ sysdeps/freebsd/proctime.c Tue Feb 26 12:20:24 2002 -@@ -66,14 +66,17 @@ ++++ sysdeps/freebsd/proctime.c Wed Oct 2 21:26:35 2002 +@@ -57,6 +57,7 @@ + * system, and interrupt time usage. + */ + ++#ifndef __FreeBSD__ + static void + calcru(p, up, sp, ip) + struct proc *p; +@@ -66,9 +67,6 @@ { quad_t totusec; u_quad_t u, st, ut, it, tot; @@ -9,19 +17,8 @@ -#endif struct timeval tv; -+#if __FreeBSD_version < 500023 st = p->p_sticks; - ut = p->p_uticks; - it = p->p_iticks; -+#else -+ st = p->p_kse.ke_sticks; -+ ut = p->p_kse.ke_uticks; -+ it = p->p_kse.ke_iticks; -+#endif - - tot = st + ut + it; - if (tot == 0) { -@@ -81,13 +84,12 @@ +@@ -81,19 +79,10 @@ tot = 1; } @@ -31,16 +28,42 @@ - * on FreeBSD 3.0 and renamed p_rtime -> p_runtime. - */ - -+#if (defined __FreeBSD__) -+#if __FreeBSD_version >= 500030 -+ totusec = (u_quad_t) (p->p_runtime.sec * 1000000 + p->p_runtime.frac); -+#else - totusec = (u_quad_t) p->p_runtime; -+#endif - #else +- totusec = (u_quad_t) p->p_runtime; +-#else sec = p->p_rtime.tv_sec; usec = p->p_rtime.tv_usec; -@@ -157,10 +159,10 @@ + + totusec = (quad_t)sec * 1000000 + usec; +-#endif + + if (totusec < 0) { + /* XXX no %qd in kernel. Truncate. */ +@@ -116,6 +105,7 @@ + ip->tv_usec = it % 1000000; + } + } ++#endif + + /* Provides detailed information about a process. */ + +@@ -142,25 +132,25 @@ + /* It does not work for the swapper task. */ + if (pid == 0) return; + +-#if !(defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000)) ++#if (defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000)) + if (server->sysdeps.proc_time == 0) + return; ++#endif + + #ifndef __bsdi__ + sprintf (filename, "/proc/%d/mem", (int) pid); + if (stat (filename, &statb)) return; + #endif +-#endif + + /* Get the process information */ + pinfo = kvm_getprocs (server->machine.kd, KERN_PROC_PID, pid, &count); if ((pinfo == NULL) || (count != 1)) glibtop_error_io_r (server, "kvm_getprocs (%d)", pid); @@ -54,7 +77,7 @@ #endif buf->frequency = 1000000; -@@ -192,6 +194,21 @@ +@@ -192,6 +182,21 @@ buf->flags |= _glibtop_sysdeps_proc_time_user; #else @@ -76,9 +99,38 @@ glibtop_suid_enter (server); if ((pinfo [0].kp_proc.p_flag & P_INMEM) && -@@ -222,6 +239,7 @@ +@@ -199,29 +204,16 @@ + (unsigned long) &u_addr->u_stats, + (char *) &pstats, sizeof (pstats)) == sizeof (pstats)) + { +- /* This is taken form the kernel source code of +- * FreeBSD 2.2.6. */ +- +- /* Well, we just do the same getrusage () does ... */ +- +- register struct rusage *rup; +- +- glibtop_suid_leave (server); +- +- rup = &pstats.p_ru; +- calcru(&(pinfo [0]).kp_proc, +- &rup->ru_utime, &rup->ru_stime, NULL); +- +- buf->utime = tv2sec (pstats.p_ru.ru_utime); +- buf->stime = tv2sec (pstats.p_ru.ru_stime); +- +- buf->cutime = tv2sec (pstats.p_cru.ru_utime); +- buf->cstime = tv2sec (pstats.p_cru.ru_stime); +- +- buf->start_time = tv2sec (pstats.p_start); ++ buf->utime = tv2sec (pinfo[0].kp_eproc.e_stats.p_ru.ru_utime); ++ buf->stime = tv2sec (pinfo[0].kp_eproc.e_stats.p_ru.ru_stime); ++ buf->cutime = tv2sec (pinfo[0].kp_eproc.e_stats.p_cru.ru_utime); ++ buf->cstime = tv2sec (pinfo[0].kp_eproc.e_stats.p_cru.ru_stime); ++ buf->start_time = tv2sec (pinfo[0].kp_eproc.e_stats.p_start); buf->flags = _glibtop_sysdeps_proc_time_user; ++ glibtop_suid_leave (server); } +#endif diff --git a/devel/libgtop2/Makefile b/devel/libgtop2/Makefile index 75a33e782f4d..f3fdabea4c59 100644 --- a/devel/libgtop2/Makefile +++ b/devel/libgtop2/Makefile @@ -7,7 +7,7 @@ PORTNAME= libgtop2 PORTVERSION= 2.0.0 -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= devel gnome MASTER_SITES= ${MASTER_SITE_GNOME} MASTER_SITE_SUBDIR= sources/${PORTNAME:S/2$//}/2.0 diff --git a/devel/libgtop2/files/patch-ah b/devel/libgtop2/files/patch-ah index 3fa66d354b33..b46cc90d0ef3 100644 --- a/devel/libgtop2/files/patch-ah +++ b/devel/libgtop2/files/patch-ah @@ -1,6 +1,8 @@ ---- sysdeps/freebsd/procmap.c.orig Thu May 27 13:56:48 1999 -+++ sysdeps/freebsd/procmap.c Thu Mar 1 17:29:02 2001 -@@ -35,3 +35,7 @@ +--- sysdeps/freebsd/procmap.c.orig Mon Jun 10 17:34:42 2002 ++++ sysdeps/freebsd/procmap.c Fri Sep 20 16:10:37 2002 +@@ -33,7 +33,11 @@ + #include <sys/proc.h> + #include <sys/resource.h> #include <vm/vm_object.h> +#if (__FreeBSD_version >= 400011) +#include <vm/vm.h> @@ -8,11 +10,19 @@ #include <vm/vm_prot.h> +#endif #include <vm/vm_map.h> -@@ -94,3 +98,2 @@ + + #include <sys/vnode.h> +@@ -92,7 +96,6 @@ + #if defined __FreeBSD__ + struct vnode vnode; struct inode inode; - struct mount mount; #endif -@@ -116,3 +119,7 @@ + int count, i = 0; + int update = 0; +@@ -114,7 +117,11 @@ + /* Now we get the memory maps. */ + if (kvm_read (server->machine.kd, +#if (__FreeBSD_version >= 500013) + (unsigned long) pinfo [0].ki_vmspace, @@ -20,7 +30,22 @@ (unsigned long) pinfo [0].kp_proc.p_vmspace, +#endif (char *) &vmspace, sizeof (vmspace)) != sizeof (vmspace)) -@@ -253,7 +260,2 @@ + glibtop_error_io_r (server, "kvm_read (vmspace)"); + +@@ -244,18 +251,17 @@ + &vnode, sizeof (vnode)) != sizeof (vnode)) + glibtop_error_io_r (server, "kvm_read (vnode)"); + ++#if __FreeBSD_version > 500039 ++ if ((vnode.v_type != VREG) || strcmp("ufs", vnode.v_tag) || ++#else + if ((vnode.v_type != VREG) || (vnode.v_tag != VT_UFS) || ++#endif + !vnode.v_data) continue; + + if (kvm_read (server->machine.kd, + (unsigned long) vnode.v_data, + &inode, sizeof (inode)) != sizeof (inode)) glibtop_error_io_r (server, "kvm_read (inode)"); - - if (kvm_read (server->machine.kd, @@ -28,3 +53,5 @@ - &mount, sizeof (mount)) != sizeof (mount)) - glibtop_error_io_r (server, "kvm_read (mount)"); + maps [i-1].inode = inode.i_number; + maps [i-1].device = inode.i_dev; diff --git a/devel/libgtop2/files/patch-sysdeps::freebsd::proctime.c b/devel/libgtop2/files/patch-sysdeps::freebsd::proctime.c index 5176f869ca23..f26b953a8631 100644 --- a/devel/libgtop2/files/patch-sysdeps::freebsd::proctime.c +++ b/devel/libgtop2/files/patch-sysdeps::freebsd::proctime.c @@ -1,6 +1,14 @@ ---- sysdeps/freebsd/proctime.c.orig Mon Nov 26 17:37:59 2001 -+++ sysdeps/freebsd/proctime.c Tue Feb 26 12:20:24 2002 -@@ -66,14 +66,17 @@ +--- sysdeps/freebsd/proctime.c.orig Mon Jun 10 17:34:42 2002 ++++ sysdeps/freebsd/proctime.c Wed Oct 2 21:18:38 2002 +@@ -57,6 +57,7 @@ + * system, and interrupt time usage. + */ + ++#ifndef __FreeBSD__ + static void + calcru(p, up, sp, ip) + struct proc *p; +@@ -66,9 +67,6 @@ { quad_t totusec; u_quad_t u, st, ut, it, tot; @@ -9,19 +17,8 @@ -#endif struct timeval tv; -+#if __FreeBSD_version < 500023 st = p->p_sticks; - ut = p->p_uticks; - it = p->p_iticks; -+#else -+ st = p->p_kse.ke_sticks; -+ ut = p->p_kse.ke_uticks; -+ it = p->p_kse.ke_iticks; -+#endif - - tot = st + ut + it; - if (tot == 0) { -@@ -81,13 +84,12 @@ +@@ -81,19 +79,10 @@ tot = 1; } @@ -31,16 +28,42 @@ - * on FreeBSD 3.0 and renamed p_rtime -> p_runtime. - */ - -+#if (defined __FreeBSD__) -+#if __FreeBSD_version >= 500030 -+ totusec = (u_quad_t) (p->p_runtime.sec * 1000000 + p->p_runtime.frac); -+#else - totusec = (u_quad_t) p->p_runtime; -+#endif - #else +- totusec = (u_quad_t) p->p_runtime; +-#else sec = p->p_rtime.tv_sec; usec = p->p_rtime.tv_usec; -@@ -157,10 +159,10 @@ + + totusec = (quad_t)sec * 1000000 + usec; +-#endif + + if (totusec < 0) { + /* XXX no %qd in kernel. Truncate. */ +@@ -116,6 +105,7 @@ + ip->tv_usec = it % 1000000; + } + } ++#endif + + /* Provides detailed information about a process. */ + +@@ -142,25 +132,25 @@ + /* It does not work for the swapper task. */ + if (pid == 0) return; + +-#if !(defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000)) ++#if (defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000)) + if (server->sysdeps.proc_time == 0) + return; + ++#endif + #ifndef __bsdi__ + sprintf (filename, "/proc/%d/mem", (int) pid); + if (stat (filename, &statb)) return; + #endif +-#endif + + /* Get the process information */ + pinfo = kvm_getprocs (server->machine.kd, KERN_PROC_PID, pid, &count); if ((pinfo == NULL) || (count != 1)) glibtop_error_io_r (server, "kvm_getprocs (%d)", pid); @@ -54,7 +77,7 @@ #endif buf->frequency = 1000000; -@@ -192,6 +194,21 @@ +@@ -192,6 +182,21 @@ buf->flags |= _glibtop_sysdeps_proc_time_user; #else @@ -76,9 +99,38 @@ glibtop_suid_enter (server); if ((pinfo [0].kp_proc.p_flag & P_INMEM) && -@@ -222,6 +239,7 @@ +@@ -199,29 +204,16 @@ + (unsigned long) &u_addr->u_stats, + (char *) &pstats, sizeof (pstats)) == sizeof (pstats)) + { +- /* This is taken form the kernel source code of +- * FreeBSD 2.2.6. */ +- +- /* Well, we just do the same getrusage () does ... */ +- +- register struct rusage *rup; +- +- glibtop_suid_leave (server); +- +- rup = &pstats.p_ru; +- calcru(&(pinfo [0]).kp_proc, +- &rup->ru_utime, &rup->ru_stime, NULL); +- +- buf->utime = tv2sec (pstats.p_ru.ru_utime); +- buf->stime = tv2sec (pstats.p_ru.ru_stime); +- +- buf->cutime = tv2sec (pstats.p_cru.ru_utime); +- buf->cstime = tv2sec (pstats.p_cru.ru_stime); +- +- buf->start_time = tv2sec (pstats.p_start); ++ buf->utime = tv2sec (pinfo[0].kp_eproc.e_stats.p_ru.ru_utime); ++ buf->stime = tv2sec (pinfo[0].kp_eproc.e_stats.p_ru.ru_stime); ++ buf->cutime = tv2sec (pinfo[0].kp_eproc.e_stats.p_cru.ru_utime); ++ buf->cstime = tv2sec (pinfo[0].kp_eproc.e_stats.p_cru.ru_stime); ++ buf->start_time = tv2sec (pinfo[0].kp_eproc.e_stats.p_start); buf->flags = _glibtop_sysdeps_proc_time_user; ++ glibtop_suid_leave (server); } +#endif |