public inbox for linux-man@vger.kernel.org
 help / color / mirror / Atom feed
* Issue in man page getdents.2
@ 2023-11-01 14:02 Helge Kreutzmann
  2023-11-01 15:28 ` Alejandro Colomar
  0 siblings, 1 reply; 7+ messages in thread
From: Helge Kreutzmann @ 2023-11-01 14:02 UTC (permalink / raw)
  To: alx.manpages; +Cc: mario.blaettermann, linux-man

Without further ado, the following was found:

Issue:    Zero padding byte →  null padding byte?

msgid ""
"struct linux_dirent {\n"
"    unsigned long  d_ino;     /* Inode number */\n"
"    unsigned long  d_off;     /* Offset to next I<linux_dirent> */\n"
"    unsigned short d_reclen;  /* Length of this I<linux_dirent> */\n"
"    char           d_name[];  /* Filename (null-terminated) */\n"
"                      /* length is actually (d_reclen - 2 -\n"
"                         offsetof(struct linux_dirent, d_name)) */\n"
"    /*\n"
"    char           pad;       // Zero padding byte\n"
"    char           d_type;    // File type (only since Linux\n"
"                              // 2.6.4); offset is (d_reclen - 1)\n"
"    */\n"
"}\n"

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

* Re: Issue in man page getdents.2
  2023-11-01 14:02 Issue in man page getdents.2 Helge Kreutzmann
@ 2023-11-01 15:28 ` Alejandro Colomar
  2023-11-01 15:40   ` Helge Kreutzmann
  0 siblings, 1 reply; 7+ messages in thread
From: Alejandro Colomar @ 2023-11-01 15:28 UTC (permalink / raw)
  To: Helge Kreutzmann; +Cc: alx.manpages, mario.blaettermann, linux-man

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

Hi Helge,

On Wed, Nov 01, 2023 at 02:02:10PM +0000, Helge Kreutzmann wrote:
> Without further ado, the following was found:
> 
> Issue:    Zero padding byte →  null padding byte?
> 
> msgid ""
> "struct linux_dirent {\n"
> "    unsigned long  d_ino;     /* Inode number */\n"
> "    unsigned long  d_off;     /* Offset to next I<linux_dirent> */\n"
> "    unsigned short d_reclen;  /* Length of this I<linux_dirent> */\n"
> "    char           d_name[];  /* Filename (null-terminated) */\n"
> "                      /* length is actually (d_reclen - 2 -\n"
> "                         offsetof(struct linux_dirent, d_name)) */\n"
> "    /*\n"
> "    char           pad;       // Zero padding byte\n"

Both seem good to me.  Why not zero?

Cheers,
Alex

> "    char           d_type;    // File type (only since Linux\n"
> "                              // 2.6.4); offset is (d_reclen - 1)\n"
> "    */\n"
> "}\n"

-- 
<https://www.alejandro-colomar.es/>

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

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

* Re: Issue in man page getdents.2
  2023-11-01 15:28 ` Alejandro Colomar
@ 2023-11-01 15:40   ` Helge Kreutzmann
  2023-11-11 19:45     ` Alejandro Colomar
  0 siblings, 1 reply; 7+ messages in thread
From: Helge Kreutzmann @ 2023-11-01 15:40 UTC (permalink / raw)
  To: Alejandro Colomar; +Cc: alx.manpages, mario.blaettermann, linux-man

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

Hello Alejandro,
Am Wed, Nov 01, 2023 at 04:28:12PM +0100 schrieb Alejandro Colomar:
> Hi Helge,
> 
> On Wed, Nov 01, 2023 at 02:02:10PM +0000, Helge Kreutzmann wrote:
> > Without further ado, the following was found:
> > 
> > Issue:    Zero padding byte →  null padding byte?
> > 
> > msgid ""
> > "struct linux_dirent {\n"
> > "    unsigned long  d_ino;     /* Inode number */\n"
> > "    unsigned long  d_off;     /* Offset to next I<linux_dirent> */\n"
> > "    unsigned short d_reclen;  /* Length of this I<linux_dirent> */\n"
> > "    char           d_name[];  /* Filename (null-terminated) */\n"
> > "                      /* length is actually (d_reclen - 2 -\n"
> > "                         offsetof(struct linux_dirent, d_name)) */\n"
> > "    /*\n"
> > "    char           pad;       // Zero padding byte\n"
> 
> Both seem good to me.  Why not zero?

I'm not a programmer. But I thought the term was null? If this is not
the case, then disregard my proposal.

Greetings

         Helge

-- 
      Dr. Helge Kreutzmann                     debian@helgefjell.de
           Dipl.-Phys.                   http://www.helgefjell.de/debian.php
        64bit GNU powered                     gpg signed mail preferred
           Help keep free software "libre": http://www.ffii.de/

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

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

* Re: Issue in man page getdents.2
  2023-11-01 15:40   ` Helge Kreutzmann
@ 2023-11-11 19:45     ` Alejandro Colomar
  0 siblings, 0 replies; 7+ messages in thread
From: Alejandro Colomar @ 2023-11-11 19:45 UTC (permalink / raw)
  To: Helge Kreutzmann; +Cc: mario.blaettermann, linux-man

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

Hi Helge,

On Wed, Nov 01, 2023 at 03:40:50PM +0000, Helge Kreutzmann wrote:
> Hello Alejandro,
> Am Wed, Nov 01, 2023 at 04:28:12PM +0100 schrieb Alejandro Colomar:
> > Hi Helge,
> > 
> > On Wed, Nov 01, 2023 at 02:02:10PM +0000, Helge Kreutzmann wrote:
> > > Without further ado, the following was found:
> > > 
> > > Issue:    Zero padding byte →  null padding byte?
> > > 
> > > msgid ""
> > > "struct linux_dirent {\n"
> > > "    unsigned long  d_ino;     /* Inode number */\n"
> > > "    unsigned long  d_off;     /* Offset to next I<linux_dirent> */\n"
> > > "    unsigned short d_reclen;  /* Length of this I<linux_dirent> */\n"
> > > "    char           d_name[];  /* Filename (null-terminated) */\n"
> > > "                      /* length is actually (d_reclen - 2 -\n"
> > > "                         offsetof(struct linux_dirent, d_name)) */\n"
> > > "    /*\n"
> > > "    char           pad;       // Zero padding byte\n"
> > 
> > Both seem good to me.  Why not zero?
> 
> I'm not a programmer. But I thought the term was null? If this is not
> the case, then disregard my proposal.

It isn't simple.  Here's an overview of all the similar terms:
<https://lore.kernel.org/linux-man/ZU0eKrZprM5HSGt0@debian/>


-  NULL is a null pointer constant (as well as 0 is another null pointer
   constant; but don't use 0 for pointers, please).

-  A null pointer is a more generic term that includes a run-time null
   pointer as well. 

-  The null byte is 0.

-  The null character, '\0', is composed of a null byte.

-  The null wide character, L'\0' is composed of several null bytes.

-  NUL is the ASCII name of the null byte, or maybe is it null character
   here?  It's a bit muddy.


For padding, you'd use either null bytes, or equivalently, 0s, or zeros.

Cheers,
Alex

> 
> Greetings
> 
>          Helge
> 
> -- 
>       Dr. Helge Kreutzmann                     debian@helgefjell.de
>            Dipl.-Phys.                   http://www.helgefjell.de/debian.php
>         64bit GNU powered                     gpg signed mail preferred
>            Help keep free software "libre": http://www.ffii.de/



-- 
<https://www.alejandro-colomar.es/>

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

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

* Issue in man page getdents.2
@ 2024-11-17 10:46 Helge Kreutzmann
  2024-11-17 15:24 ` Alejandro Colomar
  0 siblings, 1 reply; 7+ messages in thread
From: Helge Kreutzmann @ 2024-11-17 10:46 UTC (permalink / raw)
  To: alx; +Cc: mario.blaettermann, linux-man

Without further ado, the following was found:

Issue:    B<readdir>(3)B<.> → B<readdir>(3).

"I<d_ino> is an inode number.  I<d_off> is a filesystem-specific value with "
"no specific meaning to user space, though on older filesystems it used to be "
"the distance from the start of the directory to the start of the next "
"I<linux_dirent>; see B<readdir>(3)B<.> I<d_reclen> is the size of this "
"entire I<linux_dirent>.  I<d_name> is a null-terminated filename."

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

* Re: Issue in man page getdents.2
  2024-11-17 10:46 Helge Kreutzmann
@ 2024-11-17 15:24 ` Alejandro Colomar
  0 siblings, 0 replies; 7+ messages in thread
From: Alejandro Colomar @ 2024-11-17 15:24 UTC (permalink / raw)
  To: Helge Kreutzmann; +Cc: mario.blaettermann, linux-man

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

On Sun, Nov 17, 2024 at 10:46:26AM GMT, Helge Kreutzmann wrote:
> Without further ado, the following was found:
> 
> Issue:    B<readdir>(3)B<.> → B<readdir>(3).
> 
> "I<d_ino> is an inode number.  I<d_off> is a filesystem-specific value with "
> "no specific meaning to user space, though on older filesystems it used to be "
> "the distance from the start of the directory to the start of the next "
> "I<linux_dirent>; see B<readdir>(3)B<.> I<d_reclen> is the size of this "
> "entire I<linux_dirent>.  I<d_name> is a null-terminated filename."

Fixed.  Thanks!

Cheers,
Alex

-- 
<https://www.alejandro-colomar.es/>

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

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

* Issue in man page getdents.2
@ 2025-08-24 14:48 Helge Kreutzmann
  0 siblings, 0 replies; 7+ messages in thread
From: Helge Kreutzmann @ 2025-08-24 14:48 UTC (permalink / raw)
  To: alx; +Cc: mario.blaettermann, linux-man

Without further ado, the following was found:

Issue:    B<ssize_t getdents64(>size_t count; → B<ssize_t getdents64(size_t >I<count>B<;>

"B<ssize_t getdents64(>size_t count;\n"
"B<                   int >I<fd>B<, void >I<dirp>B<[>I<count>B<], size_t >I<count>B<);>\n"

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

end of thread, other threads:[~2025-08-24 14:49 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-01 14:02 Issue in man page getdents.2 Helge Kreutzmann
2023-11-01 15:28 ` Alejandro Colomar
2023-11-01 15:40   ` Helge Kreutzmann
2023-11-11 19:45     ` Alejandro Colomar
  -- strict thread matches above, loose matches on Subject: below --
2024-11-17 10:46 Helge Kreutzmann
2024-11-17 15:24 ` Alejandro Colomar
2025-08-24 14:48 Helge Kreutzmann

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