void* doSendPasRegister(void *data) { long rval = 0; rval = (long)register_pers_admin_service(); // register to PAS return (void*)rval; }
static int private_pclInitLibrary(const char* appName, int shutdownMode) { int rval = 1; char blacklistPath[PERS_ORG_MAX_LENGTH_PATH_FILENAME] = {0}; gShutdownMode = shutdownMode; #if USE_APPCHECK doInitAppcheck(appName); // check if we have a trusted application #endif #if USE_FILECACHE DLT_LOG(gPclDLTContext, DLT_LOG_DEBUG, DLT_STRING("Using the filecache!!!")); pfcInitCache(appName); #endif pthread_mutex_lock(&gDbusPendingRegMtx); // block until pending received // Assemble backup blacklist path snprintf(blacklistPath, PERS_ORG_MAX_LENGTH_PATH_FILENAME, "%s%s/%s", CACHEPREFIX, appName, gBackupFilename); if(readBlacklistConfigFile(blacklistPath) == -1) { DLT_LOG(gPclDLTContext, DLT_LOG_DEBUG, DLT_STRING("initLibrary - Err access blacklist:"), DLT_STRING(blacklistPath)); } if(setup_dbus_mainloop() == -1) { DLT_LOG(gPclDLTContext, DLT_LOG_ERROR, DLT_STRING("initLibrary - Failed to setup main loop")); pthread_mutex_unlock(&gDbusPendingRegMtx); return EPERS_DBUS_MAINLOOP; } if(gShutdownMode != PCL_SHUTDOWN_TYPE_NONE) { if(register_lifecycle(shutdownMode) == -1) // register for lifecycle dbus messages { DLT_LOG(gPclDLTContext, DLT_LOG_ERROR, DLT_STRING("initLibrary => Failed reg to LC dbus interface")); pthread_mutex_unlock(&gDbusPendingRegMtx); return EPERS_REGISTER_LIFECYCLE; } } #if USE_PASINTERFACE DLT_LOG(gPclDLTContext, DLT_LOG_DEBUG, DLT_STRING("PAS interface is enabled!!")); if(register_pers_admin_service() == -1) { DLT_LOG(gPclDLTContext, DLT_LOG_ERROR, DLT_STRING("initLibrary - Failed reg to PAS dbus interface")); pthread_mutex_unlock(&gDbusPendingRegMtx); return EPERS_REGISTER_ADMIN; } else { DLT_LOG(gPclDLTContext, DLT_LOG_DEBUG, DLT_STRING("initLibrary - Successfully established IPC protocol for PCL.")); } #else DLT_LOG(gPclDLTContext, DLT_LOG_DEBUG, DLT_STRING("PAS interface not enabled, enable with \"./configure --enable-pasinterface\"")); #endif if(load_custom_plugins(customAsyncInitClbk) < 0) // load custom plugins { DLT_LOG(gPclDLTContext, DLT_LOG_WARN, DLT_STRING("Failed to load custom plugins")); } init_key_handle_array(); pers_unlock_access(); strncpy(gAppId, appName, PERS_RCT_MAX_LENGTH_RESPONSIBLE); // assign application name gAppId[PERS_RCT_MAX_LENGTH_RESPONSIBLE-1] = '\0'; return rval; }