Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'winsup/cygwin/fhandler_console.cc')
-rw-r--r--winsup/cygwin/fhandler_console.cc20
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);