Re: [PATCH] man/man2/getdents.2: Fix incorrect argument type

Alejandro Colomar
2026-04-05T22:04:51Z

[-- Attachment #1: Type: text/plain, Size: 2088 bytes --]

Hi Mark, vursc,

On Sat, Apr 04, 2026 at 02:53:07PM -0700, Mark Harris wrote:
> vursc wrote:
> >
> > The count argument of getdents64 is an unsigned int; see
> > SYSCALL_DEFINE3(getdents64, ...) in linux/fs/readdir.c.
> >
> > Signed-off-by: vursc <vursc@vursc.org>
> > ---
> > man/man2/getdents.2 | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/man/man2/getdents.2 b/man/man2/getdents.2
> > index 8c5bbebbc..3890943ee 100644
> > --- a/man/man2/getdents.2
> > +++ b/man/man2/getdents.2
> > @@ -23,7 +23,7 @@ Standard C library
> > .B #include <dirent.h>
> > .P
> > .BR "ssize_t getdents64(" "size_t count;"
> > -.BI " int " fd ", void " dirp [ count "], size_t " count );
> > +.BI " int " fd ", void " dirp [ count "], unsigned int " count );
>
> The third argument of the function has type size_t in glibc
> (https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/getdents64.c;hb=HEAD)
> and musl (https://git.musl-libc.org/cgit/musl/tree/src/linux/getdents.c).
> According to intro(2): "the manual pages in Section 2 generally try to
> note the details of both the (usually GNU) C library API interface and
> the raw system call. Most commonly, the main DESCRIPTION will focus
> on the C library interface, and differences for the system call are
> covered in the NOTES section." So rather than changing the function
> prototype, adding a note to the NOTES section may be more appropriate.
>
> That said, the DESCRIPTION section claims, "This page documents the
> bare kernel system call interfaces", so that should be corrected as
> well. It appears that that was written before the glibc function
> existed and is outdated.

Thanks! That seems the appropriate solution. vursc, would you mind
sending an updated patch set doing that? Or should I?

Have a lovely night!
Alex

> - Mark
>
>
> > .fi
> > .P
> > .IR Note :
> > --
> > 2.53.0
> >
> >
>

--
<https://www.alejandro-colomar.es>
Use port 80 (that is, <...:80/>).

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]