+
+/*
+ * Set session ID to PID
+ */
+pid_t setsid(void)
+{
+ // TODO: actual syscall for this
+ return _SysGetPID();
+}
+
+pid_t getpid(void)
+{
+ return _SysGetPID();
+}
+
+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?
+ return _SysKill(pid, signal);
+}
+
+int select(int nfd, fd_set *rfd, fd_set *wfd, fd_set *efd, struct timeval *timeout)
+{
+ long long int ltimeout = 0, *ltimeoutp = NULL;
+ if( timeout )
+ {
+ ltimeout = timeout->tv_sec*1000 + timeout->tv_usec / 1000;
+ ltimeoutp = <imeout;
+ }
+ _SysDebug("select(%i,{0x%x},{0x%x},{0x%x},%lli)",
+ nfd, (rfd?rfd->flags[0]:0), (wfd?wfd->flags[0]:0), (efd?efd->flags[0]:0),
+ (ltimeoutp ? *ltimeoutp : -1)
+ );
+ return _SysSelect(nfd, rfd, wfd, efd, ltimeoutp, 0);
+}
+
+int pipe(int pipefd[2])
+{
+ pipefd[0] = _SysOpen("/Devices/fifo/anon", OPENFLAG_READ|OPENFLAG_WRITE);
+ pipefd[1] = _SysCopyFD(pipefd[0], -1);
+ _SysFDFlags(pipefd[1], OPENFLAG_READ|OPENFLAG_WRITE, OPENFLAG_WRITE);
+ _SysDebug("pipe({%i,%i})", pipefd[0], pipefd[1]);
+ 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;
+}
+