aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt2
-rw-r--r--src/cmake/syscall.cmake (renamed from src/cmake/memfd.cmake)10
-rw-r--r--src/vppinfra/linux/syscall.h6
-rw-r--r--src/vppinfra/pmalloc.c3
4 files changed, 17 insertions, 4 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 161e3c57c44..d467da7549a 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -84,7 +84,7 @@ set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME "vpp")
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
-include(cmake/memfd.cmake)
+include(cmake/syscall.cmake)
include(cmake/api.cmake)
include(cmake/library.cmake)
include(cmake/exec.cmake)
diff --git a/src/cmake/memfd.cmake b/src/cmake/syscall.cmake
index ca499c459ab..1e0a559b5df 100644
--- a/src/cmake/memfd.cmake
+++ b/src/cmake/syscall.cmake
@@ -24,3 +24,13 @@ if (HAVE_MEMFD_CREATE)
add_definitions(-DHAVE_MEMFD_CREATE)
endif()
+check_c_source_compiles("
+ #define _GNU_SOURCE
+ #include <sched.h>
+ int main() { return getcpu (0, 0); }
+" HAVE_GETCPU)
+
+if (HAVE_GETCPU)
+ add_definitions(-DHAVE_GETCPU)
+endif()
+
diff --git a/src/vppinfra/linux/syscall.h b/src/vppinfra/linux/syscall.h
index 1ae029d5802..c07cad631bd 100644
--- a/src/vppinfra/linux/syscall.h
+++ b/src/vppinfra/linux/syscall.h
@@ -19,11 +19,13 @@
#include <unistd.h>
#include <sys/syscall.h>
+#ifndef HAVE_GETCPU
static inline int
-getcpu (unsigned *cpu, unsigned *node, void *tcache)
+getcpu (unsigned *cpu, unsigned *node)
{
- return syscall (__NR_getcpu, cpu, node, tcache);
+ return syscall (__NR_getcpu, cpu, node, 0);
}
+#endif
static inline long
set_mempolicy (int mode, const unsigned long *nodemask, unsigned long maxnode)
diff --git a/src/vppinfra/pmalloc.c b/src/vppinfra/pmalloc.c
index 9f908f40cc9..d9e50d15733 100644
--- a/src/vppinfra/pmalloc.c
+++ b/src/vppinfra/pmalloc.c
@@ -21,6 +21,7 @@
#include <unistd.h>
#include <linux/mempolicy.h>
#include <linux/memfd.h>
+#include <sched.h>
#include <vppinfra/format.h>
#include <vppinfra/linux/syscall.h>
@@ -53,7 +54,7 @@ pmalloc_validate_numa_node (u32 * numa_node)
if (*numa_node == CLIB_PMALLOC_NUMA_LOCAL)
{
u32 cpu;
- if (getcpu (&cpu, numa_node, 0) != 0)
+ if (getcpu (&cpu, numa_node) != 0)
return 1;
}
return 0;