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

So the return value is related to the size of the directory; the sum of the 
values
returned before End-Of-File should be quite close to the .st_size of the 
directory.
If a program is walking through the directory, reading all the entries via 
getdents64(),
then .st_size of the directory is the only thing known in advance about the 
total size.
(Of course anything involving a directory can depend on concurrent 
create/delete/rename
of files within the directory.)


On AFS directories are handled as files that the filesystem downloads and
parses locally.  The size returned in st_size is the size of the directory
content blob.
_______________________________________________
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