From 7a1174dcf22c00e6dcb8f9ad781df274aa722354 Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Sat, 31 Aug 2002 03:35:50 +0000 Subject: [PATCH] (inspired by a patch from Egor Duda) * select.cc (fhandler_tty_slave::ready_for_read): Remove. * fhandler.h (fhandler_tty_slave::ready_for_read): Remove declaration. * fhandler_tty.cc (fhandler_tty_slave::read): Don't do anything special with vtime when vmin == 0. * autoload.cc (GetConsoleWindow): Correct parameter count. --- winsup/cygwin/ChangeLog | 13 +++++++++++++ winsup/cygwin/autoload.cc | 2 +- winsup/cygwin/fhandler.h | 2 -- winsup/cygwin/fhandler_tty.cc | 16 ++++++++-------- winsup/cygwin/select.cc | 34 ---------------------------------- 5 files changed, 22 insertions(+), 45 deletions(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 3877a8506..980c083e0 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,8 +1,21 @@ +2002-08-30 Christopher Faylor + + (inspired by a patch from Egor Duda) + * select.cc (fhandler_tty_slave::ready_for_read): Remove. + * fhandler.h (fhandler_tty_slave::ready_for_read): Remove declaration. + * fhandler_tty.cc (fhandler_tty_slave::read): Don't do anything special + with vtime when vmin == 0. + +2002-07-25 Egor Duda + + * autoload.cc (GetConsoleWindow): Correct parameter count. + 2002-08-30 Christopher January Christopher Faylor * tty.cc (tty_list::allocate_tty): Use GetConsoleWindow, if available. Call FindWindow in a loop. + * autoload.cc (GetConsoleWindow): Export 2002-08-30 Christopher Faylor diff --git a/winsup/cygwin/autoload.cc b/winsup/cygwin/autoload.cc index 0c0334f11..7c3f47fc6 100644 --- a/winsup/cygwin/autoload.cc +++ b/winsup/cygwin/autoload.cc @@ -494,7 +494,7 @@ LoadDLLfunc (CoCreateInstance, 20, ole32) LoadDLLfuncEx (CancelIo, 4, kernel32, 1) LoadDLLfuncEx (CreateHardLinkA, 12, kernel32, 1) LoadDLLfuncEx (CreateToolhelp32Snapshot, 8, kernel32, 1) -LoadDLLfuncEx (GetConsoleWindow, 4, kernel32, 1) +LoadDLLfuncEx (GetConsoleWindow, 0, kernel32, 1) LoadDLLfuncEx2 (IsDebuggerPresent, 0, kernel32, 1, 1) LoadDLLfuncEx (Process32First, 8, kernel32, 1) LoadDLLfuncEx (Process32Next, 8, kernel32, 1) diff --git a/winsup/cygwin/fhandler.h b/winsup/cygwin/fhandler.h index a63c0514e..786c2ad02 100644 --- a/winsup/cygwin/fhandler.h +++ b/winsup/cygwin/fhandler.h @@ -888,8 +888,6 @@ class fhandler_tty_slave: public fhandler_tty_common __off64_t lseek (__off64_t, int) { return 0; } select_record *select_read (select_record *s); - int ready_for_read (int fd, DWORD howlong); - int cygserver_attach_tty (HANDLE*, HANDLE*); }; diff --git a/winsup/cygwin/fhandler_tty.cc b/winsup/cygwin/fhandler_tty.cc index acc32f883..95aff5fc1 100644 --- a/winsup/cygwin/fhandler_tty.cc +++ b/winsup/cygwin/fhandler_tty.cc @@ -412,6 +412,7 @@ process_ioctl (void *) fhandler_tty_slave::fhandler_tty_slave (int num) : fhandler_tty_common (FH_TTYS, num) { + set_r_no_interrupt (1); } fhandler_tty_slave::fhandler_tty_slave () @@ -666,12 +667,11 @@ fhandler_tty_slave::read (void *ptr, size_t len) if (vmin > INP_BUFFER_SIZE) vmin = INP_BUFFER_SIZE; vtime = get_ttyp ()->ti.c_cc[VTIME]; - if (vmin < 0) vmin = 0; - if (vtime < 0) vtime = 0; - if (vmin == 0) - time_to_wait = INFINITE; - else - time_to_wait = (vtime == 0 ? INFINITE : 100 * vtime); + if (vmin < 0) + vmin = 0; + if (vtime < 0) + vtime = 0; + time_to_wait = vtime == 0 ? INFINITE : 100 * vtime; } else time_to_wait = INFINITE; @@ -910,8 +910,8 @@ fhandler_tty_slave::ioctl (unsigned int cmd, void *arg) { termios_printf ("ioctl (%x)", cmd); - if (myself->pgid && get_ttyp ()->getpgid () != myself->pgid && - myself->ctty == ttynum && (get_ttyp ()->ti.c_lflag & TOSTOP)) + if (myself->pgid && get_ttyp ()->getpgid () != myself->pgid + && myself->ctty == ttynum && (get_ttyp ()->ti.c_lflag & TOSTOP)) { /* background process */ termios_printf ("bg ioctl pgid %d, tpgid %d, ctty %d", diff --git a/winsup/cygwin/select.cc b/winsup/cygwin/select.cc index c3c4158a4..34fa6c8b3 100644 --- a/winsup/cygwin/select.cc +++ b/winsup/cygwin/select.cc @@ -787,40 +787,6 @@ fhandler_tty_slave::select_read (select_record *s) return s; } -int -fhandler_tty_slave::ready_for_read (int fd, DWORD howlong) -{ - HANDLE w4[2]; - if (cygheap->fdtab.not_open (fd)) - { - set_sig_errno (EBADF); - return 0; - } - if (get_readahead_valid ()) - { - select_printf ("readahead"); - return 1; - } - w4[0] = signal_arrived; - w4[1] = input_available_event; - switch (WaitForMultipleObjects (2, w4, FALSE, howlong)) - { - case WAIT_OBJECT_0: - set_sig_errno (EINTR); - return 0; - case WAIT_OBJECT_0 + 1: - return 1; - case WAIT_FAILED: - select_printf ("wait failed %E"); - set_sig_errno (EINVAL); /* FIXME: correct errno? */ - return 0; - default: - if (!howlong) - set_sig_errno (EAGAIN); - return 0; - } -} - select_record * fhandler_dev_null::select_read (select_record *s) {