public inbox for linux-man@vger.kernel.org
 help / color / mirror / Atom feed
From: Alejandro Colomar <alx@kernel.org>
To: vursc <vursc@vursc.org>
Cc: linux-man@vger.kernel.org
Subject: Re: [PATCH v3] man/man2/getdents.2: Document system call interface of getdents64
Date: Tue, 7 Apr 2026 00:14:01 +0200	[thread overview]
Message-ID: <adQvZyzzkkjQ2KQK@debian> (raw)
In-Reply-To: <20260406092113.184487-2-vursc@vursc.org>

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

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 <vursc@vursc.org>

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).

> ---
>  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>

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

      reply	other threads:[~2026-04-06 22:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=adQvZyzzkkjQ2KQK@debian \
    --to=alx@kernel.org \
    --cc=linux-man@vger.kernel.org \
    --cc=vursc@vursc.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox