X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;ds=sidebyside;f=Usermode%2FLibraries%2Flibposix.so_src%2Funistd.c;h=7cfb71abd00f8d4091b14864ce24e2e3514b672a;hb=4d184c30a3385600c0d87a2f93b4259c8c973e73;hp=9234319ee1adaf3694cf17517c97bfd72ac2c71f;hpb=e91f60e14b8857312238d729fa580d6ab44ba27a;p=tpg%2Facess2.git diff --git a/Usermode/Libraries/libposix.so_src/unistd.c b/Usermode/Libraries/libposix.so_src/unistd.c index 9234319e..7cfb71ab 100644 --- a/Usermode/Libraries/libposix.so_src/unistd.c +++ b/Usermode/Libraries/libposix.so_src/unistd.c @@ -9,6 +9,7 @@ #include #include #include +#include // === CODE === int unlink(const char *pathname) @@ -38,6 +39,9 @@ int open(const char *path, int openmode, ...) va_end(args); } + if( openmode & O_NONBLOCK ) + openflags |= OPENFLAG_NONBLOCK; + return _SysOpen(path, openflags, create_mode); } @@ -88,6 +92,7 @@ int execv(const char *b, char *v[]) int dup(int oldfd) { + _SysDebug("libposix: dup() does not share offsets/flags"); // NOTE: Acess's CopyFD doesn't cause offset sharing // TODO: Check that -1 does cause a new allocation return _SysCopyFD(oldfd, -1); @@ -95,10 +100,21 @@ int dup(int oldfd) int dup2(int oldfd, int newfd) { + _SysDebug("libposix: dup2() does not share offsets/flags"); // NOTE: Acess's CopyFD doesn't cause offset sharing return _SysCopyFD(oldfd, newfd); } + +/* + * Set session ID to PID + */ +pid_t setsid(void) +{ + // TODO: actual syscall for this + return _SysGetPID(); +} + pid_t getpid(void) { return _SysGetPID(); @@ -109,6 +125,12 @@ uid_t getuid(void) return _SysGetUID(); } +uid_t geteuid(void) +{ + // TODO: Impliment EUIDs in-kernel? + return _SysGetUID(); +} + int kill(pid_t pid, int signal) { // TODO: Need special handling? @@ -139,3 +161,23 @@ int pipe(int pipefd[2]) return 0; } +int chdir(const char *dir) +{ + return _SysChdir(dir); +} + +int mkdir(const char *pathname, mode_t mode) +{ + _SysDebug("TODO: POSIX mkdir(%i, 0%o)", pathname, mode); + return -1; +} + +char *getpass(const char *prompt) +{ + static char passbuf[PASS_MAX+1]; + fprintf(stderr, "%s", prompt); + fgets(passbuf, PASS_MAX+1, stdin); + fprintf(stderr, "\n"); + return passbuf; +} +