git: ac9b565b1aa1 - main - kinfo_vmentry: report cdev name for device mappings
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 11 Oct 2024 10:15:08 UTC
The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=ac9b565b1aa1adc359a5b0a0d83d0aea63643d62 commit ac9b565b1aa1adc359a5b0a0d83d0aea63643d62 Author: Konstantin Belousov <kib@FreeBSD.org> AuthorDate: 2024-10-10 09:31:37 +0000 Commit: Konstantin Belousov <kib@FreeBSD.org> CommitDate: 2024-10-11 10:14:04 +0000 kinfo_vmentry: report cdev name for device mappings Reviewed by: emaste, markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D47038 --- sys/kern/kern_proc.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/sys/kern/kern_proc.c b/sys/kern/kern_proc.c index 1e90116f1cb0..f3ecaf4e2547 100644 --- a/sys/kern/kern_proc.c +++ b/sys/kern/kern_proc.c @@ -38,6 +38,7 @@ #include <sys/param.h> #include <sys/systm.h> #include <sys/bitstring.h> +#include <sys/conf.h> #include <sys/elf.h> #include <sys/eventhandler.h> #include <sys/exec.h> @@ -2614,9 +2615,11 @@ kern_proc_vmmap_out(struct proc *p, struct sbuf *sb, ssize_t maxlen, int flags) struct ucred *cred; struct vnode *vp; struct vmspace *vm; + struct cdev *cdev; + struct cdevsw *csw; vm_offset_t addr; unsigned int last_timestamp; - int error; + int error, ref; key_t key; unsigned short seq; bool guard, super; @@ -2714,6 +2717,19 @@ kern_proc_vmmap_out(struct proc *p, struct sbuf *sb, ssize_t maxlen, int flags) kve->kve_ref_count = obj->ref_count; kve->kve_shadow_count = obj->shadow_count; + 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(kve->kve_path, + cdev->si_name, sizeof( + kve->kve_path)); + dev_relthread(cdev, ref); + } + } + } VM_OBJECT_RUNLOCK(obj); if ((lobj->flags & OBJ_SYSVSHM) != 0) { kve->kve_flags |= KVME_FLAG_SYSVSHM;