From 39b1eafc08c3edd2b5c7e8ac02382181994fa3a2 Mon Sep 17 00:00:00 2001 From: B I Mohammed Abbas Date: Fri, 9 Aug 2024 09:05:09 +0530 Subject: [PATCH] VxWorks: Add safety comment for vxCpuEnabledGet Co-authored-by: Trevor Gross --- std/src/sys/pal/unix/thread.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/std/src/sys/pal/unix/thread.rs b/std/src/sys/pal/unix/thread.rs index 6f17c73908dad..0fa610eebb4ef 100644 --- a/std/src/sys/pal/unix/thread.rs +++ b/std/src/sys/pal/unix/thread.rs @@ -477,8 +477,8 @@ pub fn available_parallelism() -> io::Result> { fn vxCpuEnabledGet() -> libc::cpuset_t; } + // SAFETY: `vxCpuEnabledGet` always fetches a mask with at least one bit set unsafe{ - // always fetches a valid bitmask let set = vxCpuEnabledGet(); Ok(NonZero::new_unchecked(set.count_ones() as usize)) }