From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 7868) id 89E243858417; Fri, 4 Mar 2022 11:09:28 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 89E243858417 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Takashi Yano To: cygwin-cvs@sourceware.org Subject: [newlib-cygwin] Cygwin: pty: Omit transfer_input() call where it is no longer needed. X-Act-Checkin: newlib-cygwin X-Git-Author: Takashi Yano X-Git-Refname: refs/heads/master X-Git-Oldrev: e93c7cb571f20a79efd561d430ab4cb38e01a635 X-Git-Newrev: bb98c26e168bdd407ac6a67abd72d4d40186662c Message-Id: <20220304110928.89E243858417@sourceware.org> Date: Fri, 4 Mar 2022 11:09:28 +0000 (GMT) X-BeenThere: cygwin-cvs@cygwin.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Cygwin core component git logs List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Mar 2022 11:09:28 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dnewlib-cygwin.git;h=3Dbb98c26e168= bdd407ac6a67abd72d4d40186662c commit bb98c26e168bdd407ac6a67abd72d4d40186662c Author: Takashi Yano Date: Fri Mar 4 18:54:18 2022 +0900 Cygwin: pty: Omit transfer_input() call where it is no longer needed. =20 - This patch removes the old code which calls transfer_input() but is no longer needed. These code was necessary indeed in the past, however, as a result of recent frequent code changes, it is no longer needed. Diff: --- winsup/cygwin/fhandler_tty.cc | 47 ---------------------------------------= ---- 1 file changed, 47 deletions(-) diff --git a/winsup/cygwin/fhandler_tty.cc b/winsup/cygwin/fhandler_tty.cc index 76c5e2413..a0a5a70ba 100644 --- a/winsup/cygwin/fhandler_tty.cc +++ b/winsup/cygwin/fhandler_tty.cc @@ -1216,56 +1216,9 @@ fhandler_pty_slave::reset_switch_to_nat_pipe (void) && process_alive (get_ttyp ()->nat_pipe_owner_pid)) { /* There is a process which owns nat pipe. */ - if (!to_be_read_from_nat_pipe () - && get_ttyp ()->pty_input_state_eq (tty::to_nat)) - { - if (get_ttyp ()->pcon_activated) - { - HANDLE pcon_owner =3D OpenProcess (PROCESS_DUP_HANDLE, FALSE, - get_ttyp ()->nat_pipe_owner_pid); - if (pcon_owner) - { - HANDLE h_pcon_in; - DuplicateHandle (pcon_owner, get_ttyp ()->h_pcon_in, - GetCurrentProcess (), &h_pcon_in, - 0, TRUE, DUPLICATE_SAME_ACCESS); - DWORD target_pid =3D get_ttyp ()->nat_pipe_owner_pid; - DWORD resume_pid =3D attach_console_temporarily (target_pid); - WaitForSingleObject (input_mutex, mutex_timeout); - transfer_input (tty::to_cyg, h_pcon_in, get_ttyp (), - input_available_event); - ReleaseMutex (input_mutex); - resume_from_temporarily_attach (resume_pid); - CloseHandle (h_pcon_in); - CloseHandle (pcon_owner); - } - } - else if (!get_ttyp ()->nat_fg (get_ttyp ()->getpgid ()) - && get_ttyp ()->switch_to_nat_pipe) - { - WaitForSingleObject (input_mutex, mutex_timeout); - acquire_attach_mutex (mutex_timeout); - transfer_input (tty::to_cyg, get_handle_nat (), get_ttyp (), - input_available_event); - release_attach_mutex (); - ReleaseMutex (input_mutex); - } - } ReleaseMutex (pipe_sw_mutex); return; } - /* This input transfer is needed if non-cygwin app is terminated - by Ctrl-C or killed. */ - WaitForSingleObject (input_mutex, mutex_timeout); - if (get_ttyp ()->switch_to_nat_pipe && !get_ttyp ()->pcon_activated - && get_ttyp ()->pty_input_state_eq (tty::to_nat)) - { - acquire_attach_mutex (mutex_timeout); - transfer_input (tty::to_cyg, get_handle_nat (), get_ttyp (), - input_available_event); - release_attach_mutex (); - } - ReleaseMutex (input_mutex); /* Clean up nat pipe state */ get_ttyp ()->pty_input_state =3D tty::to_cyg; get_ttyp ()->nat_pipe_owner_pid =3D 0;