diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2011-07-22 22:50:42 +0400 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2011-07-22 22:50:42 +0400 |
commit | cfb517f39a8bcf2d995a732d250563917600408a (patch) | |
tree | 3364fef198143bd38cab062295dccc8a7e21659b /winsup/cygwin/fhandler_console.cc | |
parent | da7287ed5df365db96ae023e7e0540983e2b9ad8 (diff) |
* fhandler_tty.cc (fhandler_pty_slave::ioctl): Drop FIONBIO case.
Handle FIONREAD.
(fhandler_pty_master::ioctl): Ditto. Call fhandler_base::ioctl to
decode default condition.
* fhandler_console.cc (fhandler_console::ioctl): Handle FIONREAD.
Diffstat (limited to 'winsup/cygwin/fhandler_console.cc')
-rw-r--r-- | winsup/cygwin/fhandler_console.cc | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/winsup/cygwin/fhandler_console.cc b/winsup/cygwin/fhandler_console.cc index bf42218f4..4d2810203 100644 --- a/winsup/cygwin/fhandler_console.cc +++ b/winsup/cygwin/fhandler_console.cc @@ -32,6 +32,7 @@ details. */ #include "cygtls.h" #include "tls_pbuf.h" #include "registry.h" +#include <asm/socket.h> /* Don't make this bigger than NT_MAX_PATH as long as the temporary buffer is allocated using tmp_pathbuf!!! */ @@ -887,11 +888,20 @@ fhandler_console::ioctl (unsigned int cmd, void *buf) *(unsigned char *) buf = (unsigned char) dev_state.nModifiers; return 0; } - else - { - set_errno (EINVAL); - return -1; - } + set_errno (EINVAL); + return -1; + case FIONREAD: + { + DWORD n; + if (!GetNumberOfConsoleInputEvents (get_io_handle (), &n)) + { + __seterrno (); + return -1; + } + *(int *) buf = (int) n; + return 0; + } + break; } return fhandler_base::ioctl (cmd, buf); |