| ... | @@ -10,7 +10,6 @@ pub const cpuset_t = extern struct { | ... | @@ -10,7 +10,6 @@ pub const cpuset_t = extern struct { |
| 10 | __bits: [(CPU_SETSIZE + (@bitSizeOf(c_long) - 1)) / @bitSizeOf(c_long)]c_long, | 10 | __bits: [(CPU_SETSIZE + (@bitSizeOf(c_long) - 1)) / @bitSizeOf(c_long)]c_long, |
| 11 | }; | 11 | }; |
| 12 | | 12 | |
| 13 | // TODO: can eventually serve for the domainset_t's type too. | | |
| 14 | fn __BIT_COUNT(bits: []const c_long) c_long { | 13 | fn __BIT_COUNT(bits: []const c_long) c_long { |
| 15 | var count: c_long = 0; | 14 | var count: c_long = 0; |
| 16 | for (bits) |b| { | 15 | for (bits) |b| { |
| ... | @@ -2563,8 +2562,18 @@ pub const DOMAINSET = struct { | ... | @@ -2563,8 +2562,18 @@ pub const DOMAINSET = struct { |
| 2563 | pub const POLICY_MAX = DOMAINSET.POLICY_INTERLEAVE; | 2562 | pub const POLICY_MAX = DOMAINSET.POLICY_INTERLEAVE; |
| 2564 | }; | 2563 | }; |
| 2565 | | 2564 | |
| | 2565 | pub const DOMAINSET_SIZE = 256; |
| 2566 | pub const domainset_t = extern struct { | 2566 | pub const domainset_t = extern struct { |
| | 2567 | __bits: [(DOMAINSET_SIZE + (@sizeOf(domainset) - 1)) / @bitSizeOf(domainset)]domainset, |
| | 2568 | }; |
| | 2569 | |
| | 2570 | pub fn DOMAINSET_COUNT(set: domainset_t) c_int { |
| | 2571 | return @intCast(c_int, __BIT_COUNT(set.__bits[0..])); |
| | 2572 | } |
| | 2573 | |
| | 2574 | pub const domainset = extern struct { |
| 2567 | link: LIST_ENTRY, | 2575 | link: LIST_ENTRY, |
| | 2576 | mask: domainset_t, |
| 2568 | policy: u16, | 2577 | policy: u16, |
| 2569 | prefer: domainid_t, | 2578 | prefer: domainid_t, |
| 2570 | cnt: domainid_t, | 2579 | cnt: domainid_t, |