Skip to content

Commit c1b3860

Browse files
committed
Auto merge of #2617 - devnexen:fbsd14_cpuset_upd, r=Amanieu
freebsd add CPU_COUNT macro
2 parents 847f717 + 21aadd4 commit c1b3860

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

libc-test/semver/freebsd.txt

+5
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,11 @@ CMSG_LEN
163163
CMSG_NXTHDR
164164
CMSG_SPACE
165165
CODESET
166+
CPU_CLR
167+
CPU_COUNT
168+
CPU_ISSET
169+
CPU_SET
170+
CPU_ZERO
166171
CRNCYSTR
167172
CRTSCTS
168173
CRTS_IFLOW

src/unix/bsd/freebsdlike/freebsd/mod.rs

+11
Original file line numberDiff line numberDiff line change
@@ -3711,6 +3711,17 @@ f! {
37113711
0 != cpuset.__bits[idx] & (1 << offset)
37123712
}
37133713

3714+
pub fn CPU_COUNT(cpuset: &cpuset_t) -> ::c_int {
3715+
let mut s: u32 = 0;
3716+
let cpuset_size = ::mem::size_of::<cpuset_t>();
3717+
let bitset_bits = ::mem::size_of::<::c_long>();
3718+
3719+
for i in cpuset.__bits[..(cpuset_size / bitset_bits)].iter() {
3720+
s += i.count_ones();
3721+
};
3722+
s as ::c_int
3723+
}
3724+
37143725
pub fn SOCKCRED2SIZE(ngrps: usize) -> usize {
37153726
let ngrps = if ngrps > 0 {
37163727
ngrps - 1

0 commit comments

Comments
 (0)