[prev in list] [next in list] [prev in thread] [next in thread] 

List:       cygwin-patches
Subject:    Re: [PATCH] Cygwin: FIFO: avoid hang after exec
From:       Corinna Vinschen <corinna-cygwin () cygwin ! com>
Date:       2019-04-18 17:36:06
Message-ID: 20190418173606.GH3599 () calimero ! vinschen ! de
[Download RAW message or body]


On Apr 18 15:39, Ken Brown wrote:
> Define fhandler:fifo::fixup_after_exec, which sets listen_client_thr
> and lct_termination_evt to NULL.  This forces the listen_client thread
> to restart on the first attempt to read after an exec.  Previously the
> exec'd process could hang in fhandler_fifo::raw_read.
> ---
>  winsup/cygwin/fhandler.h       | 1 +
>  winsup/cygwin/fhandler_fifo.cc | 9 +++++++++
>  2 files changed, 10 insertions(+)
> 
> diff --git a/winsup/cygwin/fhandler.h b/winsup/cygwin/fhandler.h
> index 8fb176b24..da007ee45 100644
> --- a/winsup/cygwin/fhandler.h
> +++ b/winsup/cygwin/fhandler.h
> @@ -1301,6 +1301,7 @@ public:
>    ssize_t __reg3 raw_write (const void *ptr, size_t ulen);
>    bool arm (HANDLE h);
>    void fixup_after_fork (HANDLE);
> +  void fixup_after_exec ();
>    int __reg2 fstatvfs (struct statvfs *buf);
>    void clear_readahead ()
>    {
> diff --git a/winsup/cygwin/fhandler_fifo.cc b/winsup/cygwin/fhandler_fifo.cc
> index 1d02adbaa..bc9c23998 100644
> --- a/winsup/cygwin/fhandler_fifo.cc
> +++ b/winsup/cygwin/fhandler_fifo.cc
> @@ -942,6 +942,15 @@ fhandler_fifo::fixup_after_fork (HANDLE parent)
>    fifo_client_unlock ();
>  }
>  
> +void
> +fhandler_fifo::fixup_after_exec ()
> +{
> +  fhandler_base::fixup_after_exec ();
> +  listen_client_thr = NULL;
> +  lct_termination_evt = NULL;
> +  fifo_client_unlock ();
> +}
> +
>  void
>  fhandler_fifo::set_close_on_exec (bool val)
>  {
> -- 
> 2.17.0

Pushed.  Developer snapshots should be up in 15 mins, give or take.


Thanks,
Corinna

-- 
Corinna Vinschen
Cygwin Maintainer

["signature.asc" (application/pgp-signature)]

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic