orcm/tools/orcmd/orcmd.c
/* timer call back function to cancel session daemons*/
timer call back function to cancel session daemons
timer call back function to cancel session daemons
static void orcmd_wpid_timer_recv(int fd, short args, void* cbdata)
{
    orcm_rm_cmd_flag_t command;
    int  rc;
    opal_buffer_t *buf;
    orcmd_wpid_event_cb_t *req = (orcmd_wpid_event_cb_t *) cbdata;
    int w = 0;
    int status = 0;
    pid_t stepd_pid;
    orcm_alloc_t *alloc;
    if (NULL == req  || 0 >= req->pid || NULL == req->cbdata) {
        opal_output(0, "error processing wpid timer recv\n");
        return;
    }
    stepd_pid = req->pid;
    alloc = (orcm_alloc_t*) req->cbdata;
    w = waitpid (stepd_pid, &status, WNOHANG|WUNTRACED|WCONTINUED);
    if (0 == w) {
        req->rate.tv_sec++;
        opal_event_evtimer_add(&req->ev, &req->rate);
    } else {  
        opal_output(0, "%s:  session: %d completed notify scheduler \n",
                ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), (int) alloc->id);
        command = ORCM_STEPD_COMPLETE_COMMAND;
        buf = OBJ_NEW(opal_buffer_t);
        if (OPAL_SUCCESS !=
            (rc = opal_dss.pack(buf, &command, 1, ORCM_RM_CMD_T))) {
            ORTE_ERROR_LOG(rc);
            OBJ_RELEASE(buf);
            return;
        }
        if (OPAL_SUCCESS !=
            (rc = opal_dss.pack(buf, &alloc, 1, ORCM_ALLOC))) {
            ORTE_ERROR_LOG(rc);
            OBJ_RELEASE(buf);
            return;
        }
        if (ORTE_SUCCESS !=
            (rc =
             orte_rml.send_buffer_nb(ORTE_PROC_MY_SCHEDULER, buf,
                         ORCM_RML_TAG_RM,
                         orte_rml_send_callback, NULL))) {
            ORTE_ERROR_LOG(rc);
            OBJ_RELEASE(buf);
            return;
        }
    }
}
static void orcmd_wpid_timer_recv ( int fd , short args , void * cbdata ) { orcm_rm_cmd_flag_t command ; int rc ; opal_buffer_t * buf ; orcmd_wpid_event_cb_t * req = ( orcmd_wpid_event_cb_t * ) cbdata ; int w = 0 ; int status = 0 ; pid_t stepd_pid ; orcm_alloc_t * alloc ; if ( NULL == req || 0 >= req -> pid || NULL == req -> cbdata ) { opal_output ( 0 , " \n " ) ; return ; } stepd_pid = req -> pid ; alloc = ( orcm_alloc_t * ) req -> cbdata ; w = waitpid ( stepd_pid , & status , WNOHANG | WUNTRACED | WCONTINUED ) ; if ( 0 == w ) { req -> rate . tv_sec ++ ; opal_event_evtimer_add ( & req -> ev , & req -> rate ) ; } else { opal_output ( 0 , " \n " , ORTE_NAME_PRINT ( ORTE_PROC_MY_NAME ) , ( int ) alloc -> id ) ; command = ORCM_STEPD_COMPLETE_COMMAND ; buf = OBJ_NEW ( opal_buffer_t ) ; if ( OPAL_SUCCESS != ( rc = opal_dss . pack ( buf , & command , 1 , ORCM_RM_CMD_T ) ) ) { ORTE_ERROR_LOG ( rc ) ; OBJ_RELEASE ( buf ) ; return ; } if ( OPAL_SUCCESS != ( rc = opal_dss . pack ( buf , & alloc , 1 , ORCM_ALLOC ) ) ) { ORTE_ERROR_LOG ( rc ) ; OBJ_RELEASE ( buf ) ; return ; } if ( ORTE_SUCCESS != ( rc = orte_rml . send_buffer_nb ( ORTE_PROC_MY_SCHEDULER , buf , ORCM_RML_TAG_RM , orte_rml_send_callback , NULL ) ) ) { ORTE_ERROR_LOG ( rc ) ; OBJ_RELEASE ( buf ) ; return ; } } }
timer call back function to cancel session daemons
timer call back function to cancel session daemons
/*if (stepd_pid  == w) */ /* pack the complete command flag */