Make dlopen more robust by using the .0 target for the library
[lttng-ust.git] / libringbuffer / smp.c
CommitLineData
a6352fd4 1/*
4318ae1b 2 * libringbuffer/smp.c
a6352fd4
MD
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>
a6352fd4
MD
10#include "usterr.h"
11#include <pthread.h>
12#include "smp.h"
13
14int __num_possible_cpus;
15
16void _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.023649 seconds and 4 git commands to generate.