From 9d32f840c011c7b8058cb1fae6b34faf5ebe0d47 Mon Sep 17 00:00:00 2001 From: Bahadir Balban Date: Wed, 16 Apr 2008 00:34:11 +0100 Subject: [PATCH] Open wasn't returning the fd but 0 on success :-S. fixed. --- tasks/fs0/src/syscalls.c | 4 ++-- tasks/test0/src/dirtest.c | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/tasks/fs0/src/syscalls.c b/tasks/fs0/src/syscalls.c index 19fd1aa..c05cd96 100644 --- a/tasks/fs0/src/syscalls.c +++ b/tasks/fs0/src/syscalls.c @@ -79,7 +79,7 @@ int vfs_create(struct tcb *task, struct pathdata *pdata, unsigned int mode) if ((err = vparent->ops.mknod(vparent, nodename, mode)) < 0) return err; - print_vnode(vparent); + // print_vnode(vparent); return 0; } @@ -130,7 +130,7 @@ int sys_open(l4id_t sender, const char *pathname, int flags, unsigned int mode) BUG_ON(pager_sys_open(sender, fd, v->vnum, v->size) < 0); pathdata_destroy(pdata); - l4_ipc_return(0); + l4_ipc_return(fd); return 0; } diff --git a/tasks/test0/src/dirtest.c b/tasks/test0/src/dirtest.c index 0a21b27..1c04047 100644 --- a/tasks/test0/src/dirtest.c +++ b/tasks/test0/src/dirtest.c @@ -113,7 +113,8 @@ int lsdir(char *path) if ((fd = open(path, O_RDONLY)) < 0) { perror("OPEN"); return 0; - } + } else + printf("Got fd: %d for opening %s\n", fd, path); if ((bytes = os_readdir(fd, dents, sizeof(struct dirent) * DENTS_TOTAL)) < 0) { perror("GETDENTS\n"); @@ -161,6 +162,9 @@ int dirtest(void) printf("\nlsdir root directory:\n"); lsdir("/"); + printf("\nlsdir /usr:\n"); + lsdir("/usr"); + return 0; }