From 95c61010a5ef72b90504cdd1487a26261aafdd39 Mon Sep 17 00:00:00 2001 From: B I Mohammed Abbas Date: Mon, 30 Dec 2024 08:42:44 +0530 Subject: [PATCH] Add vxworks implementation --- src/lib.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index 3583b3e..79ac79a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -432,6 +432,13 @@ fn get_num_cpus() -> usize { unsafe { hermit_abi::get_processor_count() } } +#[cfg(target_os = "vxworks")] +fn get_num_cpus() -> usize { + unsafe { + libc::vxCpuEnabledGet().count_ones() as usize + } +} + #[cfg(not(any( target_os = "macos", target_os = "ios", @@ -447,6 +454,7 @@ fn get_num_cpus() -> usize { target_os = "netbsd", target_os = "haiku", target_os = "hermit", + target_os = "vxworks", windows, )))] fn get_num_cpus() -> usize {