guy@gorodish.UUCP (02/05/87)
The "getdents" manual page says: "getdents" attempts to read "nbyte" bytes from the directory associated with "fildes" and to format them as file system independent directory entries in the buffer pointed to by "buf". This is, err, umm, a bit misleading; it could be read as "'getdents' attempts to read 'nbyte' bytes worth of data from the directory associated with 'fildes', in whatever its native format is, and then stuff the converted directory entries into the buffer pointed to by 'buf'." That isn't what it does; it attempts to read "nbyte" bytes worth of file system independent directory entries and stuff them into the buffer pointed to by "buf". The number of bytes read from the directory need not have any simple relationship to the number of bytes returned by "getdents". If the file system is a V7 UNIX file system, the form on the file system is 16 bytes long on most systems, but the file-system independent form will generally be (10+strlen(name)+1+padding to appropriate boundary) bytes long. This could be less than 16 or more than 16. If the file system is a 4.2BSD UNIX file system, the form on the file system is variable-length (8+strlen(name)+1+padding) bytes, so the file system independent form will be longer. If the file system isn't a UNIX file system, it could go either way.