* 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'.
This commit is contained in:
@@ -1572,3 +1572,17 @@ fhandler_base::fixup_after_fork (HANDLE parent)
|
||||
debug_printf ("inheriting '%s' from parent", get_name ());
|
||||
fork_fixup (parent, io_handle, "io_handle");
|
||||
}
|
||||
|
||||
int
|
||||
fhandler_base::is_nonblocking ()
|
||||
{
|
||||
return (openflags & O_NONBLOCK_MASK) != 0;
|
||||
}
|
||||
|
||||
void
|
||||
fhandler_base::set_nonblocking (int yes)
|
||||
{
|
||||
int current = openflags & O_NONBLOCK_MASK;
|
||||
int new_flags = yes ? (!current ? O_NONBLOCK : current) : 0;
|
||||
openflags = (openflags & ~O_NONBLOCK_MASK) | new_flags;
|
||||
}
|
||||
|
Reference in New Issue
Block a user