[fpc-pascal] Findfirst/findnext with a samba share

Marco van de Voort marcov at stack.nl
Fri Mar 1 12:31:07 CET 2013


In our previous episode, Ludo Brands said:
> > 
> > The question is what is different in nautilus and midnight commander
> > comparing to fpc directoy-listing functions that allows them to list
> > directories correctly in the bug's case?
> > 
> 
> The difference with other tools is that FPC gives a very small buffer to
> getdents64. The strace for ls in the bug report
> http://bugs.freepascal.org/view.php?id=23732 shows that only one
> getdents is needed to get the full dir because the buffer size is much
> bigger.
> I don't know why getdents64 gets a buffer of only 280 bytes from FPC.
> This seems to me ridiculously low in modern systems and it has also an
> impact on the speed of findFirst/findNext.
> 

Maybe even wrong. I checked the FreeBSD implementation for the buffersize
(1kb btw), and there is the following comment (probably based on some
comment from FreeBSD sources):

"Getdents requires the buffer to be larger than the blocksize.
This usually the sectorsize =512 bytes, but maybe tapedrives and harddisks
with blockmode have this higher?"

Maybe Linux has a similar requirement.



More information about the fpc-pascal mailing list