summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: ef7108c)
raw | patch | inline | side by side (parent: ef7108c)
author | Erik Faye-Lund <kusmabite@gmail.com> | |
Thu, 4 Nov 2010 01:35:15 +0000 (02:35 +0100) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Thu, 4 Nov 2010 23:53:50 +0000 (16:53 -0700) |
This is a quite limited kill-emulation; it can only handle
SIGTERM on positive pids. However, it's enough for git-daemon.
Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
SIGTERM on positive pids. However, it's enough for git-daemon.
Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
compat/mingw.c | patch | blob | history | |
compat/mingw.h | patch | blob | history |
diff --git a/compat/mingw.c b/compat/mingw.c
index 47a0e8861dd5d55a77b3476119ee5504fc922126..146a6ed79c848cd5dab31b24ee3a4ff635de63a3 100644 (file)
--- a/compat/mingw.c
+++ b/compat/mingw.c
mingw_execve(cmd, argv, environ);
}
+int mingw_kill(pid_t pid, int sig)
+{
+ if (pid > 0 && sig == SIGTERM) {
+ HANDLE h = OpenProcess(PROCESS_TERMINATE, FALSE, pid);
+
+ if (TerminateProcess(h, -1)) {
+ CloseHandle(h);
+ return 0;
+ }
+
+ errno = err_win_to_posix(GetLastError());
+ CloseHandle(h);
+ return -1;
+ }
+
+ errno = EINVAL;
+ return -1;
+}
+
static char **copy_environ(void)
{
char **env;
diff --git a/compat/mingw.h b/compat/mingw.h
index 379d7bff2cf35ad0829dbf7a0a5cc27986d7578c..51fca2f84581c55a16b19d8b37b55aba204d9088 100644 (file)
--- a/compat/mingw.h
+++ b/compat/mingw.h
#define WNOHANG 1
pid_t waitpid(pid_t pid, int *status, unsigned options);
+#define kill mingw_kill
+int mingw_kill(pid_t pid, int sig);
+
#ifndef NO_OPENSSL
#include <openssl/ssl.h>
static inline int mingw_SSL_set_fd(SSL *ssl, int fd)