Linux MIPS Architecture development
 help / color / mirror / Atom feed
* readdir() problems
@ 2004-01-30  3:02 Mark and Janice Juszczec
  2004-01-30 18:47 ` Jun Sun
  0 siblings, 1 reply; 2+ messages in thread
From: Mark and Janice Juszczec @ 2004-01-30  3:02 UTC (permalink / raw)
  To: linux-mips


Hi folks

I'm running on a Helio pda, r3912 chip, little endian.  I've used crosstool 
to create a cross compiler with

gcc 3.2.3
glibc 2.2.3

When I run the following code (linked static or dynamic):

#include <stdio.h>
#include <sys/types.h>
#include <dirent.h>
#include <errno.h>

main(int argc, char **argv){
        DIR* dir;
        struct dirent* entry;
        int len;
        int hlen;
        char* name;
        char* buf;

        printf("in dirtest main()\n");
        fprintf(stderr,"in dirtest main()\n");
        dir = opendir("/bin");
        if (dir == 0) {
          fprintf(stderr,"opendir returned 0\n");
        }
        else{
                fprintf(stderr,"opendir returned dir=%x\n",dir);
        }

        entry=readdir(dir);
        fprintf(stderr,"after readdir\n");
        printf("errno=%d\n",errno);
        if (entry != 0){
          fprintf(stderr,"entry=%x\n",entry);
          name = entry->d_name;
          fprintf(stderr,"name=%s\n",name);
          while ((entry = readdir(dir)) != 0) {
                name = entry->d_name;
                fprintf(stderr,"name=%s\n",name);
          }
        }
        else{
          fprintf(stderr,"readdir failed and you can't reference entry\n");
        }

        closedir(dir);

}

I get the following output:

/bin # ./dirtest
in dirtest main()
opendir returned dir=100000c8

I can only assume its crashing after entry=readdir(dir)
Does anyone know of any readdir() problems in linux-mips world?

Mark

_________________________________________________________________
Learn how to choose, serve, and enjoy wine at Wine @ MSN. 
http://wine.msn.com/

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: readdir() problems
  2004-01-30  3:02 readdir() problems Mark and Janice Juszczec
@ 2004-01-30 18:47 ` Jun Sun
  0 siblings, 0 replies; 2+ messages in thread
From: Jun Sun @ 2004-01-30 18:47 UTC (permalink / raw)
  To: Mark and Janice Juszczec; +Cc: linux-mips, jsun

On Fri, Jan 30, 2004 at 03:02:09AM +0000, Mark and Janice Juszczec wrote:
> 
> Hi folks
> 
> I'm running on a Helio pda, r3912 chip, little endian.  I've used crosstool 
> to create a cross compiler with
> 
> gcc 3.2.3
> glibc 2.2.3
> 

I don't think it is a known problem.

FWIW, I just tested your program on r5500, LE machine with gcc 3.3.1/glibc 2.3.2.
It runs fine.

There is a remote chance something may be wrong with your kenel, but more
likely probably something is wrong with glibc or your userland environment.

Jun

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-01-30 18:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-01-30  3:02 readdir() problems Mark and Janice Juszczec
2004-01-30 18:47 ` Jun Sun

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox