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>2001-08-15 11:49:15 +0400
committerCorinna Vinschen <corinna@vinschen.de>2001-08-15 11:49:15 +0400
commit5fd12fb0cc61778a909bdae69d8f61d644e135ba (patch)
treeca8096e1a0fb1acc80061ecca2d966269a75b802 /winsup/cygwin/fhandler_tty.cc
parentda3ea61edda86f0f1c3176b5b1ee30265c5ec1a3 (diff)
* fhandler.cc (fhandler_base::is_nonblocking): New method.
(fhandler_base::set_nonblocking): Ditto. * fhandler.h (fhandler_base): Declare new methods `is_nonblocking' and `set_nonblocking'. * fhandler_socket.cc (fhandler_socket::ioctl): Use `set_nonblocking'. * fhandler_tty.cc (fhandler_pty_master::process_slave_output): Use `is_nonblocking'. (fhandler_tty_slave::read): Ditto. (fhandler_tty_slave::ioctl): Use `set_nonblocking'. (fhandler_pty_master::ioctl): Ditto. * net.cc (cygwin_sendto): Fallback to winsock 1 functionality in case of nonblocking IO. (cygwin_recvfrom): Ditto. (cygwin_recv): Ditto. (cygwin_send): Ditto. * syscalls.cc (_read): Use `is_nonblocking'.
Diffstat (limited to 'winsup/cygwin/fhandler_tty.cc')
-rw-r--r--winsup/cygwin/fhandler_tty.cc19
1 files changed, 4 insertions, 15 deletions
diff --git a/winsup/cygwin/fhandler_tty.cc b/winsup/cygwin/fhandler_tty.cc
index 942f31d08..5d51ca00a 100644
--- a/winsup/cygwin/fhandler_tty.cc
+++ b/winsup/cygwin/fhandler_tty.cc
@@ -25,8 +25,6 @@ details. */
#include "pinfo.h"
#include "cygheap.h"
#include "shared_info.h"
-#include "cygwin/version.h"
-#include "perprocess.h"
/* Tty master stuff */
@@ -297,7 +295,7 @@ fhandler_pty_master::process_slave_output (char *buf, size_t len, int pktmode_on
break;
if (hit_eof ())
goto out;
- if (n == 0 && (get_flags () & O_NONBLOCK_MASK) != 0)
+ if (n == 0 && is_nonblocking ())
{
set_errno (EAGAIN);
rc = -1;
@@ -748,8 +746,7 @@ fhandler_tty_slave::read (void *ptr, size_t len)
termios_printf ("saw EOF");
break;
}
- if (get_ttyp ()->ti.c_lflag & ICANON ||
- get_flags () & O_NONBLOCK_MASK)
+ if (get_ttyp ()->ti.c_lflag & ICANON || is_nonblocking ())
break;
if (totalread >= vmin && (vmin > 0 || totalread > 0))
break;
@@ -915,11 +912,7 @@ fhandler_tty_slave::ioctl (unsigned int cmd, void *arg)
case TIOCSWINSZ:
break;
case FIONBIO:
- {
- int current = get_flags () & O_NONBLOCK_MASK;
- int new_flags = *(int *) arg ? (!current ? O_NONBLOCK : current) : 0;
- set_flags ((get_flags () & ~O_NONBLOCK_MASK) | new_flags);
- }
+ set_nonblocking (*(int *) arg);
goto out;
default:
set_errno (EINVAL);
@@ -1099,11 +1092,7 @@ fhandler_pty_master::ioctl (unsigned int cmd, void *arg)
_kill (-get_ttyp ()->getpgid (), SIGWINCH);
break;
case FIONBIO:
- {
- int current = get_flags () & O_NONBLOCK_MASK;
- int new_flags = *(int *) arg ? (!current ? O_NONBLOCK : current) : 0;
- set_flags ((get_flags () & ~O_NONBLOCK_MASK) | new_flags);
- }
+ set_nonblocking (*(int *) arg);
break;
default:
set_errno (EINVAL);