public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-6362] [Ada] Fix __gnat_kill on Windows
@ 2022-01-07 16:28 Pierre-Marie de Rodat
0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2022-01-07 16:28 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:20f6d5e4a8862f733e66f57ac9f2f2792903ac61
commit r12-6362-g20f6d5e4a8862f733e66f57ac9f2f2792903ac61
Author: Dmitriy Anisimkov <anisimko@adacore.com>
Date: Mon Dec 20 17:44:58 2021 +0600
[Ada] Fix __gnat_kill on Windows
gcc/ada/
* adaint.c (__gnat_kill): Terminate process only in case of
SIGKILL, SIGINT, SIGBREAK, SIGTERM, SIGABRT. Do not call
OpenProcess if not going to terminate process.
Diff:
---
gcc/ada/adaint.c | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
diff --git a/gcc/ada/adaint.c b/gcc/ada/adaint.c
index 2db35283eac..68f187b1fe2 100644
--- a/gcc/ada/adaint.c
+++ b/gcc/ada/adaint.c
@@ -3559,13 +3559,21 @@ void
__gnat_kill (int pid, int sig, int close ATTRIBUTE_UNUSED)
{
#if defined(_WIN32)
- HANDLE h = OpenProcess (PROCESS_ALL_ACCESS, FALSE, pid);
- if (h == NULL)
- return;
+ HANDLE h;
- TerminateProcess (h, sig);
+ switch (sig) {
+ case 9: // SIGKILL is not declared in Windows headers
+ case SIGINT:
+ case SIGBREAK:
+ case SIGTERM:
+ case SIGABRT:
+ h = OpenProcess (PROCESS_ALL_ACCESS, FALSE, pid);
+ if (h != NULL) {
+ TerminateProcess (h, sig);
+ CloseHandle (h);
+ }
+ }
- CloseHandle (h);
#elif defined (__vxworks)
/* Not implemented */
#else
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-01-07 16:28 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-07 16:28 [gcc r12-6362] [Ada] Fix __gnat_kill on Windows Pierre-Marie de Rodat
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).