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


C++ MDB函数代码示例

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


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

示例1: MUGIDFromName

int MUGIDFromName(

  char *GName)

  {
  struct group *buf;
  int tmpGID = 0;

  const char *FName = "MUGIDFromName";

  MDB(7,fSTRUCT) MLog("%s(%s)\n",
    FName,
    (GName != NULL) ? GName : "NULL");

  if ((GName == NULL) || !strcmp(GName,NONE))
    {
    return(-1);
    }

  errno = 0;

  buf = getgrnam(GName);

  if (buf == NULL)
    {
    MDB(3,fSTRUCT) MLog("ALERT:    error looking up group '%s' - %s (errno:%d)\n",
      GName,
      strerror(errno),
      errno);
    
    /* look for GID??? format */

    if (!strncmp(GName,"GID",strlen("GID")))
      {
      return(atoi(GName + strlen("GID")));
      }

    /* check to see if GName is the GID number itself (group names cannot start
     * with a number) */

    tmpGID = (int)strtol(GName,NULL,10);

    if (tmpGID != 0)
      {
      return(tmpGID);
      }

    return(-1);
    }

  return(buf->gr_gid);
  }    /* END MUGIDFromName() */
开发者ID:dhh1128,项目名称:cbase,代码行数:52,代码来源:MUsersGroups.c

示例2: MCacheRemoveVM

int MCacheRemoveVM(

    char *Name)

  {
  if (MCache == NULL)
    {
    return(FAILURE);
    }

  if (MUStrIsEmpty(Name))
    {
    MDB(3,fSCHED) MLog("INFO:     Blank name given. Cannot remove from cache.\n");

    return(FAILURE);
    }

  pthread_rwlock_wrlock(&MCache->VMLock);

  MUHTRemove(&MCache->VMs,Name,&MVMTransitionFree);

  if (DBWRITE)
    {
    MMongoInterface::MMongoDeleteO(Name,mxoxVM);
    }


  pthread_rwlock_unlock(&MCache->VMLock);

  return(SUCCESS);
  }
开发者ID:dhh1128,项目名称:cbase,代码行数:31,代码来源:MCache.c

示例3: MCacheWriteVM

int MCacheWriteVM(

  mtransvm_t *VM) /* I */

  {
  int rc;

  const char *FName = "MCacheWriteVM";

  MDB(8,fSCHED) MLog("%s(%s)\n",
    FName,
    (VM != NULL) ? VM->VMID : NULL);

  if (MCache == NULL)
    {
    return(FAILURE);
    }

  pthread_rwlock_wrlock(&MCache->VMLock);

  rc = MUHTAdd(&MCache->VMs,VM->VMID,(void *)VM,NULL,&MVMTransitionFree);

  if (DBWRITE)
    {
    MMongoInterface::MTransOToMongo(VM,mxoxVM);
    }

  pthread_rwlock_unlock(&MCache->VMLock);

  return(rc);
  }  /* END MCacheWriteVM() */
开发者ID:dhh1128,项目名称:cbase,代码行数:31,代码来源:MCache.c

示例4: MCacheRemoveJob

int MCacheRemoveJob(

    char *JName)

  {
  if (MUStrIsEmpty(JName))
    {
    MDB(3,fSCHED) MLog("INFO:     Blank name given. Cannot remove from cache.\n");

    return(FAILURE);
    }

  pthread_rwlock_wrlock(&MCache->JobLock);

  MUHTRemove(&MCache->Jobs,JName,&MJobTransitionFree);

  if (DBWRITE)
    {
    MMongoInterface::MMongoDeleteO(JName,mxoJob);
    }

  pthread_rwlock_unlock(&MCache->JobLock);

  return(SUCCESS);
  }
开发者ID:dhh1128,项目名称:cbase,代码行数:25,代码来源:MCache.c

示例5: MCacheWriteNode

int MCacheWriteNode(

  mtransnode_t    *N)

  {
  int rc;

  const char *FName = "MCacheWriteNode";

  MDB(7,fTRANS) MLog("%s(%s)\n",
    FName,
    (MUStrIsEmpty(N->Name)) ? "NULL" : N->Name);

  if (MCache == NULL)
    {
    return(FAILURE);
    }

  /* Obtain the write lock and write the object */

  pthread_rwlock_wrlock(&MCache->NodeLock);
  rc = MUHTAdd(&MCache->Nodes,N->Name,(void*)N,NULL,&MNodeTransitionFree);

  if (DBWRITE)
    {
    MMongoInterface::MTransOToMongo(N,mxoNode);
    }

  pthread_rwlock_unlock(&MCache->NodeLock);

  return(rc);
  }  /* END MCacheWriteNode() */
开发者ID:dhh1128,项目名称:cbase,代码行数:32,代码来源:MCache.c

示例6: MCacheReadVMs

int MCacheReadVMs(

  marray_t *VMArray,        /* O */
  marray_t *ConstraintList) /* I */

  {
  mhashiter_t HTIter;
  char *VMID;
  mtransvm_t *VM;

  if (MCache == NULL)
    {
    return(FAILURE);
    }

  MUHTIterInit(&HTIter);

  pthread_rwlock_rdlock(&MCache->VMLock);

  while (MUHTIterate(&MCache->VMs,&VMID,(void **)&VM,NULL,&HTIter) == SUCCESS)
    {
    if (MVMTransitionMatchesConstraints(VM,ConstraintList))
      {
      MUArrayListAppendPtr(VMArray,VM);
      }
    else
      {
      MDB(8,fSCHED) MLog("INFO:     VM %s does not meet constraints.\n",VM->VMID);
      }
    } /* END while (MUHTIterate) */

  pthread_rwlock_unlock(&MCache->VMLock);

  return(SUCCESS);
  }  /* END MCacheReadVMs() */
开发者ID:dhh1128,项目名称:cbase,代码行数:35,代码来源:MCache.c

示例7: MCacheReadTriggers

int MCacheReadTriggers(

  marray_t *TArray,         /* O */
  marray_t *ConstraintList) /* I */

  {
  mhashiter_t HTIter;
  char *TrigID;
  mtranstrig_t *T;

  if (MCache == NULL)
    {
    return(FAILURE);
    }

  MUHTIterInit(&HTIter);

  pthread_rwlock_rdlock(&MCache->TriggerLock);

  while (MUHTIterate(&MCache->Triggers,&TrigID,(void **)&T,NULL,&HTIter) == SUCCESS)
    {
    if (MTrigTransitionMatchesConstraints(T,ConstraintList))
      {
      MUArrayListAppendPtr(TArray,T);
      }
    else
      {
      MDB(8,fSCHED) MLog("INFO:     Trigger %s does not meet constraints.\n",T->TrigID);
      }
    } /* END while (MUHTIterate) */

  pthread_rwlock_unlock(&MCache->TriggerLock);

  return(SUCCESS);
  }  /* END MCacheReadTriggers() */
开发者ID:dhh1128,项目名称:cbase,代码行数:35,代码来源:MCache.c

示例8: MCacheReadJobs

int MCacheReadJobs(

  marray_t *JArray,
  marray_t *ConstraintList)

  {
  mhashiter_t HTIter;
  char *Name;
  mtransjob_t *J;

  if (MCache == NULL)
    {
    return(FAILURE);
    }

  MUHTIterInit(&HTIter);

  pthread_rwlock_rdlock(&MCache->JobLock);

  while (MUHTIterate(&MCache->Jobs,&Name,(void **)&J,NULL,&HTIter) == SUCCESS)
    {
    if (MJobTransitionMatchesConstraints(J,ConstraintList))
      {
      MUArrayListAppendPtr(JArray,J);
      }
    else
      {
      MDB(8,fSCHED) MLog("INFO:     Job %s does not meet constraints.\n",J->Name);
      }
    } /* END while (MUHTIterate) */

  pthread_rwlock_unlock(&MCache->JobLock);

  return(SUCCESS);
  }  /* END MCacheReadJobs() */
开发者ID:dhh1128,项目名称:cbase,代码行数:35,代码来源:MCache.c

示例9: MCacheReadRsvs

int MCacheReadRsvs(

  marray_t *RArray,
  marray_t *ConstraintList)

  {
  mhashiter_t HTIter;
  char *Name;
  mtransrsv_t *R;

  if (MCache == NULL)
    {
    return(FAILURE);
    }

  MUHTIterInit(&HTIter);

  pthread_rwlock_rdlock(&MCache->RsvLock);

  while (MUHTIterate(&MCache->Rsvs,&Name,(void **)&R,NULL,&HTIter) == SUCCESS)
    {
    if (MRsvTransitionMatchesConstraints(R,ConstraintList))
      {
      MUArrayListAppendPtr(RArray,R);
      }
    else
      {
      MDB(8,fSCHED) MLog("INFO:     Reservation %s does not meet constraints.\n",R->Name);
      }
    } /* END while (MUHTIterate) */

  pthread_rwlock_unlock(&MCache->RsvLock);

  return(SUCCESS);
  }  /* END MCacheReadRsvs() */
开发者ID:dhh1128,项目名称:cbase,代码行数:35,代码来源:MCache.c

示例10: MDAGDestroy

int MDAGDestroy(

  marray_t *DList)  /* I (modified) */

  {
  int index;
  mdepend_t **DArray;
  mdepend_t  *tmpD;

  const char *FName = "MDAGDestroy";

  MDB(9,fALL) MLog("%s(DList)\n",
    FName);

  if (DList == NULL)
    {
    return(FAILURE);
    }

  DArray = (mdepend_t **)DList->Array;

  for (index = 0;index < DList->NumItems;index++)
    {
    tmpD = DArray[index];

    MUFree(&tmpD->Value);
    MUFree(&tmpD->SValue);

    MUFree((char **)&DArray[index]);
    }

  MUArrayListFree(DList);

  return(SUCCESS);
  } /* END MDAGDestroy() */
开发者ID:dhh1128,项目名称:cbase,代码行数:35,代码来源:MDAG.c

示例11: MSysDequeueSocket

int MSysDequeueSocket(
  
  msocket_t **S)  /* O */

  {
  if (S == NULL)
    {
    return(FAILURE);
    }

  if (MUDLListSize(MSocketQueue) == 0)
    {
    /* queue is empty */
    
    return(FAILURE);
    }

  MUMutexLock(&MSocketQueueMutex);

  *S = (msocket_t *)MUDLListRemoveFirst(MSocketQueue);

  MSched.TransactionCount--;

  MUMutexUnlock(&MSocketQueueMutex);

  MUGetMS(NULL,(long *)&(*S)->ProcessTime);

  MDB(7,fSOCK) MLog("INFO:     socket %d being serviced after %lu milli-sec wait\n",
    (*S)->sd,
    (*S)->ProcessTime - (*S)->CreateTime);
   
  return(SUCCESS);    
  }  /* END MSysDequeueSocket() */
开发者ID:dhh1128,项目名称:cbase,代码行数:33,代码来源:MSysSocketQueue.c

示例12: MWikiSDUpdate

int MWikiSDUpdate(

  char        *AString,  /* I */
  msdata_t    *SD,       /* I (modified) */
  mrm_t       *R)        /* I */

  {
  char *ptr;
  char *tail;

  char  SDAttr[MMAX_BUFFER];

  char  EMsg[MMAX_LINE];
  char  tmpLine[MMAX_LINE];

  const char *FName = "MWikiSDUpdate";

  MDB(2,fWIKI) MLog("%s(AString,SD,%s)\n",
    FName,
    (R != NULL) ? R->Name : "NULL");

  if ((SD == NULL) || (AString == NULL))
    {
    return(FAILURE);
    }

  ptr = AString;

  /* FORMAT:  <FIELD>=<VALUE> [<FIELD>=<VALUE>]... */

  while (ptr[0] != '\0')
    {
    if ((tail = MUStrChr(ptr,' ')) != NULL)
      {
      strncpy(SDAttr,ptr,MIN(MMAX_BUFFER - 1,tail - ptr));
      SDAttr[tail - ptr] = '\0';
      }
    else
      {
      MUStrCpy(SDAttr,ptr,MMAX_BUFFER);
      }

    if (MWikiSDUpdateAttr(SDAttr,SD,R,EMsg) == FAILURE)
      {
      snprintf(tmpLine,sizeof(tmpLine),"info corrupt for staging-data '%s -> %s' - %s",
        SD->SrcLocation,
        SD->DstLocation,
        EMsg);

      MMBAdd(&R->MB,tmpLine,NULL,mmbtNONE,0,0,NULL);
      }

    if (tail == NULL)
      break;

    ptr = tail + 1;
    }  /* END while ((tail = MUStrChr(ptr,';')) != NULL) */

  return(SUCCESS);
  }  /* END MWikiSDUpdate() */
开发者ID:dhh1128,项目名称:cbase,代码行数:60,代码来源:MWikiSD.c

示例13: MLocalCheckFairnessPolicy

int MLocalCheckFairnessPolicy(

  mjob_t *J,
  long    StartTime,
  char   *Message)

  {
  const char *FName = "MLocalCheckFairnessPolicy";

  MDB(6,fSCHED) MLog("%s(%s,%ld,Message)\n",
    FName,
    (J != NULL) ? J->Name : "NULL",
    (unsigned long)StartTime);

/*
  if (ContribJobLengthFairnessPolicy(J,StartTime,Message) == FAILURE)
    {
    return(FAILURE);
    }
*/

/*
  if (ContribASCBackgroundJobPolicy(J,StartTime,Message) == FAILURE)
    {
    return(FAILURE);
    }
*/

  /* all local policies passed */

  return(SUCCESS);
  }  /* END MLocalFairnessPolicy() */
开发者ID:dhh1128,项目名称:cbase,代码行数:32,代码来源:MLocal.c

示例14: MDAGCopy

int MDAGCopy(

  marray_t *DList,
  marray_t *SList)

  {
  mdepend_t *tmpS;

  const char *FName = "MDAGCopy";

  MDB(5,fALL) MLog("%s(DList,SList)\n",
    FName);

  if ((SList == NULL) || (DList == NULL))
    {
    return(FAILURE);
    }

 if (DList->Array != NULL)
    {
    MUArrayListFree(DList);
    }

  if (SList->Array == NULL)
    {
    /* nothing to copy */

    return(SUCCESS);
    }

  MUArrayListCreate(DList,SList->ElementSize,SList->NumItems);

  tmpS = ((mdepend_t **)SList->Array)[0];

  if (tmpS == NULL)
    {
    /* nothing to copy */

    return(SUCCESS);
    }

  while (tmpS != NULL)
    {
    MDAGSetAnd(DList,tmpS->Type,tmpS->Value,tmpS->SValue,&tmpS->BM);

    tmpS = tmpS->NextAnd;
    }

  tmpS = ((mdepend_t **)SList->Array)[0]->NextOr;

  while (tmpS != NULL)
    {
    MDAGSetOr(DList,tmpS->Type,tmpS->Value,NULL);

    tmpS = tmpS->NextOr;
    }

  return(SUCCESS);
  }  /* END MDAGCopy */
开发者ID:dhh1128,项目名称:cbase,代码行数:59,代码来源:MDAG.c

示例15: MDAGCreate

int MDAGCreate(

  marray_t   *DList,  /* I */
  mdepend_t **DP)     /* O (modified) */

  {
  mdepend_t *NewD = NULL;

  const char *FName = "MDAGCreate";

  MDB(5,fALL) MLog("%s(DList,DP)\n",
    FName);

  if (DP != NULL)
    {
    *DP = NULL;
    }

  if ((DList == NULL) || (DP == NULL))
    {
    return(FAILURE);
    }

  NewD = (mdepend_t *)MUCalloc(1,sizeof(mdepend_t));

  if (NewD == NULL)
    {
    MDB(1,fALL) MLog("ALERT:    could not allocate new dependency\n");

    return(FAILURE);
    }

  NewD->Satisfied = MBNOTSET;

  if (MUArrayListAppendPtr(DList,NewD) == FAILURE)
    {
    return(FAILURE);
    }

  *DP = NewD;

  NewD->Index = DList->NumItems-1;

  return(SUCCESS);
  }  /* END MDAGCreate() */
开发者ID:dhh1128,项目名称:cbase,代码行数:45,代码来源:MDAG.c


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