mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-09-08 00:00:13 +02:00
tests: handle EPERM in io_uring_supported helper (#8416)
Co-authored-by: philphauler <[email protected]>
This commit is contained in:
co-authored by
philphauler
parent
7d0d729d8f
commit
a316820fa4
@@ -20,10 +20,15 @@ use io_uring::IoUring;
|
|||||||
pub fn io_uring_supported() -> bool {
|
pub fn io_uring_supported() -> bool {
|
||||||
match IoUring::new(256) {
|
match IoUring::new(256) {
|
||||||
Ok(_) => true,
|
Ok(_) => true,
|
||||||
// The Kernel does not support io-uring
|
// ENOSYS: kernel does not support io_uring.
|
||||||
Err(e) if e.raw_os_error() == Some(libc::ENOSYS) => false,
|
// EPERM: io_uring disabled via sysctl kernel.io_uring_disabled (#7691).
|
||||||
Err(_) => unreachable!(
|
Err(e)
|
||||||
"The target should either support io_uring or return ENOSYS if not supported"
|
if e.raw_os_error() == Some(libc::ENOSYS) || e.raw_os_error() == Some(libc::EPERM) =>
|
||||||
|
{
|
||||||
|
false
|
||||||
|
}
|
||||||
|
Err(e) => unreachable!(
|
||||||
|
"IoUring::new failed with an unexpected error (expected ENOSYS or EPERM): {e}"
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user