PTY dies when master in parent process is closed.
Takashi Yano
takashi.yano@nifty.ne.jp
Thu Mar 12 11:12:00 GMT 2015
On Wed, 11 Mar 2015 17:48:29 +0100
Corinna Vinschen <corinna-cygwin@cygwin.com> wrote:
> I'm inclined to apply this patch. I think using PeekNamedPipe this way
> is pretty nice, albeit it's not atomic. It might be a good idea to add
> an acquire/release_output_mutex bracket, even if that doesn't help for
> cases in which a process holding a master fd crashes hard.
>
> Since you suggested it, do you have another idea?
Nothing in particular.
> Off the top of my head what we could do:
>
> - Either just set input_available_event always, unconditionally. But
> that probably requires to change fhandler_pty_slave::read as well.
The modification of fhandler_pty_slave::read() will be
probably not so small. To use PeekNamedPipe() or NtQueryObject()
is better, I suppose.
> - Or, use NtQueryObject to fetch the handle count of from_master (see
> flock.cc function get_obj_handle_count()). If the handle count is
> one, we're the last process holding the handle and then we set
> input_available_event. But I'm not sure if it's really worth it. The
> PeekNamedPipe usage looks rather ok to me.
When NtQueryObject() is used, aim is clearer than using
PeekNamedPipe(). However, either is OK. Please choose one
which you like.
> Oh, btw. Please always add the ChangeLog entries as plain text, not as
> diff. ChangeLog diffs usually don't apply without manual intervention.
Thank you for your advice. Next time, I will do so.
--
Takashi Yano <takashi.yano@nifty.ne.jp>
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
More information about the Cygwin
mailing list