]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
lsfd: fill MNTID coulmn for shm and mem assocations
authorMasatake YAMATO <yamato@redhat.com>
Thu, 8 Jan 2026 21:59:56 +0000 (06:59 +0900)
committerMasatake YAMATO <yamato@redhat.com>
Mon, 12 Jan 2026 18:39:33 +0000 (03:39 +0900)
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
lsfd-cmd/lsfd.c
lsfd-cmd/lsfd.h

index 26d0bd54a611a5eb7b58e56b3fa171871b0bfa97..429cd7b52ccd699dc950175d7ea2ca9eb96d3aea 100644 (file)
@@ -1053,6 +1053,17 @@ static void parse_maps_line(struct path_cxt *pc, char *buf, struct proc *proc)
        f->map_end = end;
        f->pos = offset;
 
+       f->mnt_id = 0;
+#if defined(HAVE_STATX) && defined(HAVE_STRUCT_STATX_STX_MNT_ID)
+       {
+               struct statx stx;
+               if (ul_path_statxf(pc, &stx, AT_NO_AUTOMOUNT|AT_STATX_DONT_SYNC,
+                                  STATX_MNT_ID,
+                                  "map_files/%"PRIx64"-%"PRIx64, start, end) == 0)
+                       f->mnt_id = stx.stx_mnt_id;
+       }
+#endif /* defined(HAVE_STATX) && defined(HAVE_STRUCT_STATX_STX_MNT_ID) */
+
        file_init_content(f);
 }
 
index 63a9f460e184e3106070b1805f6fb1a15cbfddd5..a33cebdcac5cf7cd5e2fc2258d996651da84f9ef 100644 (file)
@@ -226,7 +226,7 @@ struct file {
 #define is_opened_file(_f) ((_f)->association >= 0)
 #define is_mapped_file(_f) (is_association((_f), SHM) || is_association((_f), MEM))
 #define is_association(_f, a)  ((_f)->association < 0 && (_f)->association == -ASSOC_ ## a)
-#define has_mnt_id(_f) (is_opened_file(_f))
+#define has_mnt_id(_f) (is_opened_file(_f) || is_mapped_file(_f))
 
 struct file_class {
        const struct file_class *super;