VxWorks: Add safety comment for vxCpuEnabledGet · patricklam/verify-rust-std@39b1eaf (original) (raw)

Skip to content

Provide feedback

Saved searches

Use saved searches to filter your results more quickly

Sign up

Appearance settings

Commit 39b1eaf

biabbastgross35

and

authored

VxWorks: Add safety comment for vxCpuEnabledGet

Co-authored-by: Trevor Gross t.gross35@gmail.com

File tree

1 file changed

lines changed

1 file changed

lines changed

Lines changed: 1 addition & 1 deletion

Original file line number Diff line number Diff line change
@@ -477,8 +477,8 @@ pub fn available_parallelism() -> io::Result<NonZero> {
477 477 fn vxCpuEnabledGet() -> libc::cpuset_t;
478 478 }
479 479
480 +// SAFETY: `vxCpuEnabledGet` always fetches a mask with at least one bit set
480 481 unsafe{
481 -// always fetches a valid bitmask
482 482 let set = vxCpuEnabledGet();
483 483 Ok(NonZero::new_unchecked(set.count_ones() as usize))
484 484 }