review request: 4244896: (process) Provide System.getPid(), System.killProcess(String pid)

Alan Bateman Alan.Bateman at
Mon Jun 25 09:52:47 UTC 2012

On 25/06/2012 09:56, Thomas Stüfe wrote:
> Hi, Rob,
> src/solaris/native/java/lang/UNIXProcess_md.c:
> You never check the return code of kill(2). kill() may fail if you
> have no permission to kill the process (EPERM), or if the process id
> is invalid, maybe it has already been reaped. In both cases an
> exception would be nice, or if you decide this cannot happen in the
> context of, at least an assert().
One thing to add to this is that the destroy method has been there since 
jdk1.0 and is not defined or specified to throw any exceptions so we 
can't really change that now. From the history it doesn't look like the 
return from kill(2) has ever been checked. As it can only ne used to 
send a signal to processes created by the ProcessBuilder or Runtime.exec 
API (not arbitrary process) then it is unlikely to fail. Whether the new 
destroy method should specify an exception may require consideration and 
maybe a separate bug should be created to consider that.


More information about the core-libs-dev mailing list