diff options
| author | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2010-09-15 12:38:10 +1000 |
|---|---|---|
| committer | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2010-09-15 16:17:17 +1000 |
| commit | 507a5a689e7441782fcdbe96d88068dee9a3145e (patch) | |
| tree | 530da38ea52cdbb276327ca90aa8bcc4c5ca0e7b | |
| parent | 9e713dacbf3b6f8d114a337271c57dfccec58af7 (diff) | |
| download | busybox-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.h | 2 | ||||
| -rw-r--r-- | win32/process.c | 17 |
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); | |||
| 285 | int fcntl(int fd, int cmd, ...); | 285 | int fcntl(int fd, int cmd, ...); |
| 286 | #define fork() -1 | 286 | #define fork() -1 |
| 287 | IMPL(fsync,int,0,int fd UNUSED_PARAM); | 287 | IMPL(fsync,int,0,int fd UNUSED_PARAM); |
| 288 | NOIMPL(kill,pid_t pid UNUSED_PARAM, int sig UNUSED_PARAM); | 288 | int kill(pid_t pid, int sig); |
| 289 | int link(const char *oldpath, const char *newpath); | 289 | int link(const char *oldpath, const char *newpath); |
| 290 | NOIMPL(mknod,const char *name UNUSED_PARAM, mode_t mode UNUSED_PARAM, dev_t device UNUSED_PARAM); | 290 | NOIMPL(mknod,const char *name UNUSED_PARAM, mode_t mode UNUSED_PARAM, dev_t device UNUSED_PARAM); |
| 291 | int mingw_open (const char *filename, int oflags, ...); | 291 | int 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 | |||
| 321 | int 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 | } | ||
