X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Usermode%2FLibraries%2Flibposix.so_src%2Funistd.c;h=3af7bcbc34f15cf7f54e38051a5f3112c3a83c4a;hb=12c9ce3978373fcadb7015e75cce56f6e181488d;hp=211948f88d57211c513de18c0b78b68720e81f1e;hpb=f3c8ff41bf688d23419c958a36de30847b694bc7;p=tpg%2Facess2.git diff --git a/Usermode/Libraries/libposix.so_src/unistd.c b/Usermode/Libraries/libposix.so_src/unistd.c index 211948f8..3af7bcbc 100644 --- a/Usermode/Libraries/libposix.so_src/unistd.c +++ b/Usermode/Libraries/libposix.so_src/unistd.c @@ -50,6 +50,12 @@ int open(const char *path, int openmode, ...) return ret; } +int access(const char *path, int openmode) +{ + errno = EINVAL; + return -1; +} + int creat(const char *path, mode_t mode) { // TODO: Make native call to do this cheaper @@ -183,6 +189,17 @@ int usleep(useconds_t usec) return 0; } +unsigned int alarm(unsigned int seconds) +{ + static int64_t alarm_time; + if( seconds > 0 ) + { + alarm_time = _SysTimestamp() + seconds * 1000; + // TODO: Schedule SIGALRM + } + return (alarm_time - _SysTimestamp()) / 1000; +} + int kill(pid_t pid, int signal) { // TODO: Need special handling? @@ -191,7 +208,7 @@ int kill(pid_t pid, int signal) int select(int nfd, fd_set *rfd, fd_set *wfd, fd_set *efd, struct timeval *timeout) { - long long int ltimeout = 0, *ltimeoutp = NULL; + int64_t ltimeout = 0, *ltimeoutp = NULL; if( timeout ) { ltimeout = timeout->tv_sec*1000 + timeout->tv_usec / 1000; @@ -242,6 +259,7 @@ char *getpass(const char *prompt) mode.OutputMode = 0; _SysIOCtl(STDIN_FILENO, PTY_IOCTL_SETMODE, &mode); fprintf(stderr, "%s", prompt); + fflush(stdin); // clear stdin buffer fgets(passbuf, PASS_MAX+1, stdin); fprintf(stderr, "\n"); for( int i = strlen(passbuf); i > 0 && (passbuf[i-1] == '\r' || passbuf[i-1] == '\n'); i -- ) @@ -270,5 +288,7 @@ int ttyname_r(int fd, char *buf, size_t buflen) _SysIOCtl(fd, PTY_IOCTL_GETID, NULL); + _SysDebug("TODO: ttyname_r"); + return ENOTIMPL; }