Skip site navigation (1)Skip section navigation (2)
Date:      28 Oct 2002 23:42:59 -0500
From:      Joe Marcus Clarke <marcus@marcuscom.com>
To:        John Baldwin <jhb@FreeBSD.org>
Cc:        current@FreeBSD.org, Nate Lawson <nate@root.org>, Terry Lambert <tlambert2@mindspring.com>
Subject:   Re: libgtop port and v_tag changes
Message-ID:  <1035866580.338.2.camel@gyros.marcuscom.com>
In-Reply-To: <XFMail.20021028163739.jhb@FreeBSD.org>
References:  <XFMail.20021028163739.jhb@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help

--=-z3wEEJWCMx1eXFkJvyi4
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

On Mon, 2002-10-28 at 16:37, John Baldwin wrote:
> 
> On 28-Oct-2002 Joe Marcus Clarke wrote:
> > On Mon, 2002-10-28 at 16:27, John Baldwin wrote:
> >> 
> >> On 28-Oct-2002 Terry Lambert wrote:
> >> > John Baldwin wrote:
> >> >> I mean, do you know what libgtop is used for?  It's used to draw
> >> >> little applets that display load averages and other silly system
> >> >> monitor stuff in small spaces in GUI's.  It seems to work quite
> >> >> happily w/o any inode numbers or dev_t's for non-UFS filesystems.
> >> >> I just don't see why some little graphical applet displaying a load
> >> >> average or disk usage or ethernet device usage needs the inode
> >> >> number and dev_t of vnode's in the kernel.  I mean, geez.
> >> > 
> >> > To build little applets that activate a flashing red light when
> >> > certain files are written?
> >> 
> >> Why do you need the inode number to do that.  Just kqueue on the
> >> file itself using a regular fd, and in that case you can stat(2)
> >> the file if you really need the i-node number.  You don't need
> >> to use libkvm to actually go read the kernel to find this info!
> > 
> > You're probably right.  But without waiting to re-architect libgtop, I
> > think the immediate problem needs to be fixed.  Shall I just commit my
> > original patch that uses libkvm?
> 
> Use v_cachedid and v_cachedfs for all VREG vnodes.  Then you don't
> need to even go near v_tag.  This is fewer kvm_read()'s.  If stable
> has the v_cachedid then it should be using that instead of reading
> in UFS inodes as well.

This look okay?

Joe

> 
> -- 
> 
> John Baldwin <jhb@FreeBSD.org>  <><  http://www.FreeBSD.org/~jhb/
> "Power Users Use the Power to Serve!"  -  http://www.FreeBSD.org/
> 
-- 
PGP Key : http://www.marcuscom.com/pgp.asc

--=-z3wEEJWCMx1eXFkJvyi4
Content-Disposition: attachment; filename=patch-ah-jhb
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; name=patch-ah-jhb; charset=ISO8859-1

--- procmap.c.orig	Mon Jun 10 17:34:42 2002
+++ procmap.c	Sat Oct 26 01:20:26 2002
@@ -33,7 +33,11 @@
 #include <sys/proc.h>
 #include <sys/resource.h>
 #include <vm/vm_object.h>
+#if (__FreeBSD_version >=3D 400011)
+#include <vm/vm.h>
+#else
 #include <vm/vm_prot.h>
+#endif
 #include <vm/vm_map.h>
=20
 #include <sys/vnode.h>
@@ -91,8 +95,9 @@
 	glibtop_map_entry *maps;
 #if defined __FreeBSD__
 	struct vnode vnode;
+#if __FreeBSD_version < 500039
 	struct inode inode;
-	struct mount mount;
+#endif
 #endif
 	int count, i =3D 0;
 	int update =3D 0;
@@ -114,7 +119,11 @@
 	/* Now we get the memory maps. */
=20
 	if (kvm_read (server->machine.kd,
+#if (__FreeBSD_version >=3D 500013)
+		      (unsigned long) pinfo [0].ki_vmspace,
+#else
 		      (unsigned long) pinfo [0].kp_proc.p_vmspace,
+#endif
 		      (char *) &vmspace, sizeof (vmspace)) !=3D sizeof (vmspace))
 		glibtop_error_io_r (server, "kvm_read (vmspace)");
=20
@@ -244,6 +253,15 @@
 			      &vnode, sizeof (vnode)) !=3D sizeof (vnode))
 			glibtop_error_io_r (server, "kvm_read (vnode)");
=20
+#if __FreeBSD_version >=3D 500039
+		switch (vnode.v_type) {
+		    case VREG:
+		    	maps [i-1].inode =3D vnode.v_cachedid;
+			maps [i-1].device =3D vnode.v_cachedfs;
+		    default:
+		    	continue;
+		}
+#else
 		if ((vnode.v_type !=3D VREG) || (vnode.v_tag !=3D VT_UFS) ||
 		    !vnode.v_data) continue;
=20
@@ -252,13 +270,9 @@
 			      &inode, sizeof (inode)) !=3D sizeof (inode))
 			glibtop_error_io_r (server, "kvm_read (inode)");
=20
-		if (kvm_read (server->machine.kd,
-			      (unsigned long) vnode.v_mount,
-			      &mount, sizeof (mount)) !=3D sizeof (mount))
-			glibtop_error_io_r (server, "kvm_read (mount)");
-
 		maps [i-1].inode  =3D inode.i_number;
 		maps [i-1].device =3D inode.i_dev;
+#endif
 #endif
 	} while (entry.next !=3D first);
=20

--=-z3wEEJWCMx1eXFkJvyi4--


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1035866580.338.2.camel>