+int
+proc_pidregionpathinfo2(proc_t p, uint64_t arg, user_addr_t buffer, __unused uint32_t buffersize, int32_t *retval)
+{
+ struct proc_regionwithpathinfo preginfo;
+ int ret, error = 0;
+ uintptr_t vnodeaddr= 0;
+ uint32_t vnodeid= 0;
+ vnode_t vp;
+ int count;
+
+ bzero(&preginfo, sizeof(struct proc_regionwithpathinfo));
+
+ ret = fill_procregioninfo_onlymappedvnodes( p->task, arg, (struct proc_regioninfo_internal *)&preginfo.prp_prinfo, (uintptr_t *)&vnodeaddr, (uint32_t *)&vnodeid);
+ if (ret == 0)
+ return(EINVAL);
+ if (!vnodeaddr)
+ return(EINVAL);
+
+ vp = (vnode_t)vnodeaddr;
+ if ((vnode_getwithvid(vp, vnodeid)) == 0) {
+ /* FILL THE VNODEINFO */
+ error = fill_vnodeinfo(vp, &preginfo.prp_vip.vip_vi);
+ count = MAXPATHLEN;
+ vn_getpath(vp, &preginfo.prp_vip.vip_path[0], &count);
+ /* Always make sure it is null terminated */
+ preginfo.prp_vip.vip_path[MAXPATHLEN-1] = 0;
+ vnode_put(vp);
+ } else {
+ return(EINVAL);
+ }
+
+ error = copyout(&preginfo, buffer, sizeof(struct proc_regionwithpathinfo));
+ if (error == 0)
+ *retval = sizeof(struct proc_regionwithpathinfo);
+ return(error);
+}
+
+int
+proc_pidregionpathinfo3(proc_t p, uint64_t arg, user_addr_t buffer, __unused uint32_t buffersize, int32_t *retval)
+{
+ struct proc_regionwithpathinfo preginfo;
+ int ret, error = 0;
+ uintptr_t vnodeaddr;
+ uint32_t vnodeid;
+ vnode_t vp;
+ int count;
+ uint64_t addr = 0;
+
+ /* Loop while looking for vnodes that match dev_t filter */
+ do {
+ bzero(&preginfo, sizeof(struct proc_regionwithpathinfo));
+ vnodeaddr = 0;
+ vnodeid = 0;
+
+ ret = fill_procregioninfo_onlymappedvnodes( p->task, addr, (struct proc_regioninfo_internal *)&preginfo.prp_prinfo, (uintptr_t *)&vnodeaddr, (uint32_t *)&vnodeid);
+ if (ret == 0)
+ return(EINVAL);
+ if (!vnodeaddr)
+ return(EINVAL);
+
+ vp = (vnode_t)vnodeaddr;
+ if ((vnode_getwithvid(vp, vnodeid)) == 0) {
+ /* Check if the vnode matches the filter, otherwise loop looking for the next memory region backed by a vnode */
+ struct vnode_attr va;
+
+ memset(&va, 0, sizeof(va));
+ VATTR_INIT(&va);
+ VATTR_WANTED(&va, va_fsid);
+
+ ret = vnode_getattr(vp, &va, vfs_context_current());
+ if (ret) {
+ vnode_put(vp);
+ return(EINVAL);
+ }
+
+ if (va.va_fsid == arg) {
+ /* FILL THE VNODEINFO */
+ error = fill_vnodeinfo(vp, &preginfo.prp_vip.vip_vi);
+ count = MAXPATHLEN;
+ vn_getpath(vp, &preginfo.prp_vip.vip_path[0], &count);
+ /* Always make sure it is null terminated */
+ preginfo.prp_vip.vip_path[MAXPATHLEN-1] = 0;
+ vnode_put(vp);
+ break;
+ }
+ vnode_put(vp);
+ } else {
+ return(EINVAL);
+ }
+
+ addr = preginfo.prp_prinfo.pri_address + preginfo.prp_prinfo.pri_size;
+ } while (1);
+
+ error = copyout(&preginfo, buffer, sizeof(struct proc_regionwithpathinfo));
+ if (error == 0)
+ *retval = sizeof(struct proc_regionwithpathinfo);
+ return(error);
+}
+