aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2010-09-15 12:38:10 +1000
committerNguyễn Thái Ngọc Duy <pclouds@gmail.com>2010-09-15 16:17:17 +1000
commit507a5a689e7441782fcdbe96d88068dee9a3145e (patch)
tree530da38ea52cdbb276327ca90aa8bcc4c5ca0e7b
parent9e713dacbf3b6f8d114a337271c57dfccec58af7 (diff)
downloadbusybox-w32-507a5a689e7441782fcdbe96d88068dee9a3145e.tar.gz
busybox-w32-507a5a689e7441782fcdbe96d88068dee9a3145e.tar.bz2
busybox-w32-507a5a689e7441782fcdbe96d88068dee9a3145e.zip
win32: process.c: implement kill(), SIGTERM only
-rw-r--r--include/mingw.h2
-rw-r--r--win32/process.c17
2 files changed, 18 insertions, 1 deletions
diff --git a/include/mingw.h b/include/mingw.h
index 53a0a0d67..a43e8eca2 100644
--- a/include/mingw.h
+++ b/include/mingw.h
@@ -285,7 +285,7 @@ IMPL(getuid,int,1,void);
285int fcntl(int fd, int cmd, ...); 285int fcntl(int fd, int cmd, ...);
286#define fork() -1 286#define fork() -1
287IMPL(fsync,int,0,int fd UNUSED_PARAM); 287IMPL(fsync,int,0,int fd UNUSED_PARAM);
288NOIMPL(kill,pid_t pid UNUSED_PARAM, int sig UNUSED_PARAM); 288int kill(pid_t pid, int sig);
289int link(const char *oldpath, const char *newpath); 289int link(const char *oldpath, const char *newpath);
290NOIMPL(mknod,const char *name UNUSED_PARAM, mode_t mode UNUSED_PARAM, dev_t device UNUSED_PARAM); 290NOIMPL(mknod,const char *name UNUSED_PARAM, mode_t mode UNUSED_PARAM, dev_t device UNUSED_PARAM);
291int mingw_open (const char *filename, int oflags, ...); 291int mingw_open (const char *filename, int oflags, ...);
diff --git a/win32/process.c b/win32/process.c
index 1b9b61878..cdd71182b 100644
--- a/win32/process.c
+++ b/win32/process.c
@@ -317,3 +317,20 @@ procps_status_t* FAST_FUNC procps_scan(procps_status_t* sp, int flags)
317 strncpy(sp->comm, pe.szExeFile, COMM_LEN); 317 strncpy(sp->comm, pe.szExeFile, COMM_LEN);
318 return sp; 318 return sp;
319} 319}
320
321int kill(pid_t pid, int sig)
322{
323 HANDLE h;
324
325 if (sig != SIGTERM) {
326 bb_error_msg("kill only supports SIGTERM");
327 errno = ENOSYS;
328 return -1;
329 }
330 h = OpenProcess(PROCESS_TERMINATE, FALSE, pid);
331 if (h == NULL)
332 return -1;
333 if (TerminateProcess(h, 0) == 0)
334 return -1;
335 return 0;
336}