3 dirread, dirreadall \- read directory
10 long dirread(int fd, Dir **buf)
13 long dirreadall(int fd, Dir **buf)
16 #define STATMAX 65535U
19 #define DIRMAX (sizeof(Dir)+STATMAX)
21 The data returned by a
23 on a directory is a set of complete directory entries
24 in a machine-independent format, exactly equivalent to
27 on each file or subdirectory in the directory.
29 decodes the directory entries into a machine-dependent form.
32 and unpacks the data into an array of
35 whose address is returned in
41 The array is allocated with
50 but reads in the entire directory; by contrast,
52 steps through a directory one
56 Directory entries have variable length.
59 of a directory always returns an integral number of complete directory entries;
61 always returns complete
70 is the maximum size that a directory entry can occupy.
73 is an upper limit on the size necessary to hold a
75 structure and all the associated data.
84 The file offset is advanced by the number of bytes actually read.
86 .B /usr/local/plan9/src/libc/9sys/dirread.c
95 return zero for end of file and a negative value for error.
100 so the pointer can always be freed with impunity.