]> sourceware.org Git - newlib-cygwin.git/commitdiff
Cygwin: pty: Stop counting number of slaves attached to pseudo console.
authorTakashi Yano via Cygwin-patches <cygwin-patches@cygwin.com>
Mon, 25 May 2020 08:49:08 +0000 (17:49 +0900)
committerCorinna Vinschen <corinna@vinschen.de>
Mon, 25 May 2020 09:01:28 +0000 (11:01 +0200)
- The number of slaves attached to pseudo console is used only for
  triggering redraw screen. Counting was not only needless, but also
  did not work as expected. This patch removes the code for counting.

winsup/cygwin/fhandler_tty.cc
winsup/cygwin/tty.cc
winsup/cygwin/tty.h

index 5faf896e4ca30b519cdd442fd46807279fe62153..df08dd20ac0722ec506191a6b77c22f31b8adf6b 100644 (file)
@@ -1019,8 +1019,6 @@ fhandler_pty_slave::close ()
   fhandler_pty_common::close ();
   if (!ForceCloseHandle (output_mutex))
     termios_printf ("CloseHandle (output_mutex<%p>), %E", output_mutex);
-  if (pcon_attached_to == get_minor ())
-    get_ttyp ()->num_pcon_attached_slaves --;
   return 0;
 }
 
@@ -2924,21 +2922,11 @@ fhandler_pty_slave::fixup_after_attach (bool native_maybe, int fd_set)
     {
       if (fhandler_console::get_console_process_id (get_helper_process_id (),
                                                    true))
-       {
-         if (pcon_attached_to != get_minor ())
-           {
-             pcon_attached_to = get_minor ();
-             init_console_handler (true);
-           }
-         /* Clear screen to synchronize pseudo console screen buffer
-            with real terminal. This is necessary because pseudo
-            console screen buffer is empty at start. */
-         if (get_ttyp ()->num_pcon_attached_slaves == 0)
-           /* Assume this is the first process using this pty slave. */
-           get_ttyp ()->need_redraw_screen = true;
-
-         get_ttyp ()->num_pcon_attached_slaves ++;
-       }
+       if (pcon_attached_to != get_minor ())
+         {
+           pcon_attached_to = get_minor ();
+           init_console_handler (true);
+         }
 
 #if 0 /* This is for debug only. */
       isHybrid = true;
index 3fc46fb295c32e6b1bdcca209ed601bb08996bc9..efdae4697ad2c683c1f5c76af70f84edcaab6cce 100644 (file)
@@ -242,9 +242,8 @@ tty::init ()
   screen_alternated = false;
   mask_switch_to_pcon_in = false;
   pcon_pid = 0;
-  num_pcon_attached_slaves = 0;
   term_code_page = 0;
-  need_redraw_screen = false;
+  need_redraw_screen = true;
   fwd_done = NULL;
   pcon_last_time = 0;
   pcon_in_empty = true;
index c4dd2e45848af408b8c04ebdf5dbb40e7976d578..7d6fc8fefff38f526be830dc19d98c1e9286ff02 100644 (file)
@@ -103,7 +103,6 @@ private:
   bool screen_alternated;
   bool mask_switch_to_pcon_in;
   pid_t pcon_pid;
-  int num_pcon_attached_slaves;
   UINT term_code_page;
   bool need_redraw_screen;
   HANDLE fwd_done;
This page took 0.039494 seconds and 5 git commands to generate.