[question]

kees (kees@schoen.nl)
Tue, 19 Jan 1999 00:31:39 +0100 (MET)


Hello Friends,
I'm puzzled by the returned data of the 'readdir' call. The dirent
structure has a d_reclen entry. If I run a small C program under 2.0.36
which returns the d_reclen of the root directory entries I get:

d_name '.'
d_reclen:12 strlen(d_name):1
d_name '..'
d_reclen:16 strlen(d_name):2
d_name 'lost+found'
d_reclen:24 strlen(d_name):10
d_name 'tmp'
d_reclen:16 strlen(d_name):3
d_name 'var'
d_reclen:16 strlen(d_name):3
d_name 'etc'
d_reclen:16 strlen(d_name):3

[snipped]

d_reclen is *very* different from the strlen of the entry. I would expect
d_reclen to be equal to the strlen result. d_recelen seems to return the
number of bytes of allocation in the directory file, these are multiple
of 4 . 32 bits INTS.
In the GNU C_library in the function getcwd d_reclen (d_namelen) is used
to build the pathname which sometimes give odd results i.e. somewhere in a
mounted NCP or Samba tree.
If one uses 'less' or 'vi' or '/bin/pwd' these programs complain that they
are unable to find the current working directory.

Regards
Kees

PS: I tried Alan Cox before but "It's on his queue" so may take a while
before he is able to look at it. :-)

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/