diff options
author | Takashi Yano <takashi.yano@nifty.ne.jp> | 2024-10-31 11:11:33 +0900 |
---|---|---|
committer | Takashi Yano <takashi.yano@nifty.ne.jp> | 2024-10-31 15:34:56 +0900 |
commit | 04f386e9af997d0929e90556cce712346bef0d68 (patch) | |
tree | 439d36b0cc14a58515a77bb8fc24f29569955bf0 /winsup/cygwin/local_includes/fhandler.h | |
parent | ae181b0ff1226cf38be8a7f03ff19bf869c87f54 (diff) | |
download | newlib-04f386e9af997d0929e90556cce712346bef0d68.zip newlib-04f386e9af997d0929e90556cce712346bef0d68.tar.gz newlib-04f386e9af997d0929e90556cce712346bef0d68.tar.bz2 |
Cygwin: console: Inherit pcon hand over from parent pty
There was a long-standing issue that pseudo console ownership could
not hand over from the process whose ctty is /dev/cons* rather than
/dev/pty*. This problem happens when a cygwin app starts non-cygwin
app in a pty, then the non-cygwin app starts multiple cygwin apps,
and the non-cygwin app ends before the second cygwin apps end.
In this case, the stub process of the non-cygwin app hands over the
ownership of pcon to one of the second cygwin apps, however, this
app does not hand over the ownership of pcon to another second
cygwin app. This is due to the fact that the hand-over feature is
implemented only in fhandler_pty_slave but not in fhandler_console.
With this patch, the second cygwin apps check if their console device
is inside a pseudo console, and if so, it tries to hand over the
ownership of the pseudo console to anther process that is attached
to the same pseudo console.
Addresses: https://cygwin.com/pipermail/cygwin/2024-February/255388.html
Fixes: 253352e796ff ("Cygwin: pty: Allow multiple apps to enable pseudo console simultaneously.")
Reported-by: lmari Lauhakangas <ilmari.lauhakangas@libreoffice.org>, Hossein Nourikhah <hossein@libreoffice.org>
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
Diffstat (limited to 'winsup/cygwin/local_includes/fhandler.h')
-rw-r--r-- | winsup/cygwin/local_includes/fhandler.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/winsup/cygwin/local_includes/fhandler.h b/winsup/cygwin/local_includes/fhandler.h index 1c339cf..5b025f8 100644 --- a/winsup/cygwin/local_includes/fhandler.h +++ b/winsup/cygwin/local_includes/fhandler.h @@ -2030,6 +2030,7 @@ class fhandler_termios: public fhandler_base virtual void setpgid_aux (pid_t pid) {} virtual bool need_console_handler () { return false; } virtual bool need_send_ctrl_c_event () { return true; } + static void atexit_func (); struct ptys_handle_set_t { @@ -2391,6 +2392,9 @@ private: console_unit (int, HANDLE *input_mutex = NULL); }; + void setup_pcon_hand_over (); + static void pcon_hand_over_proc (); + friend tty_min * tty_list::get_cttyp (); }; |