samples: add a mountinfo program to demonstrate statmount()/listmount()
authorJeff Layton <jlayton@kernel.org>
Fri, 15 Nov 2024 15:35:52 +0000 (10:35 -0500)
committerChristian Brauner <brauner@kernel.org>
Thu, 9 Jan 2025 15:58:50 +0000 (16:58 +0100)
commitc6640d46dc5a31ee7363545530836c10b9ddb9de
treeb6454d29f71641cf33c3bd53afe7393a68909424
parent344bac8f0d73fe970cd9f5b2f132906317d29e8b
samples: add a mountinfo program to demonstrate statmount()/listmount()

Add a new "mountinfo" sample userland program that demonstrates how to
use statmount() and listmount() to get at the same info that
/proc/pid/mountinfo provides.

The output of the program tries to mimic the mountinfo procfile
contents. With the -p flag, it can be pointed at an arbitrary pid to
print out info about its mount namespace. With the -r flag it will
attempt to walk all of the namespaces under the pid's mount namespace
and dump out mount info from all of them.

Signed-off-by: Jeff Layton <jlayton@kernel.org>
Link: https://lore.kernel.org/r/20241115-statmount-v2-1-cd29aeff9cbb@kernel.org
Signed-off-by: Christian Brauner <brauner@kernel.org>
samples/vfs/.gitignore
samples/vfs/Makefile
samples/vfs/mountinfo.c [new file with mode: 0644]