Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0006146OCamlOCaml otherlibspublic2013-08-29 12:232013-09-03 15:11
ReporterBardou 
Assigned Tofrisch 
PrioritynormalSeverityfeatureReproducibilityN/A
StatusresolvedResolutionfixed 
PlatformWindowsOSOS Version
Product Version 
Target Version4.02.0+devFixed in Version 
Summary0006146: Implement kill -9 using TerminateProcess, or provide TerminateProcess
DescriptionI implemented terminate_process like this:

#include <windows.h>

CAMLprim value o_terminate_process(value o_pid)
{
  CAMLparam1(o_pid);
  CAMLlocal1(o_result);

  // The implementation of Unix.create_process returns the Handle as PID.
  // Luckily this is exactly what we need.
  HANDLE pid = (HANDLE) Long_val(o_pid);
  BOOL result = TerminateProcess(pid, 0);
  o_result = Val_bool(result);

  CAMLreturn(o_result);
}

external terminate_process: int -> bool = "o_terminate_process"

I figured I might as well share the code. This could be used either to implement Unix.kill at least for signal SIGKILL. Or, a new function terminate_process could be provided. Just like create_process exists to simulate the Windows function CreateProcess using the Unix function fork, the terminate_process would exist to simulate the Windows function TerminateProcess using the Unix function kill.
TagsNo tags attached.
Attached Files

- Relationships

-  Notes
(0010266)
frisch (developer)
2013-08-30 15:30

LexiFi's version has implemented exactly that (implementing partially Unix.kill for Sys.sigkill). Unless someone argues in favor of a dedicated terminate_process function, I'll commit a version of the "Unix.kill" proposal.
(0010303)
frisch (developer)
2013-09-03 15:11

Wish granted (commit 14059 on trunk).

- Issue History
Date Modified Username Field Change
2013-08-29 12:23 Bardou New Issue
2013-08-30 15:30 frisch Note Added: 0010266
2013-08-30 15:32 frisch Assigned To => frisch
2013-08-30 15:32 frisch Status new => assigned
2013-08-30 15:32 frisch Target Version => 4.02.0+dev
2013-09-03 15:11 frisch Note Added: 0010303
2013-09-03 15:11 frisch Status assigned => resolved
2013-09-03 15:11 frisch Resolution open => fixed


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker