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:
authorCorinna Vinschen <corinna@vinschen.de>2011-07-22 22:50:42 +0400
committerCorinna Vinschen <corinna@vinschen.de>2011-07-22 22:50:42 +0400
commitcfb517f39a8bcf2d995a732d250563917600408a (patch)
tree3364fef198143bd38cab062295dccc8a7e21659b /winsup/cygwin/fhandler_tty.cc
parentda7287ed5df365db96ae023e7e0540983e2b9ad8 (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_tty.cc')
-rw-r--r--winsup/cygwin/fhandler_tty.cc35
1 files changed, 27 insertions, 8 deletions
diff --git a/winsup/cygwin/fhandler_tty.cc b/winsup/cygwin/fhandler_tty.cc
index 2a398c9d5..1d8d862ca 100644
--- a/winsup/cygwin/fhandler_tty.cc
+++ b/winsup/cygwin/fhandler_tty.cc
@@ -24,6 +24,7 @@ details. */
#include "shared_info.h"
#include "cygthread.h"
#include "child_info.h"
+#include <asm/socket.h>
#define close_maybe(h) \
do { \
@@ -960,10 +961,6 @@ fhandler_pty_slave::ioctl (unsigned int cmd, void *arg)
case TIOCGWINSZ:
case TIOCSWINSZ:
break;
- case FIONBIO:
- set_nonblocking (*(int *) arg);
- retval = 0;
- goto out;
case TIOCGPGRP:
{
pid_t pid = this->tcgetpgrp ();
@@ -979,6 +976,21 @@ fhandler_pty_slave::ioctl (unsigned int cmd, void *arg)
case TIOCSPGRP:
retval = this->tcsetpgrp ((pid_t) arg);
goto out;
+ case FIONREAD:
+ {
+ int n;
+ if (!PeekNamedPipe (get_handle (), NULL, 0, NULL, (DWORD *) &n, NULL))
+ {
+ __seterrno ();
+ retval = -1;
+ }
+ else
+ {
+ *(int *) arg = n;
+ retval = 0;
+ }
+ }
+ goto out;
default:
return fhandler_base::ioctl (cmd, arg);
}
@@ -1364,12 +1376,19 @@ fhandler_pty_master::ioctl (unsigned int cmd, void *arg)
break;
case TIOCSPGRP:
return this->tcsetpgrp ((pid_t) arg);
- case FIONBIO:
- set_nonblocking (*(int *) arg);
+ case FIONREAD:
+ {
+ int n;
+ if (!PeekNamedPipe (to_master, NULL, 0, NULL, (DWORD *) &n, NULL))
+ {
+ __seterrno ();
+ return -1;
+ }
+ *(int *) arg = n;
+ }
break;
default:
- set_errno (EINVAL);
- return -1;
+ return fhandler_base::ioctl (cmd, arg);
}
return 0;
}