From 6d3ebf6cd37781e4295757886450b761ce413b7d Mon Sep 17 00:00:00 2001 From: John Hodge Date: Wed, 3 Jul 2013 19:32:31 +0800 Subject: [PATCH] Usermode/libposix - opendir/mkdir --- Usermode/Libraries/libposix.so_src/dirent.c | 9 ++++++--- Usermode/Libraries/libposix.so_src/unistd.c | 5 +++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/Usermode/Libraries/libposix.so_src/dirent.c b/Usermode/Libraries/libposix.so_src/dirent.c index 5722aa45..920020a0 100644 --- a/Usermode/Libraries/libposix.so_src/dirent.c +++ b/Usermode/Libraries/libposix.so_src/dirent.c @@ -24,9 +24,10 @@ DIR *fdopendir(int fd) if( _SysFInfo(fd, &info, 0) != 0 ) return NULL; - - - return NULL; + DIR *ret = malloc(sizeof(DIR)); + ret->fd = fd; + ret->pos = 0; + return ret; } DIR *opendir(const char *name) @@ -48,6 +49,8 @@ int closedir(DIR *dp) errno = EINVAL; return -1; } + _SysClose(dp->fd); + free(dp); return 0; } diff --git a/Usermode/Libraries/libposix.so_src/unistd.c b/Usermode/Libraries/libposix.so_src/unistd.c index e41ebfd0..09b603ce 100644 --- a/Usermode/Libraries/libposix.so_src/unistd.c +++ b/Usermode/Libraries/libposix.so_src/unistd.c @@ -179,8 +179,9 @@ int chdir(const char *dir) int mkdir(const char *pathname, mode_t mode) { - _SysDebug("TODO: POSIX mkdir(%i, 0%o)", pathname, mode); - return -1; + _SysDebug("TODO: POSIX mkdir('%s', 0%o)", pathname, mode); + _SysMkDir(pathname); + return 0; } char *getpass(const char *prompt) -- 2.20.1