int release_whole_array( job_array *pa, /* I/0 */ struct batch_request *preq) /* I */ { int i; int rc; job *pjob; for (i = 0; i < pa->ai_qs.array_size; i++) { if (pa->job_ids[i] == NULL) continue; if ((pjob = svr_find_job(pa->job_ids[i], FALSE)) == NULL) { free(pa->job_ids[i]); pa->job_ids[i] = NULL; } else { mutex_mgr job_mutex(pjob->ji_mutex, true); if ((rc = release_job(preq, pjob, pa)) != 0) return(rc); } } /* SUCCESS */ return(PBSE_NONE); } /* END release_whole_array */
int req_releasejob( batch_request *vp) /* I */ { job *pjob; int rc; batch_request *preq = (batch_request *)vp; pjob = chk_job_request(preq->rq_ind.rq_release.rq_objname, preq); if (pjob == NULL) { return(PBSE_NONE); } mutex_mgr job_mutex(pjob->ji_mutex, true); if ((rc = release_job(preq, pjob, NULL)) != 0) { req_reject(rc,0,preq,NULL,NULL); } else { reply_ack(preq); } return(PBSE_NONE); } /* END req_releasejob() */
int release_whole_array( job_array *pa, /* I/0 */ struct batch_request *preq) /* I */ { int i; int rc; job *pjob; for (i = 0; i < pa->ai_qs.array_size; i++) { if (pa->job_ids[i] == NULL) continue; if ((pjob = svr_find_job(pa->job_ids[i], FALSE)) == NULL) { free(pa->job_ids[i]); pa->job_ids[i] = NULL; } else { if ((rc = release_job(preq, pjob)) != 0) { unlock_ji_mutex(pjob, __func__, (char *)"1", LOGLEVEL); return(rc); } unlock_ji_mutex(pjob, __func__, (char *)"2", LOGLEVEL); } } /* SUCCESS */ return(PBSE_NONE); } /* END release_whole_array */
int req_releasejob( void *vp) /* ptr to the decoded request */ { job *pjob; int rc; struct batch_request *preq = (struct batch_request *)vp; pjob = chk_job_request(preq->rq_ind.rq_release.rq_objname, preq); if (pjob == NULL) { return(PBSE_NONE); } if ((rc = release_job(preq,pjob)) != 0) { req_reject(rc,0,preq,NULL,NULL); } else { reply_ack(preq); } unlock_ji_mutex(pjob, __func__, (char *)"1", LOGLEVEL); return(PBSE_NONE); } /* END req_releasejob() */
void shell_release() { job* j, * next; for (j = jobs_head; j; j = next) { next = j->next; release_job(j); } }
int release_array_range( job_array *pa, struct batch_request *preq, char *range_str) { tlist_head tl; int i; int rc; array_request_node *rn; array_request_node *to_free; char *range = strchr(range_str,'='); if (range == NULL) return(PBSE_IVALREQ); range++; /* move past the '=' */ CLEAR_HEAD(tl); if (parse_array_request(range,&tl) > 0) { /* don't hold the jobs if range error */ return(PBSE_IVALREQ); } /* hold just that range from the array */ rn = (array_request_node*)GET_NEXT(tl); while (rn != NULL) { for (i = rn->start; i <= rn->end; i++) { if (pa->jobs[i] == NULL) continue; /* don't stomp on other memory */ if (i >= pa->ai_qs.array_size) continue; if ((rc = release_job(preq,pa->jobs[i]))) return(rc); } /* release mem */ to_free = rn; rn = (array_request_node*)GET_NEXT(rn->request_tokens_link); free(to_free); } return(0); } /* END release_array_range() */
int release_array_range( job_array *pa, struct batch_request *preq, char *range_str) { tlist_head tl; int i; int rc; job *pjob; array_request_node *rn; array_request_node *to_free; char *range = strchr(range_str,'='); if (range == NULL) return(PBSE_IVALREQ); range++; /* move past the '=' */ CLEAR_HEAD(tl); if (parse_array_request(range,&tl) > 0) { /* don't hold the jobs if range error */ return(PBSE_IVALREQ); } /* hold just that range from the array */ rn = (array_request_node*)GET_NEXT(tl); while (rn != NULL) { for (i = rn->start; i <= rn->end; i++) { /* don't stomp on other memory */ if (i >= pa->ai_qs.array_size) continue; if (pa->job_ids[i] == NULL) continue; if ((pjob = svr_find_job(pa->job_ids[i], FALSE)) == NULL) { free(pa->job_ids[i]); pa->job_ids[i] = NULL; } else { if ((rc = release_job(preq,pjob))) { unlock_ji_mutex(pjob, __func__, "1", LOGLEVEL); return(rc); } unlock_ji_mutex(pjob, __func__, "2", LOGLEVEL); } } /* release mem */ to_free = rn; rn = (array_request_node*)GET_NEXT(rn->request_tokens_link); free(to_free); } return(PBSE_NONE); } /* END release_array_range() */