[uClibc]Re: readdir with uclibc

Mike Bush mbush at rogers.com
Mon Feb 10 11:50:39 UTC 2003


Miles Bader wrote:

>Mike Bush <mbush at rogers.com> writes:
>  
>
>> I attempt to stat a the file, but it always will fail because
>>struct dirent 's d_name does not contain the proper file name.
>>
>>and I open and read the files in directory def, d_name contains the file 
>>name 'bc' not 'abc'
>>    
>>
>
>It sounds like you're getting the wrong <bits/dirent.h>, perhaps glibc's
>-- uClibc's version doesn't have the d_type file, and so the name starts
>one byte sooner.
>
>You might want to do a `cc -E' equivalent, and see where
><bits/dirent.h> is coming from.
>
>-Miles
>  
>

Well here is what -E shows:

/home/mike/build/i386-uclibc-dev/include/dirent.h
/home/mike/build/i386-uclibc-dev/include/bits/dirent.h

where /home/mike/build/i386-uclibc-dev/  is my development directory.


- uClibc -

struct dirent
{
  __ino_t d_ino;
  __off_t d_off;

  usigned short int d_reclen;

  char d_name[256];

 };




- glibc -

struct dirent
{
  long d_ino;
  off_t d_off;
  unsigned short d_reclen;
  char d_name [256];
}




More information about the uClibc mailing list