#include <fcntl.h>
#include <ust/kernelcompat.h>
#include <kcompat/kref.h>
+#include <stdlib.h>
#include "buffers.h"
#include "channels.h"
#include "tracer.h"
int result;
static int n_cpus = 0;
- if(n_cpus) {
- return n_cpus;
- }
+ if(!n_cpus) {
+ /* 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;
+ }
- /* 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;
+ n_cpus = result;
}
- n_cpus = result;
-
- return result;
+ return n_cpus;
}
/* _ust_buffers_write()
ltt_release_transport);
ltt_relay_print_buffer_errors(ltt_chan, cpu);
//ust// free(ltt_buf->commit_seq);
- kfree(ltt_buf->commit_count);
+ free(ltt_buf->commit_count);
ltt_buf->commit_count = NULL;
kref_put(<t_chan->kref, ltt_relay_release_channel);
kref_put(&trace->kref, ltt_release_trace);