fix stat() syscall

This commit is contained in:
Balazs Gerofi
2012-09-20 09:39:34 +09:00
parent bccfa3ef5b
commit da484cc1c5
2 changed files with 10 additions and 3 deletions

View File

@ -171,7 +171,7 @@ SYSCALL_DECLARE(stat)
{
SYSCALL_HEADER;
dkprintf("stat(\"%s\");\n", (char*)aal_mc_syscall_arg0(ctx));
SYSCALL_ARGS_2(D, D);
SYSCALL_ARGS_2(MO, MO);
SYSCALL_FOOTER;
}

View File

@ -493,14 +493,21 @@ int main_loop(int fd, int cpu)
case __NR_stat:
ret = stat((const char*)w.sr.args[0], (void *)dma_buf);
{
char filename[256];
do_syscall_load(fd, cpu, (unsigned long)&filename[0],
w.sr.args[0], 256);
ret = stat(filename, (void *)dma_buf);
if (ret == -1) {
ret = -errno;
}
do_syscall_return(fd, cpu, ret, 1, (unsigned long)dma_buf,
w.sr.args[1], sizeof(struct stat));
break;
}
case __NR_fstat:
ret = fstat(w.sr.args[0], (void *)dma_buf);
if (ret == -1) {