Re: [PATCH v3] man/man2/getdents.2: Document system call interface of getdents64
From: Alejandro Colomar <alx@kernel.org>
Date: 2026-04-06 22:14:06
Hi vursc, On 2026-04-06T09:21:14+0000, vursc wrote:
The count argument of the getdents64 system call is assumed to not exceed INT_MAX. The glibc function accepts a size_t and passes INT_MAX to the kernel if count exceeds INT_MAX. Also document the dirent64 structure in glibc. Signed-off-by: vursc <redacted>
Thanks! I applied the patch. Just FYI, there was a warning: Applying: man/man2/getdents.2: Document system call interface of getdents64 .../rebase-apply/patch:42: trailing whitespace. .I dirent64 warning: 1 line adds whitespace errors. I've amended it (it was just a trailing white space).
quoted hunk ↗ jump to hunk
--- man/man2/getdents.2 | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-)diff --git a/man/man2/getdents.2 b/man/man2/getdents.2 index 8c5bbebbc..de91f3800 100644 --- a/man/man2/getdents.2 +++ b/man/man2/getdents.2@@ -42,7 +42,6 @@ These are not the interfaces you are interested in. Look at .BR readdir (3) for the POSIX-conforming C library interface. -This page documents the bare kernel system call interfaces. .SS getdents() The system call .BR getdents ()@@ -216,10 +215,31 @@ using .BR syscall (2). In that case you will need to define the .I linux_dirent -or -.I linux_dirent64 structure yourself. .P +The +.B getdents64
I've changed this to .BR getdents64 () Have a lovely night! Alex
+system call accepts an +.B unsigned int +argument +.I count +and assumes that +.I count +does not exceed +.BR INT_MAX . +The glibc wrapper function sets +.I count +to +.B INT_MAX +if it exceeds +.BR INT_MAX . +glibc defines a +.I dirent64 +structure, which is similar to +.I linux_dirent64 +but with a 256-byte +.IR d_name . +.P Probably, you want to use .BR readdir (3) instead of these system calls. -- 2.53.0
-- <https://www.alejandro-colomar.es>
Attachments
- signature.asc [application/pgp-signature] 833 bytes