Subject: weird d_namlen,d_type from readdir
To: None <current-users@sun-lamp.cs.berkeley.edu>
From: Zdenek Salvet <salvet@nyx.dcs.muni.cz>
List: current-users
Date: 06/21/1994 11:14:39
When trying to discover why my ld always creates static executables 
(with -Bdynamic and without it), I noticed that in shlib.c:findshlib 
readdir(dd) returns dirent struct with d_namlen field always set to 0
and d_type set to what should in d_namlen. I cannot find what I've screwed up 
during ld build.

I've found suspicious bit of code in /sys/kern/vfs_syscalls.c 
in function ogetdirentries :
 #                               if (BYTE_ORDER == LITTLE_ENDIAN)
                                        /*
                                         * The expected low byte of
                                         * dp->d_namlen is our dp->d_type.
                                         * The high MBZ byte of dp->d_namlen
                                         * is our dp->d_namlen.
                                         */
                                        dp->d_type = dp->d_namlen;
                                        dp->d_namlen = 0;

 My MACHINE_ARCH==i386 ( little endian byteorder ) and I configured COMPAT_43,
 so it is possible readdir calls old getdirentries syscall. I can't 
 believe that , my libc.so.11.0 is 7 days old and  /bin/ls is O.K.
 
 Any help appreciated,
 salvet@nyx.dcs.muni.cz 

------------------------------------------------------------------------------