return n_cpus;
}
- result = sysconf(_SC_NPROCESSORS_ONLN);
+ /* On Linux, when some processors are offline
+ * _SC_NPROCESSORS_CONF counts the offline
+ * processors, whereas _SC_NPROCESSORS_ONLN
+ * does not. If we used _SC_NPROCESSORS_ONLN,
+ * getcpu() could return a value greater than
+ * this sysconf, in which case the arrays
+ * indexed by processor would overflow.
+ */
+ result = sysconf(_SC_NPROCESSORS_CONF);
if(result == -1) {
return -1;
}
for(; i>=0; i--) {
ust_buffers_close_buf(chan->buf[i]);
error:
+ do {} while(0);
}
kref_put(&chan->kref, ust_buffers_destroy_channel);