From: Masatake YAMATO Date: Thu, 8 Jan 2026 21:59:56 +0000 (+0900) Subject: lsfd: fill MNTID coulmn for shm and mem assocations X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6b1fcee6ee46ef3ae81261bff089b29b8ff98440;p=thirdparty%2Futil-linux.git lsfd: fill MNTID coulmn for shm and mem assocations Signed-off-by: Masatake YAMATO --- diff --git a/lsfd-cmd/lsfd.c b/lsfd-cmd/lsfd.c index 26d0bd54a..429cd7b52 100644 --- a/lsfd-cmd/lsfd.c +++ b/lsfd-cmd/lsfd.c @@ -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); } diff --git a/lsfd-cmd/lsfd.h b/lsfd-cmd/lsfd.h index 63a9f460e..a33cebdca 100644 --- a/lsfd-cmd/lsfd.h +++ b/lsfd-cmd/lsfd.h @@ -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;