d_subscriber d_subscriberNew( d_admin admin) { d_subscriber subscriber; d_durability durability; d_configuration config; v_subscriberQos subscriberQos, psubscriberQos; c_char* partitionExpr; struct initialQualityWalkData walkData; d_storeResult result; d_nameSpace nameSpace; c_iter nameSpaces; c_bool nsComplete; d_durabilityKind dkind; subscriber = NULL; if(admin){ subscriber = d_subscriber(os_malloc(C_SIZEOF(d_subscriber))); d_objectInit(d_object(subscriber), D_SUBSCRIBER, d_subscriberDeinit); subscriber->admin = admin; durability = d_adminGetDurability(admin); config = d_durabilityGetConfiguration(durability); subscriberQos = d_subscriberQosNew(config->partitionName); partitionExpr = getPersistentPartitionExpression(admin, durability); psubscriberQos = d_subscriberQosNew(partitionExpr); os_free(partitionExpr); subscriber->subscriber = u_subscriberNew (u_participant(d_durabilityGetService(durability)), config->subscriberName, subscriberQos, TRUE); subscriber->waitset = d_waitsetNew(subscriber, FALSE, FALSE); subscriber->persistentStore = d_storeOpen(durability, config->persistentStoreMode); if(subscriber->persistentStore) { if(psubscriberQos->partition){ /* Collect nameSpaces from admin. */ nameSpaces = d_adminNameSpaceCollect(admin); /* Loop nameSpaces */ while((nameSpace = c_iterTakeFirst(nameSpaces))) { dkind = d_nameSpaceGetDurabilityKind(nameSpace); /* Walk only over persistent nameSpaces */ if((dkind == D_DURABILITY_PERSISTENT) || (dkind == D_DURABILITY_ALL)){ /* If persistent nameSpace is not complete, restore backup */ result = d_storeNsIsComplete (subscriber->persistentStore, nameSpace, &nsComplete); if ( (result == D_STORE_RESULT_OK) && !nsComplete) { /* Incomplete namespace, restore backup. */ d_printTimedEvent(durability, D_LEVEL_WARNING, D_THREAD_GROUP_LOCAL_LISTENER, "Namespace '%s' is incomplete, trying to restore backup.\n", d_nameSpaceGetName(nameSpace)); if (d_storeRestoreBackup (subscriber->persistentStore, nameSpace) != D_STORE_RESULT_OK) { d_printTimedEvent(durability, D_LEVEL_WARNING, D_THREAD_GROUP_LOCAL_LISTENER, "Backup for namespace '%s' could not be restored as no complete backup did exist on disk. Marking namespace as incomplete and continuing.\n", d_nameSpaceGetName(nameSpace)); OS_REPORT_1(OS_WARNING, D_CONTEXT_DURABILITY, 0, "Backup for namespace '%s' could not be restored as no complete backup did exist on disk. Marking namespace as incomplete and continuing.\n", d_nameSpaceGetName (nameSpace)); /* If backup fails, mark master state for nameSpace !D_STATE_COMPLETE */ d_nameSpaceSetMasterState (nameSpace, D_STATE_INIT); } } } d_nameSpaceFree(nameSpace); } /* Free nameSpaces iterator */ assert(c_iterLength(nameSpaces) == 0); c_iterFree(nameSpaces); subscriber->persistentSubscriber = u_subscriberNew(u_participant(d_durabilityGetService(durability)), config->subscriberName, psubscriberQos, TRUE); assert(subscriber->persistentSubscriber); } else { subscriber->persistentSubscriber = NULL; } walkData.subscriber = subscriber; walkData.i = 0; d_adminNameSpaceWalk(admin, nsInitialQualityWalk, &walkData); } else { subscriber->persistentSubscriber = NULL; } assert(subscriber->subscriber); if(subscriber->subscriber){ subscriber->statusListener = NULL; subscriber->groupLocalListener = NULL; subscriber->groupRemoteListener = NULL; subscriber->groupsRequestListener = NULL; subscriber->sampleRequestListener = NULL; subscriber->sampleChainListener = NULL; subscriber->nameSpacesRequestListener = NULL; subscriber->nameSpacesListener = NULL; subscriber->persistentDataListener = NULL; subscriber->deleteDataListener = NULL; } else { d_subscriberFree(subscriber); subscriber = NULL; } d_subscriberQosFree(subscriberQos); d_subscriberQosFree(psubscriberQos); } return subscriber; }
d_readerRequest d_readerRequestNew( d_admin admin, v_handle source, c_char* filter, c_char** filterParams, c_long filterParamsCount, struct v_resourcePolicy resourceLimits, c_time minSourceTimestamp, c_time maxSourceTimestamp) { d_readerRequest request; c_long i; v_handleResult handleResult; v_reader vreader, *vreaderPtr; c_iter partitions; v_partition partition; v_topic topic; d_group dgroup; c_char *topicName; d_quality quality; request = d_readerRequest(os_malloc(C_SIZEOF(d_readerRequest))); if(request){ d_lockInit(d_lock(request), D_READER_REQUEST, d_readerRequestDeinit); request->admin = admin; request->readerHandle.index = source.index; request->readerHandle.serial = source.serial; request->readerHandle.server = source.server; request->requests = d_tableNew(d_chainCompare, d_chainFree); if(filter){ request->filter = os_strdup(filter); } else { request->filter = NULL; } request->resourceLimits = resourceLimits; request->minSourceTimestamp = minSourceTimestamp; request->maxSourceTimestamp = maxSourceTimestamp; request->filterParamsCount = filterParamsCount; if(filterParamsCount > 0){ request->filterParams = (c_char**)(os_malloc( filterParamsCount*sizeof(c_char*))); for(i=0; i<filterParamsCount; i++){ request->filterParams[i] = os_strdup(filterParams[i]); } } else { request->filterParams = NULL; } request->groups = d_tableNew(d_groupCompare, d_groupFree); handleResult = v_handleClaim(source, (v_object*)(vreaderPtr = &vreader)); if(handleResult == V_HANDLE_OK){ if(v_object(vreader)->kind == K_DATAREADER){ topic = v_dataReaderGetTopic(v_dataReader(vreader)); topicName = v_entity(topic)->name; partitions = ospl_c_select(v_subscriber(vreader->subscriber)->partitions->partitions, 0); partition = v_partition(c_iterTakeFirst(partitions)); while(partition){ quality.seconds = 0; quality.nanoseconds = 0; dgroup = d_groupNew( v_entity(partition)->name, topicName, topic->qos->durability.kind, D_GROUP_KNOWLEDGE_UNDEFINED, quality); d_tableInsert(request->groups, dgroup); c_free(partition); partition = v_partition(c_iterTakeFirst(partitions)); } c_free(topic); } else { d_readerRequestFree(request); request = NULL; } v_handleRelease(source); } else { d_readerRequestFree(request); request = NULL; } } return request; }
/************************************************************** * Protected functions **************************************************************/ s_kernelManager s_kernelManagerNew( spliced daemon) { s_kernelManager km; s_configuration config; os_mutexAttr mtxAttr; os_condAttr cvAttr; int status; os_result osr; status = 0; km = os_malloc((os_uint32)C_SIZEOF(s_kernelManager)); if (km) { km->spliced = splicedGetService(daemon); km->active = 0; osr = os_mutexAttrInit(&mtxAttr); if (osr == os_resultSuccess) { mtxAttr.scopeAttr = OS_SCOPE_PRIVATE; osr = os_mutexInit(&km->mtx, &mtxAttr); } else { status++; } if (osr == os_resultSuccess) { osr = os_condAttrInit(&cvAttr); if (osr == os_resultSuccess) { cvAttr.scopeAttr = OS_SCOPE_PRIVATE; osr = os_condInit(&km->cv, &km->mtx, &cvAttr); } else { os_mutexDestroy(&km->mtx); /* don't care if this succeeds, already in error situation */ status++; } if (osr == os_resultSuccess) { config = splicedGetConfiguration(daemon); osr = os_threadCreate(&km->id, S_THREAD_KERNELMANAGER, &config->kernelManagerScheduling, kernelManager, km); if (osr != os_resultSuccess) { /* don't care if the following statements succeeds, already in error situation */ os_mutexDestroy(&km->mtx); os_condDestroy(&km->cv); status++; } } if (osr == os_resultSuccess) { config = splicedGetConfiguration(daemon); osr = os_threadCreate(&km->resendManager, S_THREAD_RESENDMANAGER, &config->resendManagerScheduling, resendManager, km); if (osr != os_resultSuccess) { /* don't care if the following statements succeeds, already in error situation */ os_mutexDestroy(&km->mtx); os_condDestroy(&km->cv); status++; } } if (osr == os_resultSuccess ) { config = splicedGetConfiguration(daemon); if (config->enableCandMCommandThread ) { osr = os_threadCreate(&km->cAndMCommandManager, S_THREAD_C_AND_M_COMMANDMANAGER, &config->cAndMCommandScheduling, cAndMCommandManager, km); if (osr != os_resultSuccess) { /* don't care if the following statements succeeds, already in error situation */ os_mutexDestroy(&km->mtx); os_condDestroy(&km->cv); status++; } } } } else { status++; } } if (status && km) { os_free(km); km = NULL; } return km; }
/* This operation scans through the list of items within the 'stac' pragma. * For each structure that is identified it will locate the corresponding * meta structure. It will then locate each member mentioned in the 'stac' * pragma within the member list of said meta structure. It will verify the * located member is indeed a character array. * It will then proceed to replace the meta data describing the located member * with new meta data with as goal to have the new meta data identify the member * as a string instead of as a character array. * All replaced meta data is stored in out variables to facilitate restore the * member list of the meta structure back into it's original configuration. * This operation is needed then the meta data of the found structure is * converted to XML. As the XML generation code is located in the database and * we do not want the database to get knowledge of the 'stac' pragma. */ c_iter idl_stacDefConvertAll( idl_stacDef stacDef) { os_uint32 size; os_uint32 i; idl_stacMap stacMapItem; c_structure structure; c_iter memberNames; os_uint32 memberNamesSize; os_uint32 j; os_char* memberName; os_int32 memberIndex; c_member member; c_member newMember; os_uint32* replacedIndex; idl_stacDefReplaceInfo replaceData; c_iter replaceInfo; c_base base; c_iter boundedStringToBeConverted; os_boolean stacCanBeApplied = OS_TRUE; os_boolean onlyExclusionlistings; if(stacDef) { /* Create collections to hold the original members and their respective * indexes in the member collection so we can easily restore the meta * structure to it's original configuration at a later time. */ replaceInfo = c_iterNew(NULL); size = c_iterLength (stacDef->stacList); for(i = 0; i < size; i++) { stacMapItem = c_iterObject (stacDef->stacList, i); /* find the matching structure in the meta data */ structure = idl_stacDefFindMetaStructureResolved( stacMapItem->scope, stacMapItem->typeName); assert(structure); replaceData = os_malloc(C_SIZEOF(idl_stacDefReplaceInfo)); replaceData->structure = structure; replaceData->replacedIndexes = c_iterNew(NULL); replaceData->replacedMembers = c_iterNew(NULL); memberNames = c_splitString(stacMapItem->stacList, ","); onlyExclusionlistings = idl_stacDefOnlyExclusionsDefined(stacMapItem->stacList); memberNamesSize = c_iterLength(memberNames); boundedStringToBeConverted = c_iterNew(NULL); if(memberNamesSize == 0 || onlyExclusionlistings) { os_uint32 membersSize; membersSize = c_arraySize(structure->members); for(j = 0; j < membersSize; j++) { member = c_member(structure->members[j]); memberName = c_specifier(member)->name; /* check if this member is in the list of member names when * the member names list contains exclusion listings */ if((onlyExclusionlistings && c_iterResolve(memberNames, idl_stacDefNamesAreEqual, memberName) == NULL) || memberNamesSize == 0) { stacCanBeApplied = idl_stacDefCanStacBeAppliedToMember(c_specifier(member)->type); if(stacCanBeApplied) { /* this is a bounded string, so we want to convert */ c_iterInsert(boundedStringToBeConverted, member); } } } } else { for(j = 0; j < memberNamesSize; j++) { memberName = c_iterTakeFirst(memberNames); if(memberName[0] == '!') { printf("FATAL ERROR | #pragma stac: Illegal syntax combination detected. " "The pragma stac definition for structure %s contains both normal " "member listings (without the '!' character in front of them) as " "well as exclusion member listings (with the '!' character in front " "of them). This has no relevant meaning, please see the deployment manual " "for information on usage of pragma stac.\n" "Ignoring the following member defintion: '%s'\n", c_metaScopedName(c_metaObject(structure)), memberName); exit(-2); } memberIndex = idl_stacDefFindMemberIndexByName( structure->members, memberName); if(memberIndex == -1) { printf("FATAL ERROR | #pragma stac: Unable to locate member %s " "within structure %s.\n", memberName, c_metaScopedName(c_metaObject(structure))); exit(-2); } member = structure->members[memberIndex]; /* Verify the member is a bounded string as required */ stacCanBeApplied = idl_stacDefCanStacBeAppliedToMember(c_specifier(member)->type); if(!stacCanBeApplied) { printf("FATAL ERROR | #pragma stac: Member %s within structure " "%s is not a bounded string (note: may be embedded within an array or sequence) as required.\n", memberName, c_metaScopedName(c_metaObject(structure))); assert(0); exit(-2); } /* this is a bounded string, so we want to convert */ c_iterInsert(boundedStringToBeConverted, member); } } while(c_iterLength(boundedStringToBeConverted) > 0) { member = c_iterTakeFirst(boundedStringToBeConverted); memberIndex = idl_stacDefFindMemberIndexByName( structure->members, c_specifier(member)->name); assert(memberIndex != -1); newMember = c_metaDefine(c_metaObject(structure), M_MEMBER); base = c_getBase(member); c_specifier(newMember)->name = c_stringNew(base, c_specifier(member)->name); c_specifier(newMember)->type = idl_stacDefConvertStacApprovedMember(structure, c_specifier(member)->type); if(!c_specifier(newMember)->type) { printf("FATAL ERROR | #pragma stac: An internal error occured. Member %s within structure " "%s failed to convert from a bounded string to a character array.\n", c_specifier(newMember)->name, c_metaScopedName(c_metaObject(structure))); assert(0); exit(-2); } structure->members[memberIndex] = newMember; c_iterInsert(replaceData->replacedMembers, member); replacedIndex = os_malloc(sizeof(os_uint32)); *replacedIndex = memberIndex; c_iterInsert(replaceData->replacedIndexes, replacedIndex); } c_iterInsert(replaceInfo, replaceData); } } return replaceInfo; }
void cmx_readerSnapshotNewAction( v_public p, c_voidp args) { v_dataReader reader; c_iter instances; v_dataReaderInstance instance; v_dataReaderSample sample; v_query query; c_bool release; sd_serializer ser; sd_serializedData data; struct cmx_readerSnapshotArg* arg; release = FALSE; arg = (struct cmx_readerSnapshotArg*)args; reader = NULL; instances = NULL; ser = NULL; switch(v_object(p)->kind){ case K_DATAREADER: reader = v_dataReader(p); arg->success = TRUE; arg->snapshot = cmx_readerSnapshot(os_malloc(C_SIZEOF(cmx_readerSnapshot))); v_observerLock(v_observer(reader)); if(reader->index->objects){ instances = ospl_c_select(reader->index->notEmptyList, 0); } break; case K_QUERY: case K_DATAREADERQUERY: query = v_query(p); reader = v_dataReader(v_querySource(query)); if(reader != NULL){ release = TRUE; arg->success = TRUE; arg->snapshot = cmx_readerSnapshot(os_malloc(C_SIZEOF(cmx_readerSnapshot))); v_observerLock(v_observer(reader)); switch(v_object(query)->kind){ case K_DATAREADERQUERY: if(v_dataReaderQuery(query)->instanceQ){ instances = ospl_c_select((c_collection)(v_dataReaderQuery(query)->instanceQ), 0); } break; default: OS_REPORT(OS_ERROR, CM_XML_CONTEXT, 0, "cmx_readerSnapshotNewAction unknown kind (%d).", v_object(query)->kind); break; } } break; default: break; } if(arg->success == TRUE){ arg->snapshot->samples = c_iterNew(NULL); } if(instances != NULL){ v_dataReaderSample sampleShallowCopy = NULL; instance = v_dataReaderInstance(c_iterTakeFirst(instances)); while(instance != NULL){ v_state ivState = instance->_parent._parent.state & (L_DISPOSED | L_NOWRITERS | L_NEW); sample = v_dataReaderInstanceOldest(instance); if (sample != NULL) { do { v_state state = ivState | ((sample->_parent.sampleState & (L_READ | L_LAZYREAD)) ? L_READ : 0); if (sampleShallowCopy == NULL) { sampleShallowCopy = c_new(c_getType(c_object(sample))); } memcpy(sampleShallowCopy, sample, c_typeSize(c_getType(sampleShallowCopy))); sampleShallowCopy->newer = NULL; sampleShallowCopy->_parent.sampleState &= ~(L_DISPOSED | L_NOWRITERS | L_NEW | L_READ | L_LAZYREAD); sampleShallowCopy->_parent.sampleState |= state; if(ser == NULL){ ser = sd_serializerXMLNewTyped(c_getType(c_object(sampleShallowCopy))); } data = sd_serializerSerialize(ser, c_object(sampleShallowCopy)); arg->snapshot->samples = c_iterInsert(arg->snapshot->samples, sd_serializerToString(ser, data)); sd_serializedDataFree(data); sample = sample->newer; } while (sample != NULL); } c_free(instance); instance = v_dataReaderInstance(c_iterTakeFirst(instances)); } c_iterFree(instances); if (sampleShallowCopy != NULL) { memset(sampleShallowCopy, 0, c_typeSize(c_getType(sampleShallowCopy))); c_free(sampleShallowCopy); } } if(reader != NULL){ v_observerUnlock(v_observer(reader)); if(release == TRUE){ c_free(reader); } } if(ser != NULL){ sd_serializerFree(ser); } }
cms_client cms_clientNew( unsigned long ip, cms_service service, const c_char* uri) { cms_client client; os_result osr; os_mutexAttr attr; os_condAttr condAttr; client = cms_client(os_malloc(C_SIZEOF(cms_client))); cms_threadInit(cms_thread(client), "cms_client", &service->configuration->clientScheduling); if(client != NULL){ cms_object(client)->kind = CMS_CLIENT; cms_thread(client)->uri = os_strdup(uri); client->ip = ip; client->initCount = 0; client->service = service; client->internalFree = FALSE; osr = os_mutexAttrInit(&attr); if(osr == os_resultSuccess){ attr.scopeAttr = OS_SCOPE_PRIVATE; osr = os_mutexInit(&client->soapMutex, &attr); client->soapEnvs = c_iterNew(NULL); if(osr == os_resultSuccess){ osr = os_condAttrInit(&condAttr); if(osr == os_resultSuccess){ osr = os_mutexInit(&client->conditionMutex, &attr); if(osr == os_resultSuccess){ condAttr.scopeAttr = OS_SCOPE_PRIVATE; osr = os_condInit(&client->condition, &client->conditionMutex, &condAttr ); if(osr == os_resultSuccess){ osr = os_mutexInit(&client->threadMutex, &attr); if(osr == os_resultSuccess){ client->threads = c_iterNew(NULL); } else { cms_clientFree(client); } } } else { cms_clientFree(client); } } else { cms_clientFree(client); } } else { cms_clientFree(client); } } else { cms_clientFree(client); } } if(client == NULL){ if(service->configuration->verbosity >= 1){ OS_REPORT(OS_ERROR, CMS_CONTEXT, 0, "cms_clientNew: client could not be initialized."); } } return client; }
cms_service cms_serviceNew( const c_char* name, const c_char* uri) { cms_service service; c_bool success; const c_char* init; C_STRUCT(v_participantQos) q; struct sockaddr_in addr; socklen_t len; os_result errcode; char* ipTagStr = NULL; char* xmlStr = NULL; u_result result; os_result res; os_ifAttributes *ifList; os_uint32 nofIf, i; service = NULL; if(uri != NULL) { init = cmx_initialise(); if(strcmp(init, CMS_RESULT_OK) == 0) { service = cms_service(os_malloc(C_SIZEOF(cms_service))); cms_object(service)->kind = CMS_SERVICE; service->terminate = FALSE; service->leaseThread = NULL; service->clients = NULL; service->soap = NULL; service->configuration = NULL; service->garbageCollector = NULL; service->uservice = u_serviceNew(uri, CMSERVICE_ATTACH_TIMEOUT, name, NULL, U_SERVICE_CMSOAP, NULL); if(service->uservice != NULL) { /*disable all events.*/ u_dispatcherSetEventMask(u_dispatcher(service->uservice), 0); u_entityAction(u_entity(service->uservice), cms_serviceActionGroups, NULL); u_serviceChangeState(service->uservice, STATE_INITIALISING); success = cms_serviceInit(name, service); result = u_participantQosInit((v_participantQos)&q); if (result == U_RESULT_OK) { /* Insert service information in userData QoS */ len = sizeof(struct sockaddr); errcode = os_sockGetsockname (service->soap->master, (struct sockaddr*)&addr, len); if(errcode == os_resultSuccess) { OS_REPORT_1(OS_INFO, CMS_CONTEXT, 0, "SOAP service is reachable via port %d",ntohs(addr.sin_port)); ifList = os_malloc(MAX_INTERFACES * sizeof(*ifList)); #ifdef WITH_IPV6 res = os_sockQueryIPv6Interfaces(ifList, (os_uint32)MAX_INTERFACES, &nofIf); #else res = os_sockQueryInterfaces(ifList, (os_uint32)MAX_INTERFACES, &nofIf); #endif /* SOAP userdata layout: * <TunerService> * <Ip>x.x.x.x:port</Ip> [<Ip>x.x.x.x</Ip>]... * </TunerService> */ if (res == os_resultSuccess) { os_char tmp[64]; int chars; for (i = 0; i < nofIf; i++) { /* ignore the local loopback interface */ if (!os_sockaddrIsLoopback((os_sockaddr*)&ifList[i].address)) { os_sprintf(tmp,"%s",inet_ntoa(((os_sockaddr_in*)&ifList[i].address)->sin_addr)); if (strcmp(tmp,"0.0.0.0") != 0) { chars = os_sprintf(tmp, IP_TAG, inet_ntoa(((os_sockaddr_in*)&ifList[i].address)->sin_addr), ntohs(addr.sin_port)); if (chars > 0) { if (ipTagStr) { ipTagStr = os_realloc(ipTagStr, strlen(ipTagStr) + chars + 1); } else { ipTagStr = os_malloc(chars + 1); *ipTagStr = '\0'; } ipTagStr = os_strcat(ipTagStr, tmp); } } } } } else { if(service->configuration->verbosity >= 1) { OS_REPORT(OS_WARNING, CMS_CONTEXT, 0,"Could not get SOAP ip address."); } ipTagStr = os_malloc((strlen(IP_TAG) + INET6_ADDRSTRLEN_EXTENDED)); os_sprintf (ipTagStr, IP_TAG, "127.0.0.1", ntohs(addr.sin_port)); } os_free(ifList); xmlStr = os_malloc(strlen(ipTagStr) + strlen(SOAP_TAG)+1); os_sprintf (xmlStr, SOAP_TAG, ipTagStr); os_free(ipTagStr); q.userData.size = strlen(xmlStr); q.userData.value = os_malloc(q.userData.size); memcpy(q.userData.value, xmlStr, q.userData.size); if(service->configuration->verbosity >= 5) { OS_REPORT_1(OS_INFO, CMS_CONTEXT, 0, "SOAP userData: %s", xmlStr); } os_free(xmlStr); } else { q.userData.size = 0; q.userData.value = NULL; if(service->configuration->verbosity >= 1) { OS_REPORT(OS_WARNING, CMS_CONTEXT, 0, "Could not get SOAP port."); } } result = u_entitySetQoS(u_entity(service->uservice), (v_qos)&q); if (result != U_RESULT_OK) { if(service->configuration->verbosity >= 1) { OS_REPORT(OS_WARNING, CMS_CONTEXT, 0,"Could not update the participantQos for publication of the SOAP ip address and port."); } } os_free(q.userData.value); } else { if(service->configuration->verbosity >= 1) { OS_REPORT(OS_WARNING, CMS_CONTEXT, 0,"Could not initiate participantQos for SOAP service ip address and port publication."); } } if(success == FALSE) { cms_serviceFree(service); service = NULL; } else { u_serviceWatchSpliceDaemon(service->uservice, cms_serviceSplicedaemonListener, service); u_serviceChangeState(service->uservice, STATE_OPERATIONAL); } } else { OS_REPORT(OS_ERROR, CMS_CONTEXT, 0, "cms_serviceNew: user layer service could not be created."); cms_serviceFree(service); service = NULL; } } else { if(service && service->configuration->verbosity >= 1) { OS_REPORT(OS_ERROR, CMS_CONTEXT, 0, "cms_serviceNew: C&M API could not be initialized."); } } } else { if(service && service->configuration->verbosity > 0) { OS_REPORT(OS_ERROR, CMS_CONTEXT, 0, "cms_serviceNew: no uri supplied."); } } return service; }
void monitor_trcAction ( v_entity entity, c_voidp args ) { c_base base; monitor_trc trace = monitor_trc(args); time_t t; os_address totalSize; time (&t); base = c_getBase(entity); printf ("\r\n################# Start tracing ################## %s\r\n", ctime(&t)); printf ("Limit : %d\r\n", trace->objectCountLimit); if (trace->filterExpression) { printf ("Filter expression : %s\r\n", trace->filterExpression); } printf ("\r\n"); if (trace->delta) { printf ("%6s (%8s) %8s %12s %-15s %-15s %s\r\n", "Delta", "ObjCount", "ObjSize", "TotalSize", "ObjectKind", "CollectionKind", "TypeName"); } else { printf ("%8s %8s %12s %-15s %-15s %s\r\n", "ObjCount", "ObjSize", "TotalSize", "ObjectKind", "CollectionKind", "TypeName"); } printf ("----------------------------------------------------------------------------------------------------------\r\n"); trace->totalCount = 0; trace->totalExtentCount = 0; trace->index = 0; if (trace->oKind == NO_ORDERING) { c_metaWalk (c_metaObject (base), metaobject, trace); } else { trace->orderedList = ut_tableNew (orderLeafs, trace); c_metaWalk (c_metaObject (base), orderedWalk, trace); ut_walk(trace->orderedList, orderedAction, trace); ut_tableFree(trace->orderedList, NULL, NULL, NULL, NULL); trace->orderedList = NULL; } printf ("\r\n"); printf (" %ld for %ld object headers (%d) and MM headers (%d)\r\n", trace->totalExtentCount * (C_SIZEOF(c_header) + MM_HEADER_SIZE), trace->totalExtentCount, C_SIZEOF(c_header), MM_HEADER_SIZE); totalSize = trace->totalCount + trace->totalExtentCount * (C_SIZEOF(c_header) + MM_HEADER_SIZE); printf ("Total : %d (%.2f KB)\r\n", totalSize, (double)totalSize/1024.0); trace->cycleNr++; }
C_STRUCT(monitor_trc) { c_long objectCountLimit; char *filterExpression; ut_collection extTree; os_address totalCount; long totalExtentCount; orderKind oKind; int orderCount; int index; ut_collection orderedList; unsigned int cycleNr; c_bool delta; }; static const c_long HEADERSIZE = ALIGNSIZE(C_SIZEOF(c_header)); C_CLASS(refLeaf); C_STRUCT(refLeaf) { c_type tr; unsigned int ec; unsigned int ecp; unsigned int cycleNr; }; static c_type nullType = (c_type)0xffffffff; static void freeNode ( c_object o,