X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;ds=sidebyside;f=Usermode%2FLibraries%2Flibposix.so_src%2Funistd.c;h=545ef16402ab74731e6d7910737010d25d3a0c1e;hb=e632a3212d1767a18a74e7a7c35f52c8a1a784d2;hp=09b603cebad7db6933d597b22bb308d6f3be7ecd;hpb=a091753c1343f11c6d3594453470238da09b1517;p=tpg%2Facess2.git diff --git a/Usermode/Libraries/libposix.so_src/unistd.c b/Usermode/Libraries/libposix.so_src/unistd.c index 09b603ce..545ef164 100644 --- a/Usermode/Libraries/libposix.so_src/unistd.c +++ b/Usermode/Libraries/libposix.so_src/unistd.c @@ -12,6 +12,7 @@ #include #include #include +#include // === CODE === int unlink(const char *pathname) @@ -116,6 +117,18 @@ int dup2(int oldfd, int newfd) return _SysCopyFD(oldfd, newfd); } +int chown(const char *path, uid_t owner, gid_t group) +{ + _SysDebug("TODO: chown(%s, %i, %i)", path, owner, group); + errno = ENOTIMPL; + return -1; +} +int chmod(const char *path, mode_t mode) +{ + _SysDebug("TODO: chmod(%s, 0%o)", path, mode); + errno = ENOTIMPL; + return -1; +} /* * Set session ID to PID @@ -135,6 +148,10 @@ uid_t getuid(void) { return _SysGetUID(); } +gid_t getgid(void) +{ + return _SysGetGID(); +} uid_t geteuid(void) { @@ -142,6 +159,30 @@ uid_t geteuid(void) return _SysGetUID(); } +int seteuid(uid_t euid) +{ + _SysDebug("TODO: %s", __func__); + return 0; +} +int setegid(gid_t egid) +{ + _SysDebug("TODO: %s", __func__); + return 0; +} + +unsigned int sleep(unsigned int seconds) +{ + int64_t start = _SysTimestamp(); + _SysTimedSleep( seconds*1000 ); + return (_SysTimestamp() - start) / 1000; +} + +int usleep(useconds_t usec) +{ + _SysTimedSleep( (usec+999)/1000 ); + return 0; +} + int kill(pid_t pid, int signal) { // TODO: Need special handling? @@ -177,6 +218,14 @@ int chdir(const char *dir) return _SysChdir(dir); } +int rmdir(const char *pathname) +{ +// return _SysUnlink(pathname); + _SysDebug("TODO: POSIX rmdir('%s')", pathname); + errno = ENOTIMPL; + return -1; +} + int mkdir(const char *pathname, mode_t mode) { _SysDebug("TODO: POSIX mkdir('%s', 0%o)", pathname, mode);