[ECOS] I have a problem about ecos support "opendir" function or not? thank you~

謝享金 (tom) palapala@iii.org.tw
Fri Sep 22 07:22:00 GMT 2006


Hi,

I was trying to run kvm (cldc 1.1) on ecos. And my host os is red hat9 running on VMware workstation 5. The target I choose when I install ecos is 癒禮i386-elf癒穡.

I will test on linux, so I created a configuration ecos.ecc for linux (ecosconfig new linux) and make the kernel. (include and lib)

After making the ecos kernel, I was changing the cc to i386-elf-gcc of preverify tool in cldc 1.1

When making the file, there will have problem that 癒禮DIR癒穡 is undeclared. As you can see below, the dirent.h in ecos kernel has extern 癒禮DIR癒穡. However, there is no lib for DIR in ecos kernel.(there is no lib which declare the struct of DIR in ecos kernel)
 
So I want to ask is ecos support opendir operation? I was check on google, but it is hardly to find the same problem with me. I think is the problem happened because my ecos kernel has building in a wrong way. Or actually, ecos does not support the directory operation like opendir or readdir, etc.
Thank you ~


the error message is :
[root@localhost linux]# make
i386-elf-gcc -c -I../../src -I/opt/ecos/work/helloworld/kernel/install/include/ -DUNIX -DLINUX -DJAVAVERIFY -DTRIMMED -Di386   ../../src/check_class.c
i386-elf-gcc -c -I../../src -I/opt/ecos/work/helloworld/kernel/install/include/ -DUNIX -DLINUX -DJAVAVERIFY -DTRIMMED -Di386   ../../src/main.c
../../src/main.c: In function 'recurse_dir':
../../src/main.c:95: error: 'DIR' undeclared (first use in this function)
../../src/main.c:95: error: (Each undeclared identifier is reported only once
../../src/main.c:95: error: for each function it appears in.)
../../src/main.c:95: error: 'dir' undeclared (first use in this function)
../../src/main.c:101: warning: assignment makes pointer from integer without a cast
../../src/main.c:101: warning: assignment makes pointer from integer without a cast
../../src/main.c:103: error: dereferencing pointer to incomplete type
../../src/main.c:128: error: 'S_IFDIR' undeclared (first use in this function)
../../src/main.c: In function 'ProcessInputs':
../../src/main.c:200: error: 'S_IFDIR' undeclared (first use in this function)
../../src/main.c: In function 'main':
../../src/main.c:289: warning: incompatible implicit declaration of built-in function 'strdup'
make: *** [main.o] Error 1
 

In /ecos/install/include/dirent.h
/* PROTOTYPES */
extern DIR *opendir( const char *dirname );
extern struct dirent *readdir( DIR *dirp );
extern int readdir_r( DIR *dirp, struct dirent *entry, struct dirent **result );                                                                                
extern void rewinddir( DIR *dirp );
extern int closedir( DIR *dirp );
 

the code in cldc preverifier:
static void recurse_dir(char *dirname, char *pkgname)
{
    struct dirent *ent;
        char buf[MAXPACKAGENAME];
        char pkgbuf[MAXPACKAGENAME];
    DIR *dir = opendir(dirname);
                                                                                
    if (dir == NULL) {
        fprintf(stderr, "Can't open dir %s\n", dirname);
        exit(1);
    }
    for (ent = readdir(dir); ent; ent = readdir(dir)) {
        struct stat stat_buf;
        char *name = ent->d_name;
        int len;
                                                                                
        if (strcmp(name, ".") == 0 || strcmp(name, "..") == 0) {
            continue;
        }




Best Regards,
Tom Hsieh

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss



More information about the Ecos-discuss mailing list