Skip to content

Commit 86dacac

Browse files
authored
Fix the test_is_io_flusher test. (#1510)
* Fix the `test_is_io_flusher` test. Capability sets are bitsets, so to compute an index, use `leading_zeros()` on the bitpattern. * Fix compilation with individual features enabled.
1 parent 8b203f5 commit 86dacac

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/backend/linux_raw/c.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,10 +117,10 @@ pub(crate) use linux_raw_sys::{
117117
},
118118
};
119119

120-
#[cfg(feature = "time")]
120+
#[cfg(any(feature = "io_uring", feature = "time", feature = "thread"))]
121121
pub use linux_raw_sys::general::__kernel_clockid_t as clockid_t;
122122

123-
#[cfg(all(feature = "net", feature = "time"))]
123+
#[cfg(feature = "net")]
124124
pub use linux_raw_sys::net::{sock_txtime, SCM_TXTIME, SO_TXTIME};
125125

126126
#[cfg(all(feature = "net", feature = "time"))]

tests/process/prctl.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,9 @@ pub(crate) fn thread_has_capability(capability: CapabilitySet) -> io::Result<boo
175175
return Err(io::Error::last_os_error());
176176
}
177177

178-
let cap_index = capability.bits() as u32;
178+
let cap_bits = capability.bits();
179+
assert_eq!(cap_bits.count_ones(), 1);
180+
let cap_index = cap_bits.leading_zeros();
179181
let (data_index, cap_index) = if cap_index < 32 {
180182
(0, cap_index)
181183
} else {

0 commit comments

Comments
 (0)