summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTom Jones <thj@freebsd.org>2024-01-26 13:48:49 +0000
committerDamjan Marion <dmarion@0xa5.net>2024-02-19 18:11:34 +0000
commitac80b8be8be5757b667a9aa7ddf258b36f695a5a (patch)
tree49a79833dfbbb567a5e2a78e1d5c1f7413c89003
parent03b7ac929e7e41c67de0426d2a9e005b8bc5d963 (diff)
vppinfra: Stub out get_current_cpu and get_current_numa on FreeBSD
FreeBSD has its own set of syscalls for getting current CPU and NUMA domain information. Stub out these calls and return CPU 0 and NUMA domain 0 as placeholders until we bring in FreeBSD specific calls. Type: improvement Change-Id: Id61df0273b0bcc6acf4844ee626e4f246f9f217b Signed-off-by: Tom Jones <thj@freebsd.org>
-rw-r--r--src/vppinfra/cpu.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/vppinfra/cpu.c b/src/vppinfra/cpu.c
index 79e7dc0955e..385a4e25408 100644
--- a/src/vppinfra/cpu.c
+++ b/src/vppinfra/cpu.c
@@ -252,17 +252,25 @@ format_cpu_flags (u8 *s, va_list *args)
__clib_export u32
clib_get_current_cpu_id ()
{
+#ifdef __linux__
unsigned cpu, node;
syscall (__NR_getcpu, &cpu, &node, 0);
return cpu;
+#else
+ return 0;
+#endif /* __linux__ */
}
__clib_export u32
clib_get_current_numa_node ()
{
+#ifdef __linux__
unsigned cpu, node;
syscall (__NR_getcpu, &cpu, &node, 0);
return node;
+#else
+ return 0;
+#endif /* __linux__ */
}
__clib_export u8 *