The LTTNG_UST_PAGE_SIZE define can either point to a literal value or
the sysconf() function making buf[] a VLA. Replace this by a
cpumask specifc define that will always be a literal value.
Change-Id: I8d329f314878e8018939f979861918969e3ec8ac
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
+#include <limits.h>
#include <unistd.h>
#include <pthread.h>
#include <stdlib.h>
#include <urcu/compiler.h>
-#include "common/align.h"
#include "common/logging.h"
#include "common/smp.h"
static void _get_num_possible_cpus(void)
{
int ret;
- int buf_len = LTTNG_UST_PAGE_SIZE;
- char buf[buf_len];
+ char buf[LTTNG_UST_CPUMASK_SIZE];
/* Get the possible cpu mask from sysfs, fallback to sysconf. */
- ret = get_possible_cpu_mask_from_sysfs((char *) &buf, buf_len);
+ ret = get_possible_cpu_mask_from_sysfs((char *) &buf, LTTNG_UST_CPUMASK_SIZE);
if (ret <= 0)
goto fallback;
#ifndef _UST_COMMON_SMP_H
#define _UST_COMMON_SMP_H
+#define LTTNG_UST_CPUMASK_SIZE 4096
+
/*
* Get the CPU possible mask string from sysfs.
*