char value_str[INT_BUFSIZE_BOUND(value)];
char *tmp;
- if (virAsprintf(&path, "%s/cpu%u/%s", dir, cpu, file) < 0) {
- virReportOOMError();
+ if (virAsprintf(&path, "%s/cpu%u/%s", dir, cpu, file) < 0)
return -1;
- }
pathfp = fopen(path, "r");
if (pathfp == NULL) {
int i;
if (virAsprintf(&path, "%s/cpu%u/topology/thread_siblings",
- dir, cpu) < 0) {
- virReportOOMError();
+ dir, cpu) < 0)
return 0;
- }
pathfp = fopen(path, "r");
if (pathfp == NULL) {
sock_max++;
/* allocate cpu maps for each socket */
- if (VIR_ALLOC_N(core_maps, sock_max) < 0) {
- virReportOOMError();
+ if (VIR_ALLOC_N(core_maps, sock_max) < 0)
goto cleanup;
- }
for (i = 0; i < sock_max; i++)
CPU_ZERO(&core_maps[i]);
/* OK, we've parsed clock speed out of /proc/cpuinfo. Get the
* core, node, socket, thread and topology information from /sys
*/
- if (virAsprintf(&sysfs_nodedir, "%s/node", sysfs_dir) < 0) {
- virReportOOMError();
+ if (virAsprintf(&sysfs_nodedir, "%s/node", sysfs_dir) < 0)
goto cleanup;
- }
if (!(nodedir = opendir(sysfs_nodedir))) {
/* the host isn't probably running a NUMA architecture */
nodeinfo->nodes++;
if (virAsprintf(&sysfs_cpudir, "%s/node/%s",
- sysfs_dir, nodedirent->d_name) < 0) {
- virReportOOMError();
+ sysfs_dir, nodedirent->d_name) < 0)
goto cleanup;
- }
if ((cpus = virNodeParseNode(sysfs_cpudir, &socks, &cores,
&threads, &offline)) < 0)
fallback:
VIR_FREE(sysfs_cpudir);
- if (virAsprintf(&sysfs_cpudir, "%s/cpu", sysfs_dir) < 0) {
- virReportOOMError();
+ if (virAsprintf(&sysfs_cpudir, "%s/cpu", sysfs_dir) < 0)
goto cleanup;
- }
if ((cpus = virNodeParseNode(sysfs_cpudir, &socks, &cores,
&threads, &offline)) < 0)
virBitmapPtr map = NULL;
char *str = NULL;
- if (virFileReadAll(path, 5 * VIR_DOMAIN_CPUMASK_LEN, &str) < 0) {
- virReportOOMError();
+ if (virFileReadAll(path, 5 * VIR_DOMAIN_CPUMASK_LEN, &str) < 0)
goto error;
- }
if (virBitmapParse(str, 0, &map, max_cpuid) < 0)
goto error;
# endif
if (virAsprintf(&meminfo_path, "%s/node/node%d/meminfo",
- SYSFS_SYSTEM_PATH, cellNum) < 0) {
- virReportOOMError();
+ SYSFS_SYSTEM_PATH, cellNum) < 0)
return -1;
- }
}
meminfo = fopen(meminfo_path, "r");
i++;
VIR_FREE(cpupath);
if (virAsprintf(&cpupath, "%s/cpu/cpu%d",
- SYSFS_SYSTEM_PATH, i) < 0) {
- virReportOOMError();
+ SYSFS_SYSTEM_PATH, i) < 0)
return -1;
- }
} while (virFileExists(cpupath));
} else {
/* no cpu/cpu0: we give up */
int i;
cpumap = virBitmapNew(present);
- if (!cpumap) {
- virReportOOMError();
+ if (!cpumap)
return NULL;
- }
for (i = 0; i < present; i++) {
int online = virNodeGetCpuValue(SYSFS_SYSTEM_PATH, i, "online", 1);
if (online < 0) {
field++;
if (virAsprintf(&path, "%s/%s",
SYSFS_MEMORY_SHARED_PATH, field) < 0) {
- virReportOOMError();
ret = -2;
goto cleanup;
}
if (virAsprintf(&strval, "%u", param->value.ui) == -1) {
- virReportOOMError();
ret = -2;
goto cleanup;
}
sa_assert(field);
field++;
if (virAsprintf(&path, "%s/%s",
- SYSFS_MEMORY_SHARED_PATH, field) < 0) {
- virReportOOMError();
+ SYSFS_MEMORY_SHARED_PATH, field) < 0)
return false;
- }
if (!virFileExists(path)) {
virReportError(VIR_ERR_OPERATION_INVALID,
int rc = -1;
if (virAsprintf(&path, "%s/%s",
- SYSFS_MEMORY_SHARED_PATH, field) < 0) {
- virReportOOMError();
+ SYSFS_MEMORY_SHARED_PATH, field) < 0)
goto cleanup;
- }
if (!virFileExists(path)) {
ret = -2;
ncpus = VIR_NODEINFO_MAXCPUS(nodeinfo);
- if (VIR_ALLOC_N(cpus, ncpus) < 0) {
- virReportOOMError();
+ if (VIR_ALLOC_N(cpus, ncpus) < 0)
return -1;
- }
id = 0;
for (s = 0; s < nodeinfo.sockets; s++) {
virBitmapPtr ret = NULL;
if (virAsprintf(&path, "%s/cpu%u/topology/thread_siblings_list",
- dir, cpu_id) < 0) {
- virReportOOMError();
+ dir, cpu_id) < 0)
goto cleanup;
- }
if (virFileReadAll(path, SYSFS_THREAD_SIBLINGS_LIST_LENGTH_MAX, &buf) < 0)
goto cleanup;