/** Get DHCPEnabled status from the process list */ bool NetworkInterfaceConfigurationEnumeration::GetDHCPEnabledFromProcessList( std::wstring& name, SCXCoreLib::SCXHandle<NetworkInstanceConfigurationEnumerationDeps> deps) { ProcessEnumeration procEnum; procEnum.SampleData(); procEnum.Update(true); std::vector<SCXCoreLib::SCXHandle<ProcessInstance> > proc_v = deps->Find(L"dhcpcd", procEnum); if(proc_v.size() == 0) return false; for(std::vector<SCXCoreLib::SCXHandle<ProcessInstance> >::iterator i = proc_v.begin(); i != proc_v.end(); ++i) { SCXCoreLib::SCXHandle<ProcessInstance> process = (*i); std::vector<std::string> parms; if(!process->GetParameters(parms)) continue; for(std::vector<std::string>::iterator i_parms = parms.begin(); i_parms != parms.end(); i_parms++) if(name.compare(SCXCoreLib::StrFromMultibyte(*i_parms)) == 0) return true; } return false; }
/** Set all properties from the ProcessInstance in the SCXInstance \param[in] processinst - Process instance to get data from \param[in] inst - Instance to populate \param[in] cimtype - Type of CIM Class to return \throws SCXInvalidArgumentException - If the instance can not be converted to a ProcessInstance This method knows how to map the values of the Process PAL to the CMPI class definition. */ void ProcessProvider::AddProperties(SCXCoreLib::SCXHandle<SCXSystemLib::ProcessInstance> processinst, SCXInstance &inst, SupportedCimClasses cimtype) // private { if (processinst == NULL) { throw SCXInvalidArgumentException(L"einst", L"Not a ProcessInstance", SCXSRCLOCATION); } SCX_LOGTRACE(m_log, L"ProcessProvider AddPropeties()"); if (eSCX_UnixProcessStatisticalInformation == cimtype) { unsigned int uint = 0; scxulong ulong = 0; if (processinst->GetRealData(ulong)) { SCXProperty prop(L"RealData", ulong); inst.AddProperty(prop); } if (processinst->GetRealStack(ulong)) { SCXProperty prop(L"RealStack", ulong); inst.AddProperty(prop); } if (processinst->GetVirtualText(ulong)) { SCXProperty prop(L"VirtualText", ulong); inst.AddProperty(prop); } if (processinst->GetVirtualData(ulong)) { SCXProperty prop(L"VirtualData", ulong); inst.AddProperty(prop); } if (processinst->GetVirtualStack(ulong)) { SCXProperty prop(L"VirtualStack", ulong); inst.AddProperty(prop); } if (processinst->GetVirtualMemoryMappedFileSize(ulong)) { SCXProperty prop(L"VirtualMemoryMappedFileSize", ulong); inst.AddProperty(prop); } if (processinst->GetVirtualSharedMemory(ulong)) { SCXProperty prop(L"VirtualSharedMemory", ulong); inst.AddProperty(prop); } if (processinst->GetCpuTimeDeadChildren(ulong)) { SCXProperty prop(L"CpuTimeDeadChildren", ulong); inst.AddProperty(prop); } if (processinst->GetSystemTimeDeadChildren(ulong)) { SCXProperty prop(L"SystemTimeDeadChildren", ulong); inst.AddProperty(prop); } if (processinst->GetRealText(ulong)) { SCXProperty prop(L"RealText", ulong); inst.AddProperty(prop); } if (processinst->GetCPUTime(uint)) { SCXProperty prop(L"CPUTime", uint); inst.AddProperty(prop); } if (processinst->GetBlockWritesPerSecond(ulong)) { SCXProperty prop(L"BlockWritesPerSecond", ulong); inst.AddProperty(prop); } if (processinst->GetBlockReadsPerSecond(ulong)) { SCXProperty prop(L"BlockReadsPerSecond", ulong); inst.AddProperty(prop); } if (processinst->GetBlockTransfersPerSecond(ulong)) { SCXProperty prop(L"BlockTransfersPerSecond", ulong); inst.AddProperty(prop); } if (processinst->GetPercentUserTime(ulong)) { SCXProperty prop(L"PercentUserTime", (unsigned char) ulong); inst.AddProperty(prop); } if (processinst->GetPercentPrivilegedTime(ulong)) { SCXProperty prop(L"PercentPrivilegedTime", (unsigned char) ulong); inst.AddProperty(prop); } if (processinst->GetUsedMemory(ulong)) { SCXProperty prop(L"UsedMemory", ulong); inst.AddProperty(prop); } if (processinst->GetPercentUsedMemory(ulong)) { SCXProperty prop(L"PercentUsedMemory", (unsigned char) ulong); inst.AddProperty(prop); } if (processinst->GetPagesReadPerSec(ulong)) { SCXProperty prop(L"PagesReadPerSec", ulong); inst.AddProperty(prop); } } else if (eSCX_UnixProcess == cimtype) { std::string name(""); std::vector<std::string> params; std::wstring str(L""); unsigned int uint = 0; unsigned short ushort = 0; scxulong ulong = 0; SCXCoreLib::SCXCalendarTime ctime; int pid = 0; if (processinst->GetOtherExecutionDescription(str)) { SCXProperty prop(L"OtherExecutionDescription", str); inst.AddProperty(prop); } if (processinst->GetKernelModeTime(ulong)) { SCXProperty prop(L"KernelModeTime", ulong); inst.AddProperty(prop); } if (processinst->GetUserModeTime(ulong)) { SCXProperty prop(L"UserModeTime", ulong); inst.AddProperty(prop); } if (processinst->GetWorkingSetSize(ulong)) { SCXProperty prop(L"WorkingSetSize", ulong); inst.AddProperty(prop); } if (processinst->GetProcessSessionID(ulong)) { SCXProperty prop(L"ProcessSessionID", ulong); inst.AddProperty(prop); } if (processinst->GetProcessTTY(name)) { SCXProperty prop(L"ProcessTTY", StrFromMultibyte(name)); inst.AddProperty(prop); } if (processinst->GetModulePath(name)) { SCXProperty prop(L"ModulePath", StrFromMultibyte(name)); inst.AddProperty(prop); } if (processinst->GetParameters(params)) { std::vector<SCXProperty> props; for (std::vector<std::string>::const_iterator iter = params.begin(); iter != params.end(); ++iter) { SCXProperty item(L"", StrFromMultibyte(*iter)); props.push_back(item); } SCXProperty prop(L"Parameters", props); inst.AddProperty(prop); } if (processinst->GetProcessWaitingForEvent(name)) { SCXProperty prop(L"ProcessWaitingForEvent", StrFromMultibyte(name)); inst.AddProperty(prop); } if (processinst->GetName(name)) { SCXProperty name_prop(L"Name", StrFromMultibyte(name)); inst.AddProperty(name_prop); } if (processinst->GetPriority(uint)) { SCXProperty prio_prop(L"Priority", uint); inst.AddProperty(prio_prop); } if (processinst->GetExecutionState(ushort)) { SCXProperty state_prop(L"ExecutionState", ushort); inst.AddProperty(state_prop); } if (processinst->GetCreationDate(ctime)) { SCXProperty cdate_prop(L"CreationDate", ctime); inst.AddProperty(cdate_prop); } if (processinst->GetTerminationDate(ctime)) { SCXProperty edate_prop(L"TerminationDate", ctime); inst.AddProperty(edate_prop); } if (processinst->GetParentProcessID(pid)) { SCXProperty ppid_prop(L"ParentProcessID", StrFrom(pid)); inst.AddProperty(ppid_prop); } if (processinst->GetRealUserID(ulong)) { SCXProperty user_prop(L"RealUserID", ulong); inst.AddProperty(user_prop); } if (processinst->GetProcessGroupID(ulong)) { SCXProperty group_prop(L"ProcessGroupID", ulong); inst.AddProperty(group_prop); } if (processinst->GetProcessNiceValue(uint)) { SCXProperty nice_prop(L"ProcessNiceValue", uint); inst.AddProperty(nice_prop); } } }