зеркало из https://github.com/github/ruby.git
* win32/win32.c (kill): negate pid under Win9x.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2755 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
0d0ae37e50
Коммит
8790d9b76e
|
@ -1,3 +1,7 @@
|
|||
Wed Aug 28 17:45:03 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
|
||||
|
||||
* win32/win32.c (kill): negate pid under Win9x.
|
||||
|
||||
Wed Aug 28 16:36:40 2002 WATANABE Hirofumi <eban@ruby-lang.org>
|
||||
|
||||
* configure.in (ar): don't check twice for ar.
|
||||
|
@ -16,6 +20,7 @@ Wed Aug 28 15:00:29 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
|
|||
|
||||
* string.c (rb_str_intern): ditto.
|
||||
|
||||
>>>>>>> 1.1095
|
||||
Wed Aug 28 11:37:35 2002 NAKAMURA Usaku <usa@ruby-lang.org>
|
||||
|
||||
* win32/win32.h: define SIGINT and SIGKILL if not defined.
|
||||
|
|
|
@ -2337,23 +2337,30 @@ kill(int pid, int sig)
|
|||
{
|
||||
int ret = 0;
|
||||
|
||||
if (pid <= 0) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (IsWin95()) pid = -pid;
|
||||
if ((unsigned int)pid == GetCurrentProcessId() && sig != SIGKILL)
|
||||
return raise(sig);
|
||||
|
||||
if (sig == SIGINT && pid > 0) {
|
||||
switch (sig) {
|
||||
case SIGINT:
|
||||
RUBY_CRITICAL({
|
||||
if (!GenerateConsoleCtrlEvent(CTRL_C_EVENT, (DWORD)pid)) {
|
||||
errno = GetLastError();
|
||||
if ((errno = GetLastError()) == 0) {
|
||||
errno = EPERM;
|
||||
}
|
||||
ret = -1;
|
||||
}
|
||||
});
|
||||
}
|
||||
else if (sig == SIGKILL && pid > 0) {
|
||||
HANDLE hProc;
|
||||
break;
|
||||
|
||||
case SIGKILL:
|
||||
RUBY_CRITICAL({
|
||||
hProc = OpenProcess(PROCESS_TERMINATE, FALSE,
|
||||
IsWin95() ? -pid : pid);
|
||||
HANDLE hProc = OpenProcess(PROCESS_TERMINATE, FALSE, (DWORD)pid);
|
||||
if (hProc == NULL || hProc == INVALID_HANDLE_VALUE) {
|
||||
if (GetLastError() == ERROR_INVALID_PARAMETER) {
|
||||
errno = ESRCH;
|
||||
|
@ -2369,10 +2376,12 @@ kill(int pid, int sig)
|
|||
}
|
||||
CloseHandle(hProc);
|
||||
});
|
||||
}
|
||||
else {
|
||||
break;
|
||||
|
||||
define:
|
||||
errno = EINVAL;
|
||||
ret = -1;
|
||||
break;
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
|
Загрузка…
Ссылка в новой задаче