This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: PTY dies when master in parent process is closed.
- From: Takashi Yano <takashi dot yano at nifty dot ne dot jp>
- To: cygwin at cygwin dot com
- Date: Thu, 12 Mar 2015 20:03:43 +0900
- Subject: Re: PTY dies when master in parent process is closed.
- Authentication-results: sourceware.org; auth=none
- References: <20150305215323 dot 760df4752fdbd6f19a931851 at nifty dot ne dot jp> <20150305133100 dot GY3213 at calimero dot vinschen dot de> <20150305135839 dot GZ3213 at calimero dot vinschen dot de> <20150306200710 dot 1264a46aa8dd633943e56212 at nifty dot ne dot jp> <20150308163759 dot 9d3eacd5f3b168a1515a6bc2 at nifty dot ne dot jp> <20150311164829 dot GJ5732 at calimero dot vinschen dot de>
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