本文整理汇总了C++中free_br函数的典型用法代码示例。如果您正苦于以下问题:C++ free_br函数的具体用法?C++ free_br怎么用?C++ free_br使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了free_br函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: post_job_delete_nanny
void post_job_delete_nanny(
batch_request *preq_sig)
{
int rc;
job *pjob;
char log_buf[LOCAL_LOG_BUF_SIZE];
long nanny = 0;
if (preq_sig == NULL)
return;
rc = preq_sig->rq_reply.brp_code;
get_svr_attr_l(SRV_ATR_JobNanny, &nanny);
if (!nanny)
{
/* the admin disabled nanny within the last minute or so */
free_br(preq_sig);
return;
}
/* extract job id from task */
pjob = svr_find_job(preq_sig->rq_ind.rq_signal.rq_jid, FALSE);
if (pjob == NULL)
{
sprintf(log_buf, "job delete nanny: the job disappeared (this is a BUG!)");
log_event(PBSEVENT_ERROR,PBS_EVENTCLASS_JOB,preq_sig->rq_ind.rq_signal.rq_jid,log_buf);
}
else if (rc == PBSE_UNKJOBID)
{
sprintf(log_buf, "job delete nanny returned, but does not exist on mom");
log_event(PBSEVENT_ERROR,PBS_EVENTCLASS_JOB,preq_sig->rq_ind.rq_signal.rq_jid,log_buf);
free_nodes(pjob);
set_resc_assigned(pjob, DECR);
free_br(preq_sig);
svr_job_purge(pjob);
return;
}
unlock_ji_mutex(pjob, __func__, "1", LOGLEVEL);
/* free task */
free_br(preq_sig);
return;
} /* END post_job_delete_nanny() */
示例2: post_modify_arrayreq
void post_modify_arrayreq(
batch_request *preq)
{
job *pjob;
char log_buf[LOCAL_LOG_BUF_SIZE];
if (preq == NULL)
return;
preq->rq_conn = preq->rq_orgconn; /* restore socket to client */
if ((preq->rq_reply.brp_code) && (preq->rq_reply.brp_code != PBSE_UNKJOBID))
{
sprintf(log_buf, msg_mombadmodify, preq->rq_reply.brp_code);
log_event(PBSEVENT_JOB,PBS_EVENTCLASS_JOB,preq->rq_ind.rq_modify.rq_objname,log_buf);
free_br(preq);
}
else
{
if (preq->rq_reply.brp_code == PBSE_UNKJOBID)
{
if ((pjob = svr_find_job(preq->rq_ind.rq_modify.rq_objname, FALSE)) == NULL)
{
free_br(preq);
return;
}
else
{
mutex_mgr job_mutex = mutex_mgr(pjob->ji_mutex, true);
if (LOGLEVEL >= 0)
{
sprintf(log_buf, "post_modify_req: PBSE_UNKJOBID for job %s in state %s-%s, dest = %s",
pjob->ji_qs.ji_jobid,
PJobState[pjob->ji_qs.ji_state],
PJobSubState[pjob->ji_qs.ji_substate],
pjob->ji_qs.ji_destin);
log_event(PBSEVENT_JOB,PBS_EVENTCLASS_JOB,pjob->ji_qs.ji_jobid,log_buf);
}
}
}
free_br(preq);
}
return;
} /* END post_modify_arrayreq() */
示例3: reply_send_async
int reply_send_async(struct batch_request *request)
{
int sfds = request->rq_conn; /* socket */
// only thread client responses
if (svr_conn[sfds].cn_active != FromClientDIS)
return reply_send(request);
/* determine where the reply should go, remote or local */
if (sfds == PBS_LOCAL_CONNECTION)
// default to synchronous version
return reply_send(request);
else if (sfds >= 0)
{
int rc = dis_reply_write_async(sfds, &request->rq_reply);
if ((request->rq_type != PBS_BATCH_AsyModifyJob) || (request->rq_noreply == TRUE))
{
free_br(request);
}
return rc;
}
/* Otherwise, the reply is to be sent to a remote client */
return 0;
}
示例4: post_rerun
void post_rerun(
batch_request *preq)
{
int newstate;
int newsub;
job *pjob;
char log_buf[LOCAL_LOG_BUF_SIZE];
if (preq == NULL)
return;
if (preq->rq_reply.brp_code != 0)
{
sprintf(log_buf, "rerun signal reject by mom: %d", preq->rq_reply.brp_code);
log_event(PBSEVENT_JOB,PBS_EVENTCLASS_JOB,preq->rq_ind.rq_signal.rq_jid,log_buf);
if ((pjob = svr_find_job(preq->rq_ind.rq_signal.rq_jid, FALSE)))
{
mutex_mgr job_mutex(pjob->ji_mutex, true);
svr_evaljobstate(pjob, &newstate, &newsub, 1);
svr_setjobstate(pjob, newstate, newsub, FALSE);
}
}
free_br(preq);
return;
} /* END post_rerun() */
示例5: chkpt_xfr_hold
void chkpt_xfr_hold(
batch_request *preq,
job *pjob)
{
char log_buf[LOCAL_LOG_BUF_SIZE];
if ((preq == NULL) ||
(preq->rq_extra == NULL) ||
(pjob == NULL))
return;
if (LOGLEVEL >= 7)
{
sprintf(log_buf,
"BLCR copy completed (state is %s-%s)",
PJobState[pjob->ji_qs.ji_state],
PJobSubState[pjob->ji_qs.ji_substate]);
log_event(PBSEVENT_JOB, PBS_EVENTCLASS_JOB, pjob->ji_qs.ji_jobid, log_buf);
}
free_br(preq);
set_task(WORK_Immed, 0, mom_cleanup_checkpoint_hold, strdup(pjob->ji_qs.ji_jobid), FALSE);
return;
} /* END chkpt_xfr_hold() */
示例6: chkpt_xfr_done
void chkpt_xfr_done(
batch_request *preq)
{
free_br(preq);
} /* END chkpt_xfr_done() */
示例7: release_req
void
release_req(struct work_task *pwt)
{
free_br((struct batch_request *)pwt->wt_parm1);
if (pwt->wt_event != -1 && pwt->wt_aux2 != 1) /* not rpp */
svr_disconnect(pwt->wt_event);
}
示例8: issue_track
void issue_track(
job *pjob)
{
struct batch_request *preq;
char *pc;
preq = alloc_br(PBS_BATCH_TrackJob);
if (preq == (struct batch_request *)0)
return;
preq->rq_ind.rq_track.rq_hopcount = pjob->ji_wattr[JOB_ATR_hopcount].at_val.at_long;
strcpy(preq->rq_ind.rq_track.rq_jid, pjob->ji_qs.ji_jobid);
strcpy(preq->rq_ind.rq_track.rq_location, server_name);
preq->rq_ind.rq_track.rq_state[0] = pjob->ji_wattr[JOB_ATR_state].at_val.at_char;
pc = pjob->ji_qs.ji_jobid;
while (*pc != '.')
pc++;
issue_to_svr(++pc, preq, NULL);
free_br(preq);
}
示例9: find_nodebyname
void *send_power_state_to_mom(
void *arg)
{
struct batch_request *pRequest = (struct batch_request *)arg;
struct pbsnode *pNode = find_nodebyname(pRequest->rq_host);
if (pNode == NULL)
{
free_br(pRequest);
return NULL;
}
int handle = 0;
int local_errno = 0;
handle = svr_connect(pNode->nd_addrs[0],pNode->nd_mom_port,&local_errno,pNode,NULL);
if (handle < 0)
{
unlock_node(pNode, __func__, "Error connecting", LOGLEVEL);
return NULL;
}
unlock_node(pNode, __func__, "Done connecting", LOGLEVEL);
issue_Drequest(handle, pRequest, true);
return NULL;
}
示例10: return
void *req_messagejob(
batch_request *preq) /* I */
{
job *pjob;
int rc;
batch_request *dup_req = NULL;
if ((pjob = chk_job_request(preq->rq_ind.rq_message.rq_jid, preq)) == NULL)
return(NULL);
mutex_mgr job_mutex(pjob->ji_mutex, true);
/* the job must be running */
if (pjob->ji_qs.ji_state != JOB_STATE_RUNNING)
{
req_reject(PBSE_BADSTATE, 0, preq, NULL, NULL);
return(NULL);
}
if ((rc = copy_batchrequest(&dup_req, preq, 0, -1)) != 0)
{
req_reject(PBSE_MEM_MALLOC, 0, preq, NULL, NULL);
}
/* pass the request on to MOM */
/* The dup_req is freed in relay_to_mom (failure)
* or in issue_Drequest (success) */
else if ((rc = relay_to_mom(&pjob, dup_req, NULL)) != PBSE_NONE)
{
req_reject(rc, 0, preq, NULL, NULL); /* unable to get to MOM */
free_br(dup_req);
}
else
{
post_message_req(dup_req);
free_br(preq);
}
/* After MOM acts and replies to us, we pick up in post_message_req() */
if (pjob == NULL)
job_mutex.set_lock_on_exit(false);
return(NULL);
} /* END req_messagejob() */
示例11: remove_alps_reservation
void *check_if_orphaned(
void *vp)
{
char *rsv_id = (char *)vp;
char job_id[PBS_MAXSVRJOBID];
struct batch_request *preq;
int handle = -1;
int retries = 0;
struct pbsnode *pnode;
char log_buf[LOCAL_LOG_BUF_SIZE];
if (is_orphaned(rsv_id, job_id) == TRUE)
{
if((preq = alloc_br(PBS_BATCH_DeleteReservation)) == NULL)
return NULL;
preq->rq_extend = rsv_id;
/* Assume the request will be successful and remove the RSV from the hash table */
remove_alps_reservation(rsv_id);
if ((pnode = get_next_login_node(NULL)) != NULL)
{
struct in_addr hostaddr;
int local_errno;
pbs_net_t momaddr;
memcpy(&hostaddr, &pnode->nd_sock_addr.sin_addr, sizeof(hostaddr));
momaddr = ntohl(hostaddr.s_addr);
snprintf(log_buf, sizeof(log_buf),
"Found orphan ALPS reservation ID %s for job %s; asking %s to remove it",
rsv_id,
job_id,
pnode->nd_name);
log_record(PBSEVENT_DEBUG, PBS_EVENTCLASS_SERVER, __func__, log_buf);
while ((handle < 0) &&
(retries < 3))
{
handle = svr_connect(momaddr, pnode->nd_mom_port, &local_errno, pnode, NULL, ToServerDIS);
retries++;
}
/* unlock before the network transaction */
unlock_node(pnode, __func__, NULL, LOGLEVEL);
if (handle >= 0)
issue_Drequest(handle, preq, true);
free_br(preq);
}
}
else
free(rsv_id);
return(NULL);
} /* END check_if_orphaned() */
示例12: release_req
void release_req(
struct work_task *pwt)
{
free_br((struct batch_request *)pwt->wt_parm1);
if (pwt->wt_event != -1)
svr_disconnect(pwt->wt_event);
return;
}
示例13: issue_track
void issue_track(
job *pjob)
{
struct batch_request *preq;
char *pc;
char *sname;
char log_buf[LOCAL_LOG_BUF_SIZE];
if ((pc = strchr(pjob->ji_qs.ji_jobid, '.')) == NULL)
{
snprintf(log_buf, sizeof(log_buf),
"Remote job routing is not compatible with display_job_server_suffix set to false. Cannot track %s",
pjob->ji_qs.ji_jobid);
log_err(-1, __func__, log_buf);
return;
}
sname = pc + 1;
/* do not issue track requests to ourselves */
if (!strcmp(sname, server_name))
{
snprintf(log_buf, sizeof(log_buf),
"%s erroneously called for local job %s",
__func__, pjob->ji_qs.ji_jobid);
log_event(PBSEVENT_JOB, PBS_EVENTCLASS_JOB, __func__, log_buf);
return;
}
preq = alloc_br(PBS_BATCH_TrackJob);
if (preq == NULL)
return;
preq->rq_ind.rq_track.rq_hopcount = pjob->ji_wattr[JOB_ATR_hopcount].at_val.at_long;
strcpy(preq->rq_ind.rq_track.rq_jid, pjob->ji_qs.ji_jobid);
strcpy(preq->rq_ind.rq_track.rq_location, server_name);
preq->rq_ind.rq_track.rq_state[0] = pjob->ji_wattr[JOB_ATR_state].at_val.at_char;
pc = pjob->ji_qs.ji_jobid;
while (*pc != '.')
pc++;
issue_to_svr(++pc, preq, NULL);
free_br(preq);
}
示例14: issue_signal
int issue_signal(
job **pjob_ptr,
char *signame, /* name of the signal to send */
void (*func)(batch_request *),
void *extra) /* extra parameter to be stored in sig request */
{
int rc;
job *pjob = *pjob_ptr;
struct batch_request *newreq;
char jobid[PBS_MAXSVRJOBID + 1];
/* build up a Signal Job batch request */
if ((newreq = alloc_br(PBS_BATCH_SignalJob)) == NULL)
{
/* FAILURE */
return(PBSE_SYSTEM);
}
newreq->rq_extra = extra;
strcpy(newreq->rq_ind.rq_signal.rq_jid, pjob->ji_qs.ji_jobid);
snprintf(newreq->rq_ind.rq_signal.rq_signame, sizeof(newreq->rq_ind.rq_signal.rq_signame), "%s", signame);
/* The newreq is freed in relay_to_mom (failure)
* or in issue_Drequest (success) */
rc = relay_to_mom(&pjob, newreq, NULL);
if ((rc == PBSE_NONE) &&
(pjob != NULL))
{
strcpy(jobid, pjob->ji_qs.ji_jobid);
unlock_ji_mutex(pjob, __func__, NULL, 0);
func(newreq);
*pjob_ptr = svr_find_job((char *)jobid, TRUE);
}
else
{
free_br(newreq);
if (pjob == NULL)
*pjob_ptr = NULL;
}
return(rc);
} /* END issue_signal() */
示例15: remove_stagein
void remove_stagein(
job **pjob_ptr) /* I */
{
struct batch_request *preq = 0;
job *pjob = *pjob_ptr;
u_long addr;
preq = cpy_stage(preq, pjob, JOB_ATR_stagein, 0);
if (preq != NULL)
{
/* have files to delete */
/* change the request type from copy to delete */
preq->rq_type = PBS_BATCH_DelFiles;
preq->rq_extra = NULL;
addr = pjob->ji_qs.ji_un.ji_exect.ji_momaddr;
addr += pjob->ji_qs.ji_un.ji_exect.ji_mom_rmport;
addr += pjob->ji_qs.ji_un.ji_exect.ji_momport;
/* The preq is freed in relay_to_mom (failure)
* or in issue_Drequest (success) */
if (relay_to_mom(&pjob, preq, NULL) == PBSE_NONE)
{
if (pjob != NULL)
pjob->ji_qs.ji_svrflags &= ~JOB_SVFLG_StagedIn;
}
else
{
/* log that we were unable to remove the files */
log_event(
PBSEVENT_JOB,
PBS_EVENTCLASS_FILE,
pjob->ji_qs.ji_jobid,
"unable to remove staged in files for job");
}
free_br(preq);
}
return;
} /* END remove_stagein() */