当前位置: 首页>>代码示例>>C++>>正文


C++ CLEAR_HEAD函数代码示例

本文整理汇总了C++中CLEAR_HEAD函数的典型用法代码示例。如果您正苦于以下问题:C++ CLEAR_HEAD函数的具体用法?C++ CLEAR_HEAD怎么用?C++ CLEAR_HEAD使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了CLEAR_HEAD函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: START_TEST

END_TEST

START_TEST(send_job_over_network_test)
  {
  bool timeout = false;
  char *jobid = strdup("1.napali");
  char *destin = strdup("bob");
  bool attempt_to_queue = true;
  bool c = true;
  tlist_head h;
  int my_err;
  int mom_err;

  CLEAR_HEAD(h);

  fail_unless(send_job_over_network(strdup("2.napali"), 5, destin, h, attempt_to_queue, c, timeout, "script", true, false, 10, strdup("/out"), strdup("/err"), strdup("/chkpt"), MOVE_TYPE_Exec, &my_err,&mom_err) == LOCUTION_FAIL);

  CLEAR_HEAD(h);

  fail_unless(send_job_over_network(jobid, 5, destin, h, attempt_to_queue, c, timeout, "script", true, false, 10, strdup("/out"), strdup("/err"), strdup("/chkpt"), MOVE_TYPE_Exec, &my_err,&mom_err) == PBSE_NONE);
  fail_unless(attempt_to_queue == false);

  fprintf(stderr,"%p %s\n",(void *)destin,destin);
  CLEAR_HEAD(h);

  rdycommit_fail = true;
  fail_unless(send_job_over_network(jobid, 5, destin, h, attempt_to_queue, c, timeout, "script", true, false, 10, strdup("/out"), strdup("/err"), strdup("/chkpt"), MOVE_TYPE_Exec, &my_err,&mom_err) == LOCUTION_RETRY);
  rdycommit_fail = false;

  }
开发者ID:AlbertDeFusco,项目名称:torque,代码行数:30,代码来源:test_svr_movejob.c

示例2: START_TEST

END_TEST


START_TEST(add_node_attribute_to_list_test)
  {
  char  line[1024];
  char *ptr;
  tlist_head th;
  int ret;
  svrattrl *sattr;

  CLEAR_HEAD(th);

  // this should work and create the attribute np with the value of 100
  snprintf(line, sizeof(line), "100");
  ptr = line;

  ret = add_node_attribute_to_list(strdup("np"), &ptr, &th, 1);
  fail_unless(ret == PBSE_NONE);
  sattr = (svrattrl *)GET_NEXT(th); 
  fail_unless(strcmp(sattr->al_name, "np") == 0);
  fail_unless(strcmp(sattr->al_value, "100") == 0);
  attrlist_free();
  attrname.clear();
  attrval.clear();
  CLEAR_HEAD(th);

  // this is invalid syntax
  snprintf(line, sizeof(line), "100=");
  ptr = line;
  fail_unless(add_node_attribute_to_list(strdup("np"), &ptr, &th, 1) != PBSE_NONE);

  CLEAR_HEAD(th);
  // run over the two special cases
  snprintf(line, sizeof(line), "100");
  ptr = line;
  fail_unless(add_node_attribute_to_list(strdup("TTL"), &ptr, &th, 1) == PBSE_NONE);
  sattr = (svrattrl *)GET_NEXT(th); 
  fail_unless(strcmp(sattr->al_name, "TTL") == 0);
  fail_unless(strcmp(sattr->al_value, "100") == 0);
  attrlist_free();
  attrname.clear();
  attrval.clear();

  CLEAR_HEAD(th);
  snprintf(line, sizeof(line), "bob,tom");
  ptr = line;
  fail_unless(add_node_attribute_to_list(strdup("acl"), &ptr, &th, 1) == PBSE_NONE);
  sattr = (svrattrl *)GET_NEXT(th); 
  fail_unless(strcmp(sattr->al_name, "acl") == 0);
  fail_unless(strcmp(sattr->al_value, "bob,tom") == 0);
  attrlist_free();
  attrname.clear();
  attrval.clear();
  }
开发者ID:adaptivecomputing,项目名称:torque,代码行数:55,代码来源:test_uut.c

示例3: status_sched

/**
 * @brief
 * 		status_sched - Build the status reply for single scheduler
 *
 * @param[in]	psched	-	ptr to sched receiving status query
 * @param[in]	preq	-	ptr to the decoded request
 * @param[out]	pstathd	-	head of list to append status to
 *
 * @return	int
 * @retval	0	: success
 * @retval	!0	: PBSE error code
 */
static int
status_sched(pbs_sched *psched, struct batch_request *preq, pbs_list_head *pstathd)
{
	int		   rc = 0;
	struct brp_status *pstat;
	svrattrl	  *pal;

	pstat = (struct brp_status *)malloc(sizeof(struct brp_status));
	if (pstat == NULL)
		return (PBSE_SYSTEM);

	pstat->brp_objtype = MGR_OBJ_SCHED;
	(void)strncpy(pstat->brp_objname, psched->sc_name, (PBS_MAXSVRJOBID > PBS_MAXDEST ?
			PBS_MAXSVRJOBID : PBS_MAXDEST) -1);
	pstat->brp_objname[(PBS_MAXSVRJOBID > PBS_MAXDEST ? PBS_MAXSVRJOBID : PBS_MAXDEST) - 1] = '\0';

	CLEAR_LINK(pstat->brp_stlink);
	CLEAR_HEAD(pstat->brp_attr);
	append_link(pstathd, &pstat->brp_stlink, pstat);


	bad = 0;
	pal = (svrattrl *)GET_NEXT(preq->rq_ind.rq_status.rq_attr);
	if (status_attrib(pal, sched_attr_def, psched->sch_attr, SCHED_ATR_LAST,
		preq->rq_perm, &pstat->brp_attr, &bad))
		reply_badattr(PBSE_NOATTR, bad, pal, preq);

	return (rc);
}
开发者ID:altair4,项目名称:pbspro,代码行数:41,代码来源:req_stat.c

示例4: clear_attr

void clear_attr(

    pbs_attribute *pattr, /* O */
    attribute_def *pdef)  /* I */

  {
#ifndef NDEBUG

  if (pdef == NULL)
    {
    fprintf(stderr, "Assertion failed, bad pdef in clear_attr\n");

    abort();
    }

#endif /* NDEBUG */

  memset(pattr, 0, sizeof(pbs_attribute));

  pattr->at_type = pdef->at_type;

  if ((pattr->at_type == ATR_TYPE_RESC) ||
      (pattr->at_type == ATR_TYPE_LIST))
    {
    CLEAR_HEAD(pattr->at_val.at_list);
    }

  return;
  }
开发者ID:thegriglat,项目名称:torque,代码行数:29,代码来源:scaffolding.c

示例5: START_TEST

END_TEST

START_TEST(tm_spawn_request_test)
  {
  struct tcp_chan test_chan;
  struct job test_job;
  struct hnodent test_hnodent;
  char *test_cookie = strdup("cookie");
  int reply = 0;
  int ret = 0;
  int result = 0;

  memset(&test_chan, 0, sizeof(test_chan));
  memset(&test_job, 0, sizeof(test_job));
  memset(&test_hnodent, 0, sizeof(test_hnodent));

  test_job.ji_vnods = (vnodent *)calloc(3, sizeof(vnodent));
  CLEAR_HEAD(test_job.ji_tasks);

  result = tm_spawn_request(&test_chan,
                            &test_job,
                            0,
                            0,
                            (char *)test_cookie,
                            &reply,
                            &ret,
                            0,
                            &test_hnodent,
                            0);

  fail_unless(result == TM_DONE, "tm_spawn_request fail: %d", result);
  }
开发者ID:msbritt,项目名称:torque,代码行数:32,代码来源:test_uut.c

示例6: status_job

int status_job(

  job                  *pjob,    /* ptr to job to status */
  struct batch_request *preq,
  svrattrl             *pal,     /* specific attributes to status */
  tlist_head           *pstathd, /* RETURN: head of list to append status to */
  int                  *bad)     /* RETURN: index of first bad pbs_attribute */

  {
  struct brp_status *pstat;
  int                IsOwner = 0;
  long               query_others = 0;

  /* see if the client is authorized to status this job */
  if (svr_authorize_jobreq(preq, pjob) == 0)
    IsOwner = 1;

  get_svr_attr_l(SRV_ATR_query_others, &query_others);
  if (!query_others)
    {
    if (IsOwner == 0)
      {
      return(PBSE_PERM);
      }
    }

  /* allocate reply structure and fill in header portion */
  if ((pstat = calloc(1, sizeof(struct brp_status))) == NULL)
    {
    return(PBSE_SYSTEM);
    }

  CLEAR_LINK(pstat->brp_stlink);

  pstat->brp_objtype = MGR_OBJ_JOB;

  strcpy(pstat->brp_objname, pjob->ji_qs.ji_jobid);

  CLEAR_HEAD(pstat->brp_attr);

  append_link(pstathd, &pstat->brp_stlink, pstat);

  /* add attributes to the status reply */
  *bad = 0;

  if (status_attrib(
        pal,
        job_attr_def,
        pjob->ji_wattr,
        JOB_ATR_LAST,
        preq->rq_perm,
        &pstat->brp_attr,
        bad,
        IsOwner))
    {
    return(PBSE_NOATTR);
    }

  return (0);
  }  /* END status_job() */
开发者ID:gto11520,项目名称:torque,代码行数:60,代码来源:stat_job.c

示例7: decode_unkn

int
decode_unkn(struct attribute *patr, char *name, char *rescn, char *value)
{
	svrattrl *entry;
	size_t	     valln;


	if (patr == NULL)
		return (PBSE_INTERNAL);

	if (!(patr->at_flags & ATR_VFLAG_SET))
		CLEAR_HEAD(patr->at_val.at_list);

	if (name == NULL)
		return (PBSE_INTERNAL);

	if (value == NULL)
		valln = 0;
	else
		valln = strlen(value) + 1;

	entry = attrlist_create(name, rescn, valln);
	if (entry == NULL)
		return (PBSE_SYSTEM);

	if (valln)
		memcpy(entry->al_value, value, valln);

	append_link(&patr->at_val.at_list, &entry->al_link, entry);
	patr->at_flags |= ATR_VFLAG_SET | ATR_VFLAG_MODIFY | ATR_VFLAG_MODCACHE;
	return (0);
}
开发者ID:agrawalravi90,项目名称:pbspro,代码行数:32,代码来源:attr_fn_unkn.c

示例8: START_TEST

END_TEST



START_TEST(clear_depend_test)
  {
  struct depend pd;

  i = 1;
  clear_depend(&pd, 0, 0);

  fail_unless(pd.dp_type == 0, "type not set");
  fail_unless(pd.dp_numexp == 0, "attr not set correctly");
  fail_unless(pd.dp_numreg == 0, "attr not set correctly");
  fail_unless(pd.dp_released == 0, "attr not set correctly");
  
  i = 1;
  memset(&pd, 0, sizeof(pd));
  CLEAR_HEAD(pd.dp_jobs);

  make_dependjob(&pd, job1, host);
  make_dependjob(&pd, job2, host);
  clear_depend(&pd, 0, 1);
  fail_unless(pd.dp_type == 0, "type not set");
  fail_unless(pd.dp_numexp == 0, "attr not set correctly");
  fail_unless(pd.dp_numreg == 0, "attr not set correctly");
  fail_unless(pd.dp_released == 0, "attr not set correctly");
  }
开发者ID:actorquedeveloper,项目名称:torque-old,代码行数:28,代码来源:test_req_register.c

示例9: sizeof

job *job_alloc(void)

  {
  job *pj;

  pj = (job *)calloc(1, sizeof(job));

  if (pj == NULL)
    {
    log_err(errno, "job_alloc", (char *)"no memory");

    return(NULL);
    }

  pj->ji_qs.qs_version = PBS_QS_VERSION;

  CLEAR_LINK(pj->ji_alljobs);
  CLEAR_LINK(pj->ji_jobque);

  CLEAR_HEAD(pj->ji_tasks);
  pj->ji_taskid = TM_NULL_TASK + 1;
  pj->ji_obit = TM_NULL_EVENT;
  pj->ji_nodekill = TM_ERROR_NODE;

  pj->ji_momhandle = -1;  /* mark mom connection invalid */

  /* set the working attributes to "unspecified" */
  job_init_wattr(pj);

  return(pj);
  }  /* END job_alloc() */
开发者ID:boegel,项目名称:torque,代码行数:31,代码来源:mom_job_func.c

示例10: que_alloc

pbs_queue *
que_alloc(char *name)
{
	int        i;
	pbs_queue *pq;


	pq = (pbs_queue *)malloc(sizeof(pbs_queue));
	if (pq == (pbs_queue *)0) {
		log_err(errno, "que_alloc", "no memory");
		return ((pbs_queue *)0);
	}
	(void)memset((char *)pq, (int)0, (size_t)sizeof(pbs_queue));
	pq->qu_qs.qu_type = QTYPE_Unset;
	CLEAR_HEAD(pq->qu_jobs);
	CLEAR_LINK(pq->qu_link);

	strncpy(pq->qu_qs.qu_name, name, PBS_MAXQUEUENAME);
	append_link(&svr_queues, &pq->qu_link, pq);
	server.sv_qs.sv_numque++;

	/* set the working attributes to "unspecified" */

	for (i=0; i<(int)QA_ATR_LAST; i++) {
		clear_attr(&pq->qu_attr[i], &que_attr_def[i]);
	}

	return (pq);
}
开发者ID:A9-William,项目名称:pbspro,代码行数:29,代码来源:queue_func.c

示例11: req_stat_svr

void
req_stat_svr(struct batch_request *preq)
{
	svrattrl	   *pal;
	struct batch_reply *preply;
	struct brp_status  *pstat;


	/* update count and state counts from sv_numjobs and sv_jobstates */

	server.sv_attr[(int)SRV_ATR_TotalJobs].at_val.at_long = server.sv_qs.sv_numjobs;
	server.sv_attr[(int)SRV_ATR_TotalJobs].at_flags |= ATR_VFLAG_SET|ATR_VFLAG_MODCACHE;
	update_state_ct(&server.sv_attr[(int)SRV_ATR_JobsByState],
		server.sv_jobstates,
		server.sv_jobstbuf);

	update_license_ct(&server.sv_attr[(int)SRV_ATR_license_count],
		server.sv_license_ct_buf);

	/* 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);

	pstat = (struct brp_status *)malloc(sizeof(struct brp_status));
	if (pstat == NULL) {
		reply_free(preply);
		req_reject(PBSE_SYSTEM, 0, preq);
		return;
	}
	CLEAR_LINK(pstat->brp_stlink);
	(void)strcpy(pstat->brp_objname, server_name);
	pstat->brp_objtype = MGR_OBJ_SERVER;
	CLEAR_HEAD(pstat->brp_attr);
	append_link(&preply->brp_un.brp_status, &pstat->brp_stlink, pstat);

	/* add attributes to the status reply */

	bad = 0;
	pal = (svrattrl *)GET_NEXT(preq->rq_ind.rq_status.rq_attr);
	if (status_attrib(pal, svr_attr_def, server.sv_attr, SRV_ATR_LAST,
		preq->rq_perm, &pstat->brp_attr, &bad))
		reply_badattr(PBSE_NOATTR, bad, pal, preq);
	else
		(void)reply_send(preq);
}
开发者ID:altair4,项目名称:pbspro,代码行数:47,代码来源:req_stat.c

示例12: add_encoded_attributes

int add_encoded_attributes(

  xmlNodePtr *attr_node,   /* M attribute node */ 
  pbs_attribute  *pattr)   /* M ptr to pbs_attribute value array */

  {
  tlist_head  lhead;
  int         i;
  int         resc_access_perm = ATR_DFLAG_ACCESS;
  svrattrl   *pal;
  int         rc = PBSE_NONE;
  xmlNodePtr  attributeNode = *attr_node;
  char        buf[BUFSIZE];
  xmlNodePtr  pal_xmlNode;

  CLEAR_HEAD(lhead);
  xmlNodePtr  resource_list_head_node = NULL;
  xmlNodePtr  resource_used_head_node = NULL;

  for (i = 0; ((i < JOB_ATR_LAST) && (rc >= 0)); i++)
    {
    if (job_attr_def[i].at_type != ATR_TYPE_ACL)
      if ((pattr + i)->at_flags & ATR_VFLAG_SET)
        {
        rc = job_attr_def[i].at_encode(
        pattr + i,
        &lhead,
        job_attr_def[i].at_name,
        NULL,
        ATR_ENCODE_SAVE,
        resc_access_perm);

        (pattr + i)->at_flags &= ~ATR_VFLAG_MODIFY;
        if (rc < 0)
          return -1;

        while ((pal = (svrattrl *)GET_NEXT(lhead)) != NULL)
          {
          if (!strcmp(ATTR_l, pal->al_atopl.name)) 
            pal_xmlNode = add_resouce_list_attribute(ATTR_l, attr_node, &resource_list_head_node, pal);
          else if (!strcmp(ATTR_used, pal->al_atopl.name)) 
            pal_xmlNode = add_resouce_list_attribute(ATTR_used, attr_node, &resource_used_head_node, pal);
          else 
            pal_xmlNode = xmlNewChild(attributeNode, NULL, (xmlChar *)pal->al_atopl.name, (xmlChar *)pal->al_atopl.value);

            if (pal_xmlNode)
              {
              snprintf(buf, sizeof(buf), "%u", (unsigned int)pal->al_flags);
              xmlSetProp(pal_xmlNode, (const xmlChar *)AL_FLAGS_ATTR, (const xmlChar *)buf);
              }
            delete_link(&pal->al_link);
            free(pal);
            if (!pal_xmlNode)
              rc = -1;
          }
        }
    }
  return (0);
  } /* END add_encoded_attributes */
开发者ID:hocks,项目名称:torque,代码行数:59,代码来源:job_recov.c

示例13: initialize_depend_attr

void initialize_depend_attr(

  pbs_attribute *pattr)

  {
  memset(pattr, 0, sizeof(pbs_attribute));
  CLEAR_HEAD(pattr->at_val.at_list);
  } /* END initialize_depend_attr() */
开发者ID:ansonl,项目名称:torque,代码行数:8,代码来源:test_uut.c

示例14: req_stat_que

void
req_stat_que(struct batch_request *preq)
{
	char		   *name;
	pbs_queue	   *pque;
	struct batch_reply *preply;
	int		    rc   = 0;
	int		    type = 0;

	/*
	 * first, validate the name of the requested object, either
	 * a queue, or null for all queues
	 */

	name = preq->rq_ind.rq_status.rq_id;

	if ((*name == '\0') || (*name =='@'))
		type = 1;
	else {
		pque = find_queuebyname(name);
#ifdef NAS /* localmod 075 */
		if (pque == NULL)
			pque = find_resvqueuebyname(name);
#endif /* localmod 075 */
		if (pque == NULL) {
			req_reject(PBSE_UNKQUE, 0, preq);
			return;
		}
	}

	preply = &preq->rq_reply;
	preply->brp_choice = BATCH_REPLY_CHOICE_Status;
	CLEAR_HEAD(preply->brp_un.brp_status);

	if (type == 0) {	/* get status of the one named queue */
		rc = status_que(pque, preq, &preply->brp_un.brp_status);

	} else {	/* get status of queues */

		pque = (pbs_queue *)GET_NEXT(svr_queues);
		while (pque) {
			rc = status_que(pque, preq, &preply->brp_un.brp_status);
			if (rc != 0) {
				if (rc == PBSE_PERM)
					rc = 0;
				else
					break;
			}
			pque = (pbs_queue *)GET_NEXT(pque->qu_link);
		}
	}
	if (rc) {
		(void)reply_free(preply);
		req_reject(rc, bad, preq);
	} else {
		(void)reply_send(preq);
	}
}
开发者ID:altair4,项目名称:pbspro,代码行数:58,代码来源:req_stat.c

示例15: release_array_range

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() */
开发者ID:Johnlihj,项目名称:torque,代码行数:56,代码来源:array_func.c


注:本文中的CLEAR_HEAD函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。