1
1

* Implement kill_job and kill_proc code

This commit was SVN r3732.
Этот коммит содержится в:
Brian Barrett 2004-12-07 15:41:40 +00:00
родитель 67a2d47a49
Коммит 6dc570c7a1

Просмотреть файл

@ -17,11 +17,15 @@
#include "ompi_config.h"
#include <errno.h>
#include <signal.h>
#include "pcm_bproc.h"
#include "mca/pcm/pcm.h"
#include "mca/pcm/base/base.h"
#include "class/ompi_list.h"
#include "mca/pcm/base/base_job_track.h"
#include "mca/ns/ns.h"
#include "mca/ns/base/base.h"
int
@ -29,11 +33,22 @@ mca_pcm_bproc_kill_proc(struct mca_pcm_base_module_1_0_0_t* me_super,
ompi_process_name_t *name, int flags)
{
mca_pcm_bproc_module_t *me = (mca_pcm_bproc_module_t*) me_super;
pid_t doomed;
if (NULL == me) return OMPI_ERR_BAD_PARAM;
if (NULL == name) return OMPI_ERR_BAD_PARAM;
return OMPI_ERR_NOT_IMPLEMENTED;
doomed = mca_pcm_base_job_list_get_starter(me->jobs,
mca_ns_base_get_jobid(name),
mca_ns_base_get_vpid(name),
true);
if (doomed > 0) {
kill(doomed, SIGTERM);
} else {
return OMPI_ERR_NOT_FOUND;
}
return OMPI_SUCCESS;
}
@ -41,10 +56,26 @@ int
mca_pcm_bproc_kill_job(struct mca_pcm_base_module_1_0_0_t* me_super,
mca_ns_base_jobid_t jobid, int flags)
{
mca_pcm_bproc_module_t *me = (mca_pcm_bproc_module_t*) me_super;
mca_pcm_bproc_module_t *me = (mca_pcm_bproc_module_t*) me_super;
pid_t *doomed;
size_t doomed_len, i;
int ret;
if (NULL == me) return OMPI_ERR_BAD_PARAM;
/* check for invalid jobid */
if (NULL == me) return OMPI_ERR_BAD_PARAM;
/* check for invalid jobid */
ret = mca_pcm_base_job_list_get_starters(me->jobs,
jobid, &doomed, &doomed_len,
true);
if (OMPI_SUCCESS != ret) return ret;
return OMPI_ERR_NOT_IMPLEMENTED;
for (i = 0 ; i < doomed_len ; ++i) {
kill(doomed[i], SIGTERM);
}
if (NULL != doomed) {
free(doomed);
}
return OMPI_SUCCESS;
}