X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Usermode%2FLibraries%2Flibposix.so_src%2Funistd.c;fp=Usermode%2FLibraries%2Flibposix.so_src%2Funistd.c;h=211948f88d57211c513de18c0b78b68720e81f1e;hb=f3c8ff41bf688d23419c958a36de30847b694bc7;hp=545ef16402ab74731e6d7910737010d25d3a0c1e;hpb=bbace1ebc0a53c9b8c561de6a3a2d9955fcdab0b;p=tpg%2Facess2.git diff --git a/Usermode/Libraries/libposix.so_src/unistd.c b/Usermode/Libraries/libposix.so_src/unistd.c index 545ef164..211948f8 100644 --- a/Usermode/Libraries/libposix.so_src/unistd.c +++ b/Usermode/Libraries/libposix.so_src/unistd.c @@ -252,3 +252,23 @@ char *getpass(const char *prompt) return passbuf; } +char *ttyname(int fd) +{ + static char ttyname_buf[32]; + errno = ttyname_r(fd, ttyname_buf, sizeof(ttyname_buf)); + if(errno) return NULL; + + return ttyname_buf; +} +int ttyname_r(int fd, char *buf, size_t buflen) +{ + int type = _SysIOCtl(fd, DRV_IOCTL_TYPE, NULL); + if( type == -1 ) + return errno; + if( type != DRV_TYPE_TERMINAL ) + return ENOTTY; + + _SysIOCtl(fd, PTY_IOCTL_GETID, NULL); + + return ENOTIMPL; +}