Thread (5 messages) 5 messages, 3 authors, 2026-04-06

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

From: Mark Harris <hidden>
Date: 2026-04-04 21:53:21

vursc wrote:
quoted hunk ↗ jump to hunk
The count argument of getdents64 is an unsigned int; see
SYSCALL_DEFINE3(getdents64, ...) in linux/fs/readdir.c.

Signed-off-by: vursc <redacted>
---
 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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help