Hi Yuyi,

On Sat, 8 Mar 2025 16:43:05 +0800
Yuyi Wang wrote:
> 
> The current behavior returns EINVAL on these 2 signals, which is
> different from the requirement of POSIX. In addition, it makes
> posix_spawn fail to set POSIX_SPAWN_SETSIGDEF. In
> newlib/libc/posix/posix_spawn.c:200, it tries to set for all signals
> including SIGKILL & SIGSTOP, and sigaction should not fail.
> ---
>   winsup/cygwin/signal.cc | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/winsup/cygwin/signal.cc b/winsup/cygwin/signal.cc
> index f8ba67e75..a964c3b29 100644
> --- a/winsup/cygwin/signal.cc
> +++ b/winsup/cygwin/signal.cc
> @@ -440,7 +440,7 @@ sigaction_worker (int sig, const struct sigaction 
> *newact,
>                     oa.sa_handler);
>             if (sig == SIGKILL || sig == SIGSTOP)
>           {
> -          set_errno (EINVAL);
> +          res = 0;
>             __leave;
>           }
>             struct sigaction na = *newact;
> -- 
> 2.48.0
> 

Thanks for the patch. However, Corinna and I do not think this is
the right thing. sigaction() returns EINVAL for SIGKILL/SIGSTOP
on Linux as well.

I disccussed with Corinna, and concluded the problem is in posix_spawn()
rather than sigaction(). posix_spawn() must not try to call sigaction()
on SIGKILL/SIGSTOP.

Would you like to create a patch for posix_spawn()? Or shall we do that?

-- 
Takashi Yano <[email protected]>

Reply via email to