John Reiser <jrei...@bitwagon.com> wrote:

> On 3/16/21, David Howells wrote:
> > John Reiser <jrei...@bitwagon.com> wrote:
> > 
> >> See the manual page "man 2 getdents".
> > Um, which bit?  I don't see anything obvious to that end.
> 
> On that manual page:
> =====
> The system call getdents() reads several linux_dirent structures from the 
> directory
> referred to by the open file descriptor fd into the buffer pointed to by dirp.
>    [snip]]
> On  success, the number of bytes read is returned.
> =====

It doesn't say anything about the size of the directory there.  "Number of
bytes read is returned" should be taken as how much of the user buffer was
filled - information you need to know to be able to parse it.

Further, there's getdents() and there's getdents64() and their structs are of
different sizes.  By your logic st_size would have to be the number of
linux_dirent structs for use with the former and the number of linux_dirent64
structs for use with the latter...  And then there's readdir() as well with
it's old_linux_dirent struct.

So, no, it cannot work like that.

David
_______________________________________________
devel mailing list -- devel@lists.fedoraproject.org
To unsubscribe send an email to devel-le...@lists.fedoraproject.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org
Do not reply to spam on the list, report it: 
https://pagure.io/fedora-infrastructure

Reply via email to