diff --git a/sys/vm/vm_object.c b/sys/vm/vm_object.c index d0f36781546..d2ac8f69663 100644 --- a/sys/vm/vm_object.c +++ b/sys/vm/vm_object.c @@ -68,6 +68,7 @@ #include #include +#include #include #include #include @@ -2517,8 +2518,10 @@ vm_object_list_handler(struct sysctl_req *req, bool swap_only) struct vattr va; vm_object_t obj; vm_page_t m; + struct cdev *cdev; + struct cdevsw *csw; u_long sp; - int count, error; + int count, error, ref; key_t key; unsigned short seq; bool want_path; @@ -2605,6 +2608,17 @@ vm_object_list_handler(struct sysctl_req *req, bool swap_only) sp = swap_pager_swapped_pages(obj); kvo->kvo_swapped = sp > UINT32_MAX ? UINT32_MAX : sp; } + if (obj->type == OBJT_DEVICE || obj->type == OBJT_MGTDEVICE) { + cdev = obj->un_pager.devp.dev; + if (cdev != NULL) { + csw = dev_refthread(cdev, &ref); + if (csw != NULL) { + strlcpy(kvo->kvo_path, cdev->si_name, + sizeof(kvo->kvo_path)); + dev_relthread(cdev, ref); + } + } + } VM_OBJECT_RUNLOCK(obj); if ((obj->flags & OBJ_SYSVSHM) != 0) { kvo->kvo_flags |= KVMO_FLAG_SYSVSHM;