diff options
author | Ron Yorston <rmy@pobox.com> | 2021-09-21 12:52:24 +0100 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2021-09-21 13:24:00 +0100 |
commit | df34f5e92b1d10f0bb858d2ea6e8c249e87ac593 (patch) | |
tree | f90208eb2d6f3710833958f67e6101fc2fa85806 /win32 | |
parent | 48ddce5e9a063d89689ffe4be1680767186e13ee (diff) | |
download | busybox-w32-df34f5e92b1d10f0bb858d2ea6e8c249e87ac593.tar.gz busybox-w32-df34f5e92b1d10f0bb858d2ea6e8c249e87ac593.tar.bz2 busybox-w32-df34f5e92b1d10f0bb858d2ea6e8c249e87ac593.zip |
ash: improve signal handling
Allow waitpid() to detect SIGTERM/SIGKILL by checking the (Windows)
status returned by GetExitCodeProcess() and updating the Unix
status to suit. This allows ash to detect when a process has been
'signalled'.
Provide our own implementation of strsignal(3) which returns
expanded text for SIGTERM/SIGKILL.
Costs 192 bytes.
Diffstat (limited to 'win32')
-rw-r--r-- | win32/mingw.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/win32/mingw.c b/win32/mingw.c index 40714296f..b8dd6a511 100644 --- a/win32/mingw.c +++ b/win32/mingw.c | |||
@@ -171,6 +171,15 @@ char *mingw_strerror(int errnum) | |||
171 | return strerror(errnum); | 171 | return strerror(errnum); |
172 | } | 172 | } |
173 | 173 | ||
174 | char *strsignal(int sig) | ||
175 | { | ||
176 | if (sig == SIGTERM) | ||
177 | return (char *)"Terminated"; | ||
178 | else if (sig == SIGKILL) | ||
179 | return (char *)"Killed"; | ||
180 | return (char *)get_signame(sig); | ||
181 | } | ||
182 | |||
174 | static int zero_fd = -1; | 183 | static int zero_fd = -1; |
175 | static int rand_fd = -1; | 184 | static int rand_fd = -1; |
176 | 185 | ||