Remove core.h
[lttng-ust.git] / libringbuffer / smp.c
1 /*
2 * libringbuffer/smp.c
3 *
4 * Copyright 2011 (c) - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 *
6 * Dual LGPL v2.1/GPL v2 license.
7 */
8
9 #include <unistd.h>
10 #include "usterr.h"
11 #include <pthread.h>
12 #include "smp.h"
13
14 int __num_possible_cpus;
15
16 void _get_num_possible_cpus(void)
17 {
18 int result;
19
20 /* On Linux, when some processors are offline
21 * _SC_NPROCESSORS_CONF counts the offline
22 * processors, whereas _SC_NPROCESSORS_ONLN
23 * does not. If we used _SC_NPROCESSORS_ONLN,
24 * getcpu() could return a value greater than
25 * this sysconf, in which case the arrays
26 * indexed by processor would overflow.
27 */
28 result = sysconf(_SC_NPROCESSORS_CONF);
29 if (result == -1)
30 return;
31 __num_possible_cpus = result;
32 }
This page took 0.037101 seconds and 5 git commands to generate.