From eb0f8239bc35c722c6daa9149bff42f088392f70 Mon Sep 17 00:00:00 2001 From: Aleksa Sarai Date: Thu, 7 Aug 2025 03:44:35 +1000 Subject: [PATCH] man/man2/mount_setattr.2: Document glibc >= 2.36 syscall wrappers glibc 2.36 added syscall wrappers for the entire family of fd-based mount syscalls, including mount_setattr(2). Thus it's no longer necessary to instruct users to do raw syscall(2) operations. Signed-off-by: Aleksa Sarai Cc: Cc: Cc: Cc: "Michael T. Kerrisk" Cc: Alexander Viro Cc: Jan Kara Cc: Askar Safin Cc: "G. Branden Robinson" Cc: David Howells Cc: Christian Brauner Message-ID: <20250807-new-mount-api-v2-1-558a27b8068c@cyphar.com> Signed-off-by: Alejandro Colomar --- man/man2/mount_setattr.2 | 45 +++++++--------------------------------- 1 file changed, 7 insertions(+), 38 deletions(-) diff --git a/man/man2/mount_setattr.2 b/man/man2/mount_setattr.2 index 60d9cf9de..c96f0657f 100644 --- a/man/man2/mount_setattr.2 +++ b/man/man2/mount_setattr.2 @@ -10,21 +10,12 @@ Standard C library .RI ( libc ,\~ \-lc ) .SH SYNOPSIS .nf -.BR "#include " " /* Definition of " AT_* " constants */" -.BR "#include " " /* Definition of " MOUNT_ATTR_* " constants */" -.BR "#include " " /* Definition of " SYS_* " constants */" -.B #include +.BR "#include " " /* Definition of " AT_* " constants */" +.B #include .P -.BI "int syscall(SYS_mount_setattr, int " dirfd ", const char *" path , -.BI " unsigned int " flags ", struct mount_attr *" attr \ -", size_t " size ); +.BI "int mount_setattr(int " dirfd ", const char *" path ", unsigned int " flags "," +.BI " struct mount_attr *" attr ", size_t " size );" .fi -.P -.IR Note : -glibc provides no wrapper for -.BR mount_setattr (), -necessitating the use of -.BR syscall (2). .SH DESCRIPTION The .BR mount_setattr () @@ -586,6 +577,7 @@ Linux 5.12. .\" commit 7d6beb71da3cc033649d641e1e608713b8220290 .\" commit 2a1867219c7b27f928e2545782b86daaf9ad50bd .\" commit 9caccd41541a6f7d6279928d9f971f6642c361af +glibc 2.36. .SH NOTES .SS ID-mapped mounts Creating an ID-mapped mount makes it possible to @@ -914,37 +906,14 @@ with a structure which has every byte nonzero #include #include #include -#include -#include +#include +#include #include #include #include #include -#include #include \& -static inline int -mount_setattr(int dirfd, const char *path, unsigned int flags, - struct mount_attr *attr, size_t size) -{ - return syscall(SYS_mount_setattr, dirfd, path, flags, - attr, size); -} -\& -static inline int -open_tree(int dirfd, const char *filename, unsigned int flags) -{ - return syscall(SYS_open_tree, dirfd, filename, flags); -} -\& -static inline int -move_mount(int from_dirfd, const char *from_path, - int to_dirfd, const char *to_path, unsigned int flags) -{ - return syscall(SYS_move_mount, from_dirfd, from_path, - to_dirfd, to_path, flags); -} -\& static const struct option longopts[] = { {"map\-mount", required_argument, NULL, \[aq]a\[aq]}, {"recursive", no_argument, NULL, \[aq]b\[aq]}, -- 2.47.2