mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* win32/win32.c (kill): add support of signal 9 on mswin32/mingw32.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1393 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
fd379cd7f0
commit
0f55389d96
2 changed files with 31 additions and 9 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
Sat May 12 15:43:55 2001 Usaku Nakamura <usa@osb.att.ne.jp>
|
||||||
|
|
||||||
|
* win32/win32.c (kill): add support of signal 9 on mswin32/mingw32.
|
||||||
|
|
||||||
Fri May 11 15:09:52 2001 WATANABE Hirofumi <eban@ruby-lang.org>
|
Fri May 11 15:09:52 2001 WATANABE Hirofumi <eban@ruby-lang.org>
|
||||||
|
|
||||||
* ruby.h (rb_string_value): add volatile to avoid compiler warning.
|
* ruby.h (rb_string_value): add volatile to avoid compiler warning.
|
||||||
|
|
|
@ -2559,18 +2559,36 @@ chown(const char *path, int owner, int group)
|
||||||
int
|
int
|
||||||
kill(int pid, int sig)
|
kill(int pid, int sig)
|
||||||
{
|
{
|
||||||
#if 1
|
if ((unsigned int)pid == GetCurrentProcessId())
|
||||||
if ((unsigned int)pid == GetCurrentProcessId())
|
return raise(sig);
|
||||||
return raise(sig);
|
|
||||||
|
|
||||||
if (sig == 2 && pid > 0)
|
if (sig == 2 && pid > 0) {
|
||||||
if (GenerateConsoleCtrlEvent(CTRL_C_EVENT, (DWORD)pid))
|
if (!GenerateConsoleCtrlEvent(CTRL_C_EVENT, (DWORD)pid)) {
|
||||||
return 0;
|
errno = GetLastError();
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (sig == 9 && pid > 0) {
|
||||||
|
HANDLE hProc;
|
||||||
|
|
||||||
|
hProc = OpenProcess(PROCESS_TERMINATE, FALSE, pid);
|
||||||
|
if (hProc == NULL || hProc == INVALID_HANDLE_VALUE) {
|
||||||
|
errno = GetLastError();
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
if (!TerminateProcess(hProc, 0)) {
|
||||||
|
errno = GetLastError();
|
||||||
|
CloseHandle(hProc);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
CloseHandle(hProc);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
errno = EINVAL;
|
||||||
return -1;
|
return -1;
|
||||||
#else
|
}
|
||||||
return 0;
|
|
||||||
#endif
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue