Ring buffer: use shmp (shared-memory pointers) for per-channel shm structures
[lttng-ust.git] / libringbuffer / smp.c
CommitLineData
a6352fd4
MD
1/*
2 * libust/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 "ust/core.h"
11#include "usterr.h"
12#include <pthread.h>
13#include "smp.h"
14
15int __num_possible_cpus;
16
17void _get_num_possible_cpus(void)
18{
19 int result;
20
21 /* On Linux, when some processors are offline
22 * _SC_NPROCESSORS_CONF counts the offline
23 * processors, whereas _SC_NPROCESSORS_ONLN
24 * does not. If we used _SC_NPROCESSORS_ONLN,
25 * getcpu() could return a value greater than
26 * this sysconf, in which case the arrays
27 * indexed by processor would overflow.
28 */
29 result = sysconf(_SC_NPROCESSORS_CONF);
30 if (result == -1)
31 return;
32 __num_possible_cpus = result;
33}
This page took 0.023888 seconds and 4 git commands to generate.