svn commit: r184492 - in head/sys: kern sys

Peter Wemm peter at FreeBSD.org
Thu Oct 30 22:43:19 PDT 2008


Author: peter
Date: Fri Oct 31 05:43:19 2008
New Revision: 184492
URL: http://svn.freebsd.org/changeset/base/184492

Log:
  Add three extra to the kinfo_proc_vmmap data.  kve_offset - the offset
  within an object that a mapping refers to.  fileid and fsid are inode/dev
  for vnodes.  (Linux procfs has these and valgrind is really unhappy
  without them.)  I believe I didn't change the size of the struct.

Modified:
  head/sys/kern/kern_proc.c
  head/sys/sys/user.h

Modified: head/sys/kern/kern_proc.c
==============================================================================
--- head/sys/kern/kern_proc.c	Fri Oct 31 02:36:28 2008	(r184491)
+++ head/sys/kern/kern_proc.c	Fri Oct 31 05:43:19 2008	(r184492)
@@ -1341,6 +1341,8 @@ sysctl_kern_proc_vmmap(SYSCTL_HANDLER_AR
 	unsigned int last_timestamp;
 	char *fullpath, *freepath;
 	struct kinfo_vmentry *kve;
+	struct vattr va;
+	struct ucred *cred;
 	int error, *name;
 	struct vnode *vp;
 	struct proc *p;
@@ -1400,6 +1402,8 @@ sysctl_kern_proc_vmmap(SYSCTL_HANDLER_AR
 			lobj = tobj;
 		}
 
+		kve->kve_fileid = 0;
+		kve->kve_fsid = 0;
 		freepath = NULL;
 		fullpath = "";
 		if (lobj) {
@@ -1440,6 +1444,11 @@ sysctl_kern_proc_vmmap(SYSCTL_HANDLER_AR
 				vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
 				vn_fullpath(curthread, vp, &fullpath,
 				    &freepath);
+				cred = curthread->td_ucred;
+				if (VOP_GETATTR(vp, &va, cred) == 0) {
+					kve->kve_fileid = va.va_fileid;
+					kve->kve_fsid = va.va_fsid;
+				}
 				vput(vp);
 				VFS_UNLOCK_GIANT(vfslocked);
 			}
@@ -1451,6 +1460,7 @@ sysctl_kern_proc_vmmap(SYSCTL_HANDLER_AR
 
 		kve->kve_start = (void*)entry->start;
 		kve->kve_end = (void*)entry->end;
+		kve->kve_offset = (off_t)entry->offset;
 
 		if (entry->protection & VM_PROT_READ)
 			kve->kve_protection |= KVME_PROT_READ;

Modified: head/sys/sys/user.h
==============================================================================
--- head/sys/sys/user.h	Fri Oct 31 02:36:28 2008	(r184491)
+++ head/sys/sys/user.h	Fri Oct 31 05:43:19 2008	(r184492)
@@ -326,7 +326,10 @@ struct kinfo_vmentry {
 	int	 kve_shadow_count;		/* VM obj shadow count. */
 	char	 kve_path[PATH_MAX];		/* Path to VM obj, if any. */
 	void	*_kve_pspare[8];		/* Space for more stuff. */
-	int	 _kve_ispare[8];		/* Space for more stuff. */
+	off_t	 kve_offset;			/* Mapping offset in object */
+	uint64_t kve_fileid;			/* inode number of vnode */
+	dev_t	 kve_fsid;			/* dev_t of vnode location */
+	int	 _kve_ispare[3];		/* Space for more stuff. */
 };
 
 /*


More information about the svn-src-all mailing list