>
> The man page for getdirentries() says:
>
> int
> getdirentries(int fd, char *buf, int nbytes, long *basep)
>
> "The nbytes argument must be greater than or equal to the block
> size associated with the file, see stat(2). Some filesys-
> tems may not support these functions with buffers smaller than
> this size."
>
> So ... what are we supposed to use for this? For special filesystems
> like /proc, is any old value that is sufficiently large enough to hold
> a few struct dirent's considered to be OK? Should I not use
> 'getdirentries()', and opt instead for 'opendir()' and 'readdir()'?
>
> Any advice is appreciated.
I also had this problem (when I created a readdir equivalent for a port of a
non-libc using compiler).
I checked libc, and libc always seems to use 1024 bytes (constant called DIRBLKSIZ)
for nbytes. But I didn't try to
search /proc yet.
Also keep in mind that using getdirentries you could get duplicate entries
(libc readdir sorts and removes duplicates first).
I however don't know if this is just because of hardlinks (which most people
don't use afaik) or also for regular filehandling.
Marco van de Voort ([EMAIL PROTECTED] or [EMAIL PROTECTED])
To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message