Changeset 26595 in vbox for trunk/src/VBox/Additions/common
- Timestamp:
- Feb 17, 2010 2:42:20 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxService/VBoxServiceCpuHotPlug.cpp
r26061 r26595 65 65 66 66 PRTDIR pDirDevices = NULL; 67 int rc = RTDirOpen(&pDirDevices, SYSFS_ACPI_CPU_PATH); /* could use RTDirOpenFiltered*/67 int rc = RTDirOpen(&pDirDevices, SYSFS_ACPI_CPU_PATH); /* could use RTDirOpenFiltered */ 68 68 if (RT_SUCCESS(rc)) 69 69 { 70 RTDIRENTRY DirFolderContent; 71 while (RT_SUCCESS(RTDirRead(pDirDevices, &DirFolderContent, NULL))) /* Assumption that szName has always enough space */ 72 { 73 if (!strncmp(DirFolderContent.szName, "LNXCPU", 6)) 70 /* Search every ACPI0004 container device for LNXCPU devices. */ 71 RTDIRENTRY DirFolderAcpiContainer; 72 bool fFound = false; 73 74 while ( RT_SUCCESS(RTDirRead(pDirDevices, &DirFolderAcpiContainer, NULL)) 75 && !fFound) /* Assumption that szName has always enough space */ 76 { 77 if (!strncmp(DirFolderAcpiContainer.szName, "ACPI0004", 8)) 74 78 { 75 /* Get the sysdev */ 76 uint32_t idCore = RTLinuxSysFsReadIntFile(10, "%s/%s/sysdev/topology/core_id", 77 SYSFS_ACPI_CPU_PATH, DirFolderContent.szName); 78 uint32_t idPackage = RTLinuxSysFsReadIntFile(10, "%s/%s/sysdev/topology/physical_package_id", 79 SYSFS_ACPI_CPU_PATH, DirFolderContent.szName); 80 if ( idCore == idCpuCore 81 && idPackage == idCpuPackage) 79 char *pszAcpiContainerPath = NULL; 80 PRTDIR pDirAcpiContainer = NULL; 81 82 rc = RTStrAPrintf(&pszAcpiContainerPath, "%s/%s", SYSFS_ACPI_CPU_PATH, DirFolderAcpiContainer.szName); 83 if (RT_FAILURE(rc)) 84 break; 85 86 rc = RTDirOpen(&pDirAcpiContainer, pszAcpiContainerPath); 87 if (RT_SUCCESS(rc)) 82 88 { 83 /* Return the path */ 84 rc = RTStrAPrintf(ppszPath, "%s/%s", SYSFS_ACPI_CPU_PATH, DirFolderContent.szName); 85 break; 89 RTDIRENTRY DirFolderContent; 90 while (RT_SUCCESS(RTDirRead(pDirAcpiContainer, &DirFolderContent, NULL))) /* Assumption that szName has always enough space */ 91 { 92 if (!strncmp(DirFolderContent.szName, "LNXCPU", 6)) 93 { 94 /* Get the sysdev */ 95 uint32_t idCore = RTLinuxSysFsReadIntFile(10, "%s/%s/sysdev/topology/core_id", 96 pszAcpiContainerPath, DirFolderContent.szName); 97 uint32_t idPackage = RTLinuxSysFsReadIntFile(10, "%s/%s/sysdev/topology/physical_package_id", 98 pszAcpiContainerPath, DirFolderContent.szName); 99 if ( idCore == idCpuCore 100 && idPackage == idCpuPackage) 101 { 102 /* Return the path */ 103 rc = RTStrAPrintf(ppszPath, "%s/%s", pszAcpiContainerPath, DirFolderContent.szName); 104 fFound = true; 105 break; 106 } 107 } 108 } 109 110 RTDirClose(pDirAcpiContainer); 86 111 } 112 113 RTStrFree(pszAcpiContainerPath); 87 114 } 88 115 } … … 139 166 { 140 167 /** @todo r-bird: This code is bringing all CPUs online; the idCpuCore and 141 * idCpuPackage parameters are unused! */ 168 * idCpuPackage parameters are unused! 169 * aeichner: These files are not available at this point unfortunately. (see comment above) 170 */ 142 171 /* 143 172 * Check if this is a CPU object.
Note:
See TracChangeset
for help on using the changeset viewer.