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.
This commit is contained in:
parent
4d3800847a
commit
7a9c4d2409
@ -1341,6 +1341,8 @@ sysctl_kern_proc_vmmap(SYSCTL_HANDLER_ARGS)
|
||||
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_ARGS)
|
||||
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_ARGS)
|
||||
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_ARGS)
|
||||
|
||||
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;
|
||||
|
@ -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. */
|
||||
};
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user