diff options
author | Karel Zak | 2012-06-28 15:42:06 +0200 |
---|---|---|
committer | Karel Zak | 2012-06-28 15:46:38 +0200 |
commit | 7d8f4e0c4ba9b1feed4e0eadd17dd709ad45c838 (patch) | |
tree | ae94886cdf1f19aa7e342260b661b454886198b3 /misc-utils/findmnt.c | |
parent | libmount: save task ID for mountinfo tiles (diff) | |
download | kernel-qcow2-util-linux-7d8f4e0c4ba9b1feed4e0eadd17dd709ad45c838.tar.gz kernel-qcow2-util-linux-7d8f4e0c4ba9b1feed4e0eadd17dd709ad45c838.tar.xz kernel-qcow2-util-linux-7d8f4e0c4ba9b1feed4e0eadd17dd709ad45c838.zip |
findmnt: add TID column
just in case we read from more mountinfo files.
For example get mountpoint from the current namespace which is invisible
for initd (PID=1):
# unsahre -m bash
# mount /dev/sdb /mnt/test
# echo $$
30070
# findmnt -n -o TARGET,TID,SOURCE --task 1 --task $$ | \
sort -u --key=1,1 | awk ' ($2 != 1) { print $0 }'
/mnt/test 30070 /dev/sdb
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'misc-utils/findmnt.c')
-rw-r--r-- | misc-utils/findmnt.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/misc-utils/findmnt.c b/misc-utils/findmnt.c index 1ef812cee..094734d72 100644 --- a/misc-utils/findmnt.c +++ b/misc-utils/findmnt.c @@ -79,6 +79,7 @@ enum { COL_USED, COL_USEPERC, COL_FSROOT, + COL_TID, FINDMNT_NCOLUMNS }; @@ -120,6 +121,7 @@ static struct colinfo infos[FINDMNT_NCOLUMNS] = { [COL_USED] = { "USED", 5, TT_FL_RIGHT, N_("filesystem size used") }, [COL_USEPERC] = { "USE%", 3, TT_FL_RIGHT, N_("filesystem use percentage") }, [COL_FSROOT] = { "FSROOT", 0.25, TT_FL_NOEXTREMES, N_("filesystem root") }, + [COL_TID] = { "TID", 4, TT_FL_RIGHT, N_("task ID") }, }; /* global flags */ @@ -475,6 +477,13 @@ static const char *get_data(struct libmnt_fs *fs, int num) case COL_FSROOT: str = mnt_fs_get_root(fs); break; + case COL_TID: + if (mnt_fs_get_tid(fs)) { + char *tmp; + if (xasprintf(&tmp, "%d", mnt_fs_get_tid(fs)) > 0) + str = tmp; + } + break; default: break; } |