From: Takashi Yano <takashi.yano@nifty.ne.jp>
To: cygwin-patches@cygwin.com
Subject: Re: [PATCH] Cygwin: pipe: Restore non-blocking mode which was reset for non-cygwin app.
Date: Mon, 11 Mar 2024 20:42:37 +0900 [thread overview]
Message-ID: <20240311204237.bb2ffef477328542a63b148d@nifty.ne.jp> (raw)
In-Reply-To: <Ze7hRBVYCClZg-Kq@calimero.vinschen.de>
On Mon, 11 Mar 2024 11:47:32 +0100
Corinna Vinschen wrote:
> Hi Takashi,
>
> On Mar 10 19:31, Takashi Yano wrote:
> > @@ -590,6 +591,10 @@ child_info_spawn::worker (const char *prog_arg, const char *const *argv,
> > {
> > fhandler_pipe *pipe = (fhandler_pipe *)(fhandler_base *) cfd;
> > pipe->set_pipe_non_blocking (false);
> > + pipew_duped = (fhandler_pipe *)
> > + ccalloc (HEAP_FHANDLER, 1, sizeof (fhandler_pipe));
> > + pipew_duped = new (pipew_duped) fhandler_pipe;
> > + pipe->dup (pipew_duped, 0);
> > if (pipe->request_close_query_hdl ())
> > need_send_sig = true;
> > }
>
> The code setting up pipes and the dummy_tty is sufficiently complex,
> so that I wonder if it shouldn't have
>
> - its own methods and
> - comments to describe why this stuff is necessary.
>
> What about adding two methods, kind of like (the names are only
> suggestion, albeit bad ones):
>
> child_info_spawn::noncygwin_child_pre_fork()
>
> to keep the above stuff together (plus comments) and
>
> child_info_spawn::noncygwin_child_post_fork()
>
> for the below code?
>
> > @@ -597,6 +602,10 @@ child_info_spawn::worker (const char *prog_arg, const char *const *argv,
> > {
> > fhandler_pipe *pipe = (fhandler_pipe *)(fhandler_base *) cfd;
> > pipe->set_pipe_non_blocking (false);
> > + piper_duped = (fhandler_pipe *)
> > + ccalloc (HEAP_FHANDLER, 1, sizeof (fhandler_pipe));
> > + piper_duped = new (piper_duped) fhandler_pipe;
> > + pipe->dup (piper_duped, 0);
> > }
> >
> > if (need_send_sig)
> > @@ -905,6 +914,19 @@ child_info_spawn::worker (const char *prog_arg, const char *const *argv,
> > term_spawn_worker.cleanup ();
> > term_spawn_worker.close_handle_set ();
> > }
> > + if (pipew_duped)
> > + {
> > + bool is_nonblocking = pipew_duped->is_nonblocking ();
> > + pipew_duped->set_pipe_non_blocking (is_nonblocking);
>
> Is that really right? You're asking pipew_duped for its
> nonblocking flag and then set pipew_duped to the same value...?
>
> > + pipew_duped->close ();
> > + cfree (pipew_duped);
> > + }
Thanks for the reviewing and advice. I'll work for v2 patch. Please wait a while.
--
Takashi Yano <takashi.yano@nifty.ne.jp>
next prev parent reply other threads:[~2024-03-11 11:42 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-10 10:31 Takashi Yano
2024-03-11 10:47 ` Corinna Vinschen
2024-03-11 11:42 ` Takashi Yano [this message]
2024-03-11 13:18 ` Takashi Yano
2024-03-11 20:33 ` Corinna Vinschen
2024-03-11 23:03 ` Takashi Yano
2024-03-11 23:17 ` Takashi Yano
2024-03-12 10:53 ` Corinna Vinschen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240311204237.bb2ffef477328542a63b148d@nifty.ne.jp \
--to=takashi.yano@nifty.ne.jp \
--cc=cygwin-patches@cygwin.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).