git: a8c641bbcba7 - main - sys/user.h: report posix shm mappings

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Tue, 08 Oct 2024 12:39:25 UTC
The branch main has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=a8c641bbcba7badad2d00206245cbfaf73a762b7

commit a8c641bbcba7badad2d00206245cbfaf73a762b7
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2024-10-07 01:49:51 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2024-10-08 12:38:09 +0000

    sys/user.h: report posix shm mappings
    
    Add flag KVME_FLAG_POSIXSHM.  Fill kve_path with the path of the
    segment.
    
    Reviewed by:    markj
    Sponsored by:   The FreeBSD Foundation
    MFC after:      1 week
    Differential revision:  https://reviews.freebsd.org/D46970
---
 sys/kern/kern_proc.c | 5 +++++
 sys/sys/user.h       | 1 +
 2 files changed, 6 insertions(+)

diff --git a/sys/kern/kern_proc.c b/sys/kern/kern_proc.c
index 7dc58b1e9bc9..1e90116f1cb0 100644
--- a/sys/kern/kern_proc.c
+++ b/sys/kern/kern_proc.c
@@ -2721,6 +2721,11 @@ kern_proc_vmmap_out(struct proc *p, struct sbuf *sb, ssize_t maxlen, int flags)
 				kve->kve_vn_fileid = key;
 				kve->kve_vn_fsid_freebsd11 = seq;
 			}
+			if ((lobj->flags & OBJ_POSIXSHM) != 0) {
+				kve->kve_flags |= KVME_FLAG_POSIXSHM;
+				shm_get_path(lobj, kve->kve_path,
+				    sizeof(kve->kve_path));
+			}
 			if (vp != NULL) {
 				vn_fullpath(vp, &fullpath, &freepath);
 				kve->kve_vn_type = vntype_to_kinfo(vp->v_type);
diff --git a/sys/sys/user.h b/sys/sys/user.h
index 2025dc5cb47b..5703dababbe3 100644
--- a/sys/sys/user.h
+++ b/sys/sys/user.h
@@ -518,6 +518,7 @@ struct kinfo_lockf {
 #define	KVME_FLAG_GROWS_DOWN	0x00000020
 #define	KVME_FLAG_USER_WIRED	0x00000040
 #define	KVME_FLAG_SYSVSHM	0x00000080
+#define	KVME_FLAG_POSIXSHM	0x00000100
 
 #if defined(__amd64__)
 #define	KINFO_OVMENTRY_SIZE	1168