public inbox for linux-man@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] man/man2/getdents.2: Document system call interface of getdents64
@ 2026-04-06  5:35 vursc
  2026-04-06  9:21 ` [PATCH v3] " vursc
  0 siblings, 1 reply; 3+ messages in thread
From: vursc @ 2026-04-06  5:35 UTC (permalink / raw)
  To: linux-man; +Cc: vursc

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 glibc definition of the linux_dirent64 structure as dirent64.

Signed-off-by: vursc <vursc@vursc.org>
---
 man/man2/getdents.2 | 24 +++++++++++++++++++++---
 1 file changed, 21 insertions(+), 3 deletions(-)

diff --git a/man/man2/getdents.2 b/man/man2/getdents.2
index 8c5bbebbc..48bdf7bd7 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,29 @@ 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
+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 the
+.I linux_dirent64
+structure as
+.IR dirent64 .
+.P
 Probably, you want to use
 .BR readdir (3)
 instead of these system calls.
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-04-06 22:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-06  5:35 [PATCH v2] man/man2/getdents.2: Document system call interface of getdents64 vursc
2026-04-06  9:21 ` [PATCH v3] " vursc
2026-04-06 22:14   ` Alejandro Colomar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox