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

Skip to content

Navigation Menu

Sign in

Appearance settings

Provide feedback

We read every piece of feedback, and take your input very seriously.

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>

1 parent 4d6b36a commit 39b1eaf

File tree

1 file changed

+

1

-

1

lines changed

1 file changed

+

1

-

1

lines changed

Lines changed: 1 addition & 1 deletion

Original file line numberDiff line numberDiff line change

@@ -477,8 +477,8 @@ pub fn available_parallelism() -> io::Result<NonZero<usize>> {

477477

fn vxCpuEnabledGet() -> libc::cpuset_t;

478478

}

479479
480+

// SAFETY: `vxCpuEnabledGet` always fetches a mask with at least one bit set

480481

unsafe{

481-

// always fetches a valid bitmask

482482

let set = vxCpuEnabledGet();

483483

Ok(NonZero::new_unchecked(set.count_ones() as usize))

484484

}

0 commit comments

Comments

 (0)