本文整理汇总了C++中req_reject函数的典型用法代码示例。如果您正苦于以下问题:C++ req_reject函数的具体用法?C++ req_reject怎么用?C++ req_reject使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了req_reject函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: process_gpu_request_reply
static void process_gpu_request_reply(
struct work_task *pwt)
{
char *id = "process_gpu_request_reply";
struct batch_request *preq;
svr_disconnect(pwt->wt_event); /* close connection to MOM */
preq = pwt->wt_parm1;
preq->rq_conn = preq->rq_orgconn; /* restore client socket */
if (preq->rq_reply.brp_code != 0)
{
sprintf(log_buffer,
"MOM failed on GPU request, rc = %d",
preq->rq_reply.brp_code);
log_err(errno, id, log_buffer);
req_reject(preq->rq_reply.brp_code, 0, preq, NULL, log_buffer);
}
else
{
/* record that MOM changed gpu mode */
if (LOGLEVEL >= 7)
{
sprintf(
log_buffer,
"GPU control request completed for node %s gpuid %s mode %d reset_perm %d reset_vol %d",
preq->rq_ind.rq_gpuctrl.rq_momnode,
preq->rq_ind.rq_gpuctrl.rq_gpuid,
preq->rq_ind.rq_gpuctrl.rq_gpumode,
preq->rq_ind.rq_gpuctrl.rq_reset_perm,
preq->rq_ind.rq_gpuctrl.rq_reset_vol);
log_ext(-1, id, log_buffer, LOG_INFO);
}
reply_ack(preq);
}
}
示例2: req_jobcredential
void req_jobcredential(
struct batch_request *preq) /* ptr to the decoded request */
{
job *pj;
pj = locate_new_job(preq->rq_conn, NULL);
if (pj == NULL)
{
req_reject(PBSE_IVALREQ, 0, preq, NULL, NULL);
return;
}
reply_ack(preq);
return;
} /* END req_jobcredential() */
示例3: process_gpu_request_reply
/*
* process_gpu_request_reply
* called when a gpu change request was sent to MOM and the answer
* is received. Completes the gpu request.
*/
void process_gpu_request_reply(
batch_request *preq)
{
char log_buf[LOCAL_LOG_BUF_SIZE];
if (preq == NULL)
return;
preq->rq_conn = preq->rq_orgconn; /* restore client socket */
if (preq->rq_reply.brp_code != 0)
{
sprintf(log_buf,
"MOM failed on GPU request, rc = %d",
preq->rq_reply.brp_code);
log_err(errno, __func__, log_buf);
req_reject(preq->rq_reply.brp_code, 0, preq, NULL, log_buf);
}
else
{
/* record that MOM changed gpu mode */
if (LOGLEVEL >= 7)
{
sprintf(
log_buf,
"GPU control request completed for node %s gpuid %s mode %d reset_perm %d reset_vol %d",
preq->rq_ind.rq_gpuctrl.rq_momnode,
preq->rq_ind.rq_gpuctrl.rq_gpuid,
preq->rq_ind.rq_gpuctrl.rq_gpumode,
preq->rq_ind.rq_gpuctrl.rq_reset_perm,
preq->rq_ind.rq_gpuctrl.rq_reset_vol);
log_ext(-1, __func__, log_buf, LOG_INFO);
}
reply_ack(preq);
}
} /* END process_gpu_request_reply() */
示例4: get_UID
int get_UID(
int s,
char *munge_buf,
struct batch_request *preq)
{
char *ptr;
char user_name[PBS_MAXUSER];
int i = 0;
ptr = strstr(munge_buf, "UID:");
if (!ptr)
{
req_reject(PBSE_SYSTEM, 0, preq, NULL, "could not read unmunge data user");
return(-1);
}
ptr = strchr(ptr, ':');
ptr++;
while (*ptr == SPACE)
{
ptr++;
}
memset(user_name, 0, sizeof(user_name));
while ((*ptr != SPACE) &&
(!isspace(*ptr)) &&
(i < (int)sizeof(user_name)))
{
user_name[i++] = *ptr;
ptr++;
}
strncpy(conn_credent[s].username, user_name, sizeof(conn_credent[s].username) - 1);
conn_credent[s].username[sizeof(conn_credent[s].username) - 1] = 0;
return(PBSE_NONE);
} /* END get_UID() */
示例5: post_message_req
void post_message_req(
batch_request *preq)
{
char log_buf[LOCAL_LOG_BUF_SIZE];
/* preq has been hadnled previously */
if (preq == NULL)
return;
preq->rq_conn = preq->rq_orgconn; /* restore socket to client */
sprintf(log_buf, msg_messagejob, preq->rq_reply.brp_code);
log_event(PBSEVENT_JOB, PBS_EVENTCLASS_JOB, preq->rq_ind.rq_message.rq_jid, log_buf);
if (preq->rq_reply.brp_code)
req_reject(preq->rq_reply.brp_code, 0, preq, NULL, NULL);
else
reply_ack(preq);
} /* END post_message_req() */
示例6: svr_find_job
void *modify_job_work(
batch_request *vp) /* I */
{
job *pjob;
svrattrl *plist;
int checkpoint_req = FALSE;
batch_request *preq = (struct batch_request *)vp;
pjob = svr_find_job(preq->rq_ind.rq_modify.rq_objname, FALSE);
if (pjob == NULL)
{
req_reject(PBSE_JOBNOTFOUND, 0, preq, NULL, "Job unexpectedly deleted");
return(NULL);
}
mutex_mgr job_mutex(pjob->ji_mutex, true);
/* pbs_mom sets the extend string to trigger copying of checkpoint files */
if (preq->rq_extend != NULL)
{
if (strcmp(preq->rq_extend,CHECKPOINTHOLD) == 0)
{
checkpoint_req = CHK_HOLD;
}
else if (strcmp(preq->rq_extend,CHECKPOINTCONT) == 0)
{
checkpoint_req = CHK_CONT;
}
}
plist = (svrattrl *)GET_NEXT(preq->rq_ind.rq_modify.rq_attr);
/* modify_job will free preq and respond to it */
modify_job((void **)&pjob, plist, preq, checkpoint_req, 0);
return(NULL);
} /* END modify_job_work() */
示例7: process_checkpoint_reply
static void process_checkpoint_reply(
struct work_task *pwt)
{
job *pjob;
struct batch_request *preq;
svr_disconnect(pwt->wt_event); /* close connection to MOM */
preq = get_remove_batch_request(pwt->wt_parm1);
free(pwt->wt_mutex);
free(pwt);
/* preq handled previously */
if (preq == NULL)
return;
preq->rq_conn = preq->rq_orgconn; /* restore client socket */
if ((pjob = svr_find_job(preq->rq_ind.rq_manager.rq_objname, FALSE)) == NULL)
{
log_event(PBSEVENT_DEBUG, PBS_EVENTCLASS_JOB,
preq->rq_ind.rq_manager.rq_objname,
msg_postmomnojob);
req_reject(PBSE_UNKJOBID, 0, preq, NULL, msg_postmomnojob);
}
else
{
/* record that MOM has a checkpoint file */
account_record(PBS_ACCT_CHKPNT, pjob, "Checkpointed"); /* note in accounting file */
reply_ack(preq);
unlock_ji_mutex(pjob, __func__, "1", LOGLEVEL);
}
} /* END process_checkpoint_reply() */
示例8: req_shutdown
void
req_shutdown(struct batch_request *preq)
{
int type;
extern int shutdown_who;
if ((preq->rq_perm & (ATR_DFLAG_MGWR | ATR_DFLAG_MGRD | ATR_DFLAG_OPRD |
ATR_DFLAG_OPWR)) == 0) {
req_reject(PBSE_PERM, 0, preq);
return;
}
(void)sprintf(log_buffer, msg_shutdown_op, preq->rq_user, preq->rq_host);
log_event(PBSEVENT_SYSTEM|PBSEVENT_ADMIN|PBSEVENT_DEBUG,
PBS_EVENTCLASS_SERVER, LOG_NOTICE, msg_daemonname, log_buffer);
pshutdown_request = preq; /* save for reply from main() when done */
type = preq->rq_ind.rq_shutdown;
shutdown_who = type & SHUT_WHO_MASK;
if (shutdown_who & SHUT_WHO_SECDONLY)
(void)failover_send_shutdown(FAILOVER_SecdShutdown);
if (shutdown_who & SHUT_WHO_SCHED)
(void)contact_sched(SCH_QUIT, NULL); /* tell scheduler to quit */
if (shutdown_who & SHUT_WHO_SECDONLY) {
reply_ack(preq);
return; /* do NOT shutdown this Server */
}
/* Moms are told to shutdown in pbsd_main.c after main loop */
svr_shutdown(type);
return;
}
示例9: req_stat_sched
void
req_stat_sched(struct batch_request *preq)
{
svrattrl *pal;
struct batch_reply *preply;
int rc = 0;
pbs_sched *psched;
/* allocate a reply structure and a status sub-structure */
preply = &preq->rq_reply;
preply->brp_choice = BATCH_REPLY_CHOICE_Status;
CLEAR_HEAD(preply->brp_un.brp_status);
for (psched = (pbs_sched *) GET_NEXT(svr_allscheds);
(psched != NULL);
psched = (pbs_sched *) GET_NEXT(psched->sc_link)
) {
rc = status_sched(psched, preq, &preply->brp_un.brp_status);
if (rc != 0) {
break;
}
}
if (!rc) {
(void)reply_send(preq);
} else {
if (rc != PBSE_NOATTR)
req_reject(rc, 0, preq);
else {
pal = (svrattrl *)GET_NEXT(preq->rq_ind.
rq_status.rq_attr);
reply_badattr(rc, bad, pal, preq);
}
}
}
示例10: handle_single_delete
int handle_single_delete(
batch_request *preq,
batch_request *preq_tmp,
char *Msg)
{
char *jobid = preq->rq_ind.rq_delete.rq_objname;
job *pjob = svr_find_job(jobid, FALSE);
if (pjob == NULL)
{
log_event(PBSEVENT_DEBUG,PBS_EVENTCLASS_JOB,jobid,pbse_to_txt(PBSE_UNKJOBID));
req_reject(PBSE_UNKJOBID, 0, preq, NULL, "cannot locate job");
}
else
{
std::string jobID = pjob->ji_qs.ji_jobid;
unlock_ji_mutex(pjob, __func__, NULL, LOGLEVEL);
removeBeforeAnyDependencies(jobID.c_str());
/* send the asynchronous reply if needed */
if (preq_tmp != NULL)
{
reply_ack(preq_tmp);
preq->rq_noreply = TRUE; /* set for no more replies */
enqueue_threadpool_request(single_delete_work, preq, async_pool);
}
else
single_delete_work(preq);
}
return(PBSE_NONE);
} /* END handle_single_delete() */
示例11: req_connect
void req_connect(
struct batch_request *preq)
{
int sock = preq->rq_conn;
unsigned short conn_authen;
/* Called from one location inside a lock */
pthread_mutex_lock(svr_conn[sock].cn_mutex);
conn_authen = svr_conn[sock].cn_authen;
pthread_mutex_unlock(svr_conn[sock].cn_mutex);
if (conn_authen == 0)
{
reply_ack(preq);
}
else
{
req_reject(PBSE_BADCRED, 0, preq, NULL, "Connection not authorized");
}
return;
} /* END req_connect() */
示例12: handle_single_delete
int handle_single_delete(
struct batch_request *preq,
struct batch_request *preq_tmp,
char *Msg)
{
int rc= -1;
char *jobid = preq->rq_ind.rq_delete.rq_objname;
job *pjob = svr_find_job(jobid, FALSE);
if (pjob == NULL)
{
log_event(PBSEVENT_DEBUG,PBS_EVENTCLASS_JOB,jobid,pbse_to_txt(PBSE_UNKJOBID));
req_reject(PBSE_UNKJOBID, 0, preq, NULL, "cannot locate job");
}
else
{
if (preq_tmp != NULL)
{
reply_ack(preq_tmp);
preq->rq_noreply = TRUE; /* set for no more replies */
}
/* mutex is freed below */
if ((rc = forced_jobpurge(pjob, preq)) == PBSE_NONE)
rc = execute_job_delete(pjob, Msg, preq);
}
if ((rc == PBSE_NONE) ||
(rc == PURGE_SUCCESS))
reply_ack(preq);
return(PBSE_NONE);
} /* END handle_single_delete() */
示例13: req_stat_job_step2
static void req_stat_job_step2(
struct stat_cntl *cntl) /* I/O (free'd on return) */
{
svrattrl *pal;
job *pjob = NULL;
struct batch_request *preq;
struct batch_reply *preply;
int rc = 0;
enum TJobStatTypeEnum type;
pbs_queue *pque = NULL;
int exec_only = 0;
int bad = 0;
long DTime; /* delta time - only report full pbs_attribute list if J->MTime > DTime */
static svrattrl *dpal = NULL;
int job_array_index = 0;
job_array *pa = NULL;
char log_buf[LOCAL_LOG_BUF_SIZE];
all_jobs_iterator *iter;
preq = cntl->sc_origrq;
type = (enum TJobStatTypeEnum)cntl->sc_type;
preply = &preq->rq_reply;
/* See pbs_server_attributes(1B) for details on "poll_jobs" behaviour */
if (dpal == NULL)
{
/* build 'delta' pbs_attribute list */
svrattrl *tpal;
tlist_head dalist;
int aindex;
int atrlist[] =
{
JOB_ATR_jobname,
JOB_ATR_resc_used,
JOB_ATR_LAST
};
CLEAR_LINK(dalist);
for (aindex = 0;atrlist[aindex] != JOB_ATR_LAST;aindex++)
{
if ((tpal = attrlist_create("", "", 23)) == NULL)
{
return;
}
tpal->al_valln = atrlist[aindex];
if (dpal == NULL)
dpal = tpal;
append_link(&dalist, &tpal->al_link, tpal);
}
} /* END if (dpal == NULL) */
if (type == tjstArray)
{
pa = get_array(preq->rq_ind.rq_status.rq_id);
if (pa == NULL)
{
req_reject(PBSE_UNKARRAYID, 0, preq, NULL, "unable to find array");
return;
}
}
{
all_jobs *ajptr = NULL;
if (type == tjstQueue)
ajptr = cntl->sc_pque->qu_jobs;
else if (type == tjstSummarizeArraysQueue)
ajptr = cntl->sc_pque->qu_jobs_array_sum;
else if (type == tjstSummarizeArraysServer)
ajptr = &array_summary;
else
ajptr = &alljobs;
ajptr->lock();
iter = ajptr->get_iterator();
ajptr->unlock();
}
/*
* now ready for part 3, building the status reply,
* loop through again
*/
//.........这里部分代码省略.........
示例14: execute_job_delete
int execute_job_delete(
job *pjob, /* M */
char *Msg, /* I */
struct batch_request *preq) /* I */
{
struct work_task *pwtnew;
int rc;
char *sigt = "SIGTERM";
int has_mutex = TRUE;
char log_buf[LOCAL_LOG_BUF_SIZE];
time_t time_now = time(NULL);
long force_cancel = FALSE;
long array_compatible = FALSE;
chk_job_req_permissions(&pjob,preq);
if (pjob == NULL)
{
/* preq is rejected in chk_job_req_permissions here */
return(-1);
}
if (pjob->ji_qs.ji_state == JOB_STATE_TRANSIT)
{
/* see note in req_delete - not sure this is possible still,
* but the deleted code is irrelevant now. I will leave this
* part --dbeer */
unlock_ji_mutex(pjob, __func__, "1", LOGLEVEL);
return(-1);
}
if (pjob->ji_qs.ji_substate == JOB_SUBSTATE_PRERUN ||
pjob->ji_qs.ji_substate == JOB_SUBSTATE_RERUN ||
pjob->ji_qs.ji_substate == JOB_SUBSTATE_RERUN1 ||
pjob->ji_qs.ji_substate == JOB_SUBSTATE_RERUN2 ||
pjob->ji_qs.ji_substate == JOB_SUBSTATE_RERUN3 )
{
/* If JOB_SUBSTATE_PRERUN being sent to MOM, wait till she gets it going */
/* retry in one second */
/* If JOB_SUBSTATE_RERUN, RERUN1, RERUN2 or RERUN3 the
job is being requeued. Wait until finished */
static time_t cycle_check_when = 0;
static char cycle_check_jid[PBS_MAXSVRJOBID + 1];
if (cycle_check_when != 0)
{
if (!strcmp(pjob->ji_qs.ji_jobid, cycle_check_jid) &&
(time_now - cycle_check_when > 10))
{
/* state not updated after 10 seconds */
/* did the mom ever get it? delete it anyways... */
cycle_check_jid[0] = '\0';
cycle_check_when = 0;
goto jump;
}
if (time_now - cycle_check_when > 20)
{
/* give up after 20 seconds */
cycle_check_jid[0] = '\0';
cycle_check_when = 0;
}
} /* END if (cycle_check_when != 0) */
if (cycle_check_when == 0)
{
/* new PRERUN job located */
cycle_check_when = time_now;
strcpy(cycle_check_jid, pjob->ji_qs.ji_jobid);
}
sprintf(log_buf, "job cannot be deleted, state=PRERUN, requeuing delete request");
log_event(PBSEVENT_JOB,PBS_EVENTCLASS_JOB,pjob->ji_qs.ji_jobid,log_buf);
pwtnew = set_task(WORK_Timed,time_now + 1,post_delete_route,preq,FALSE);
unlock_ji_mutex(pjob, __func__, "2", LOGLEVEL);
if (pwtnew == NULL)
{
req_reject(PBSE_SYSTEM, 0, preq, NULL, NULL);
return(-1);
}
else
{
return(ROUTE_DELETE);
}
//.........这里部分代码省略.........
示例15: handle_delete_all
int handle_delete_all(
struct batch_request *preq,
struct batch_request *preq_tmp,
char *Msg)
{
/* don't use the actual request so we can reply about all of the jobs */
struct batch_request *preq_dup = duplicate_request(preq);
job *pjob;
int iter = -1;
int failed_deletes = 0;
int total_jobs = 0;
int rc = PBSE_NONE;
char tmpLine[MAXLINE];
preq_dup->rq_noreply = TRUE;
if (preq_tmp != NULL)
{
reply_ack(preq_tmp);
preq->rq_noreply = TRUE; /* set for no more replies */
}
while ((pjob = next_job(&alljobs, &iter)) != NULL)
{
if ((rc = forced_jobpurge(pjob, preq_dup)) == PURGE_SUCCESS)
{
continue;
}
if (pjob->ji_qs.ji_state >= JOB_STATE_EXITING)
{
unlock_ji_mutex(pjob, __func__, "1", LOGLEVEL);
continue;
}
total_jobs++;
/* mutex is freed below */
if (rc == PBSE_NONE)
{
if ((rc = execute_job_delete(pjob, Msg, preq_dup)) == PBSE_NONE)
reply_ack(preq_dup);
/* mark this as NULL because it has been freed */
preq_dup = NULL;
}
if (rc != PURGE_SUCCESS)
{
/* duplicate the preq so we don't have a problem with double frees */
preq_dup = duplicate_request(preq);
preq_dup->rq_noreply = TRUE;
if ((rc == MOM_DELETE) ||
(rc == ROUTE_DELETE))
failed_deletes++;
}
}
if (failed_deletes == 0)
{
reply_ack(preq);
/* PURGE SUCCESS means this was qdel -p all. In this case no reply_*()
* functions have been called */
if (rc == PURGE_SUCCESS)
{
free_br(preq_dup);
preq_dup = NULL;
}
}
else
{
snprintf(tmpLine,sizeof(tmpLine),"Deletes failed for %d of %d jobs",
failed_deletes,
total_jobs);
req_reject(PBSE_SYSTEM, 0, preq, NULL, tmpLine);
}
/* preq_dup happens at the end of the loop, so free the extra one if
* it is there */
if (preq_dup != NULL)
free_br(preq_dup);
return(PBSE_NONE);
} /* END handle_delete_all() */