Usermode/libposix - Implimenting functions for dropbear
[tpg/acess2.git] / Usermode / Libraries / libposix.so_src / unistd.c
index 9234319..d8cbbf6 100644 (file)
@@ -9,6 +9,7 @@
 #include <acess/sys.h>
 #include <stdarg.h>
 #include <sys/select.h>
+#include <stdio.h>
 
 // === CODE ===
 int unlink(const char *pathname)
@@ -99,6 +100,16 @@ int dup2(int oldfd, int newfd)
        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 +120,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 +156,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(void)
+{
+       static char passbuf[PASS_MAX+1];
+       fprintf(stderr, "Password: ");
+       fgets(passbuf, PASS_MAX+1, stdin);
+       fprintf(stderr, "\n");
+       return passbuf;
+}
+

UCC git Repository :: git.ucc.asn.au