for (i = 0 ; i < ncpus ; i++) {
virJSONValuePtr entry = virJSONValueArrayGet(data, i);
- int cpu;
int thread;
if (!entry) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
goto cleanup;
}
- if (virJSONValueObjectGetNumberInt(entry, "CPU", &cpu) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("cpu information was missing cpu number"));
- goto cleanup;
- }
-
if (virJSONValueObjectGetNumberInt(entry, "thread_id", &thread) < 0) {
/* Only qemu-kvm tree includs thread_id, so treat this as
non-fatal, simply returning no data */
goto cleanup;
}
- if (cpu != i) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
- _("unexpected cpu index %d expecting %d"),
- i, cpu);
- goto cleanup;
- }
-
threads[i] = thread;
}
{
char *qemucpus = NULL;
char *line;
- int lastVcpu = -1;
pid_t *cpupids = NULL;
size_t ncpupids = 0;
do {
char *offset = strchr(line, '#');
char *end = NULL;
- int vcpu = 0, tid = 0;
+ int tid = 0;
/* See if we're all done */
if (offset == NULL)
break;
- /* Extract VCPU number */
- if (virStrToLong_i(offset + 1, &end, 10, &vcpu) < 0)
- goto error;
-
if (end == NULL || *end != ':')
goto error;
if (end == NULL || !c_isspace(*end))
goto error;
- if (vcpu != (lastVcpu + 1))
- goto error;
-
if (VIR_REALLOC_N(cpupids, ncpupids+1) < 0)
goto error;
- VIR_DEBUG("vcpu=%d pid=%d", vcpu, tid);
+ VIR_DEBUG("pid=%d", tid);
cpupids[ncpupids++] = tid;
- lastVcpu = vcpu;
/* Skip to next data line */
line = strchr(offset, '\r');