[PATCH 9/9] man/man2/statmount.2: Document STATMOUNT_BY_FD
Bhavik Sachdev <[email protected]> Wed, 28 Jan 2026 19:27:38 +0530
| Newsgroups | dev.linux.lists.criu,org.kernel.vger.linux-man |
|---|---|
| Message-ID | <5bc8d1e2b565f5c10c9591c9fab8b6e7f545bf5d.1769608658.git.b.sachdev1904@gmail.com> |
STATMOUNT_BY_FD introduces the ability to get information about a mount using a fd on the mount. This functionality is currently in linux-next [1]. Link [1]: <https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?h=next-20260126&id=d5bc4e31f2a3f301b4214858bec834c67bb2be5c> Signed-off-by: Bhavik Sachdev <[email protected]> --- man/man2/statmount.2 | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/man/man2/statmount.2 b/man/man2/statmount.2 index 79ee752c1..d354f988e 100644 --- a/man/man2/statmount.2 +++ b/man/man2/statmount.2 @@ -24,6 +24,7 @@ .SH SYNOPSIS .EX .B struct mnt_id_req { .BR " __u32 size;" " /* sizeof(struct mnt_id_req) */" +.BR " __u32 mnt_fd;" " /* fd on the mount being queried */" .BR " __u64 mnt_id;" " /* The mnt_id being queried */" .BR " __u64 param;" " /* An ORed combination of the STATMOUNT_ constants */" .BR " __u32 mnt_ns_id;" " /* The id of mnt_ns to query the mnt_id in */" @@ -86,7 +87,7 @@ .SH DESCRIPTION .I bufsize with the fields filled in as described below. .I flags -must be 0. +must either be 0 or STATMOUNT_BY_FD. .P (Note that reserved space and padding is omitted.) .SS The mnt_id_req structure @@ -97,6 +98,23 @@ .SS The mnt_id_req structure it should always be set to .IR sizeof(struct\~mnt_id_req) . .P +.I req.mnt_fd +is a file descriptor on a mount. If STATMOUNT_BY_FD flag is specified, +.I req.mnt_id +and +.I req.mnt_ns_id +are zeroed, the function will return information about the mount the fd is on. +.P +The fd can also be on a mount that has been lazily unmounted (see +.BR umount2 (2) +with +.BR MNT_DETACH ). +In this case, +.BR STATMOUNT_MNT_POINT +and +.BR STATMOUNT_MNT_NS_ID +will be unset, since an unmounted mount is no longer a part of the filesystem. +.P .I req.mnt_id can be obtained from either .BR statx (2) @@ -366,6 +384,11 @@ .SH ERRORS points to a location outside the process's accessible address space. .TP +.B EBADF +.I req.mnt_fd +is an invalid file descriptor. +.TP +.TP .B EINVAL Invalid flag specified in .IR flags . @@ -374,6 +397,14 @@ .SH ERRORS .I req is of insufficient size to be utilized. .TP +.TP +.B EINVAL +.I req.mnt_id +or +.I req.mnt_ns_id +was specified alongside +.IR req.mnt_fd . +.TP .B E2BIG .I req is too large. -- 2.52.0