X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Usermode%2FLibraries%2Flibposix.so_src%2Funistd.c;h=dca29630e7e2f5b5e7a60175e681cd77df76e6df;hb=4e407e69bd660e9a32644281733192193ee6e8c8;hp=64cb70f5108e08fed66734f0ddbaf67c0ddc30f4;hpb=e5ee5df5d32c18b7679637056a7301f59ebbfefe;p=tpg%2Facess2.git diff --git a/Usermode/Libraries/libposix.so_src/unistd.c b/Usermode/Libraries/libposix.so_src/unistd.c index 64cb70f5..dca29630 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 @@ -202,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; @@ -286,3 +292,21 @@ int ttyname_r(int fd, char *buf, size_t buflen) return ENOTIMPL; } + +int isatty(int fd) +{ + if( fd < 0 ) { + errno = EBADF; + return 0; + } + + int type = _SysIOCtl(fd, DRV_IOCTL_TYPE, NULL); + if( type == -1 ) + return 0; + if( type != DRV_TYPE_TERMINAL ) { + errno = ENOTTY; + // NOTE: Pre POSIX 2001, EINVAL was returned + return 0; + } + return 1; +}