Subject: Re: [PATCH] compat/mingw: Allow SIGKILL to kill in mingw_kill.

From: Siddh Raman Pant <[email-masked]>
Date: Fri, 22 May 2026 08:03:56 +0000

On Fri, May 22 2026 at 12:02:52 +0530, Junio C Hamano wrote:
> I do not do windows, so I'd like to ask those much more clueful than
> I am to see if they see any downsides.
> 
> The current code only handles TERM (to terminate) or 0 (to probe)
> and everything else results in EINVAL, so the updated behaviour is
> to pretend as if TERM is sent and do whatever PROCESS_TERMINATE
> does, instead of doing nothing and erroring with EINVAL.  Which does
> sound like an improvement over the status quo.
> 
> What I am wondering is if there are different kind of "kill" in the
> Windows land, just like there are distinction between TERM and KILL.
> For example, the program ought to be able to block TERM but not
> KILL.  There are other termination-inducing signals like SIGQUIT but
> until we start using them in our code, this emulation layer does not
> have to know about them, I think.

From what I can see from the docs, there is no SIGTERM on Windows
either. So I did this change since the SIGTERM handling just looks
like a compatibility change in our code.

The docs at [1] says:
	The SIGILL and SIGTERM signals aren't generated under Windows.
	They're included for ANSI compatibility. Therefore, you can set
	signal handlers for these signals by using signal, and you can
	also explicitly generate these signals by calling raise.

Our helper uses TerminateProcess(). The docs at [2] says:
	The TerminateProcess function is used to unconditionally cause
	a process to exit.
	[...]
	A process cannot prevent itself from being terminated.

which is like SIGKILL.

So currently SIGTERM on Windows is behaving like a SIGKILL.

Thanks,
Siddh

[1] https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/signal
[2] https://learn.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-terminateprocess