* [PATCH] man/man2/getdents.2: Fix incorrect argument type
@ 2026-04-04 7:49 vursc
2026-04-04 21:53 ` Mark Harris
0 siblings, 1 reply; 5+ messages in thread
From: vursc @ 2026-04-04 7:49 UTC (permalink / raw)
To: linux-man; +Cc: vursc
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 );
.fi
.P
.IR Note :
--
2.53.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] man/man2/getdents.2: Fix incorrect argument type
2026-04-04 7:49 [PATCH] man/man2/getdents.2: Fix incorrect argument type vursc
@ 2026-04-04 21:53 ` Mark Harris
2026-04-05 22:04 ` Alejandro Colomar
2026-04-06 5:37 ` vursc
0 siblings, 2 replies; 5+ messages in thread
From: Mark Harris @ 2026-04-04 21:53 UTC (permalink / raw)
To: vursc, linux-man
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.
- Mark
> .fi
> .P
> .IR Note :
> --
> 2.53.0
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] man/man2/getdents.2: Fix incorrect argument type
2026-04-04 21:53 ` Mark Harris
@ 2026-04-05 22:04 ` Alejandro Colomar
2026-04-06 5:37 ` vursc
1 sibling, 0 replies; 5+ messages in thread
From: Alejandro Colomar @ 2026-04-05 22:04 UTC (permalink / raw)
To: Mark Harris; +Cc: vursc, linux-man
[-- 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 --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] man/man2/getdents.2: Fix incorrect argument type
2026-04-04 21:53 ` Mark Harris
2026-04-05 22:04 ` Alejandro Colomar
@ 2026-04-06 5:37 ` vursc
2026-04-06 8:28 ` Alejandro Colomar
1 sibling, 1 reply; 5+ messages in thread
From: vursc @ 2026-04-06 5:37 UTC (permalink / raw)
To: Mark Harris, vursc, linux-man
Should I document the dirent64 structure in glibc? There are two
versions of struct dirent64 in glibc, in
glibc/sysdeps/unix/sysv/linux/bits/dirent.h and glibc/bits/dirent.h,
and the latter seems irrelevant on linux systems.
And I'm not sure about the wording. Feel free to reword it as you see
fit.
-vursc
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] man/man2/getdents.2: Fix incorrect argument type
2026-04-06 5:37 ` vursc
@ 2026-04-06 8:28 ` Alejandro Colomar
0 siblings, 0 replies; 5+ messages in thread
From: Alejandro Colomar @ 2026-04-06 8:28 UTC (permalink / raw)
To: vursc; +Cc: Mark Harris, linux-man, libc-help
[-- Attachment #1: Type: text/plain, Size: 895 bytes --]
Hi vursc,
On Mon, Apr 06, 2026 at 05:37:24AM +0000, vursc wrote:
> Should I document the dirent64 structure in glibc?
Given that it's different from the kernel one, I think we should
document both, yes.
> versions of struct dirent64 in glibc, in
> glibc/sysdeps/unix/sysv/linux/bits/dirent.h and glibc/bits/dirent.h,
> and the latter seems irrelevant on linux systems.
Yes, I seem to have the former in the installed headers. I don't know
why the latter exists. I've CCed libc-help@ in case they can help.
>
> And I'm not sure about the wording. Feel free to reword it as you see
> fit.
The current patch seems reasonable. If you add the glibc struct, I'll
add it, and later maybe I'll tweak that page to look more like other
pages.
Have a lovely day!
Alex
>
> -vursc
>
--
<https://www.alejandro-colomar.es>
Use port 80 (that is, <...:80/>).
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-04-06 8:28 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-04 7:49 [PATCH] man/man2/getdents.2: Fix incorrect argument type vursc
2026-04-04 21:53 ` Mark Harris
2026-04-05 22:04 ` Alejandro Colomar
2026-04-06 5:37 ` vursc
2026-04-06 8:28 ` Alejandro Colomar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox