Thread (45 messages) 45 messages, 4 authors, 2025-08-07

Re: [PATCH 01/10] mount_setattr.2: document glibc >= 2.36 syscall wrappers

From: Alejandro Colomar <alx@kernel.org>
Date: 2025-08-06 07:51:28

Hi Aleksa,

On Wed, Aug 06, 2025 at 12:55:15PM +1000, Aleksa Sarai wrote:
quoted
quoted
@@ -10,21 +10,14 @@ Standard C library
 .RI ( libc ,\~ \-lc )
 .SH SYNOPSIS
 .nf
-.BR "#include <linux/fcntl.h>" " /* Definition of " AT_* " constants */"
-.BR "#include <linux/mount.h>" " /* Definition of " MOUNT_ATTR_* " constants */"
-.BR "#include <sys/syscall.h>" " /* Definition of " SYS_* " constants */"
+.B #define _GNU_SOURCE
+.B #include <sys/mount.h>
 .B #include <unistd.h>
+.BR "#include <fcntl.h>" "       /* Definition of " AT_* " constants */"
Please keep the include that provides the function prototype last.

And document with a comment the rationale for including all other
headers.
*All* of the headers? <sys/mount.h> includes both the prototype and
MOUNT_ATTR_* constants, and most other man pages only include an
explanation for some of the includes AFAICS.
Not all of them.  The only exception is the header that provides the
prototype; we never comment that one.

So, since this prototype is in <sys/mount.h>, this header should come
last and not have a comment.  But you should add a comment for why we
want <unistd.h>.
quoted
quoted
 .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 );
Please use array notation if you can.  Have a look at, for example,
strncpy(3), for how it's done in source code.
"struct mount_attr *attr" is not an array argument, it's an extensible
struct. mount_setattr(2) already has docs explaining this (in the
"Extensbility" section, as well as later in DESCRIPTION).
Ahhh, sorry.  So this is a versioning size.  Thanks!


Have a lovely day!
Alex

-- 
<https://www.alejandro-colomar.es/>

Attachments

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help