X-Git-Url: https://git.ucc.asn.au/?p=tpg%2Facess2.git;a=blobdiff_plain;f=Usermode%2FLibraries%2Flibposix.so_src%2Funistd.c;fp=Usermode%2FLibraries%2Flibposix.so_src%2Funistd.c;h=dca29630e7e2f5b5e7a60175e681cd77df76e6df;hp=3af7bcbc34f15cf7f54e38051a5f3112c3a83c4a;hb=845b6f9d90bb87b5e760e4d49aa93b0e003ab750;hpb=67a7fe2bb79eceaf10c572a99bd8345c4e81cf5b diff --git a/Usermode/Libraries/libposix.so_src/unistd.c b/Usermode/Libraries/libposix.so_src/unistd.c index 3af7bcbc..dca29630 100644 --- a/Usermode/Libraries/libposix.so_src/unistd.c +++ b/Usermode/Libraries/libposix.so_src/unistd.c @@ -292,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; +}