Add check for required io-uring opcodes

This commit is contained in:
Nikolay Kim 2025-03-17 09:22:00 +01:00
parent 11734e8f1b
commit 1f3406d8bc
4 changed files with 19 additions and 1 deletions

View file

@ -1,5 +1,9 @@
# Changes
## [2.5.5] - 2025-03-xx
* Add check for required io-uring opcodes
## [2.5.4] - 2025-03-15
* Close FD in various case for poll driver

View file

@ -40,7 +40,7 @@ ntex-util = "2.5"
ntex-tokio = { version = "0.5.3", optional = true }
ntex-compio = { version = "0.2.4", optional = true }
ntex-neon = { version = "0.1.4", optional = true }
ntex-neon = { version = "0.1.5", optional = true }
bitflags = { workspace = true }
cfg-if = { workspace = true }

View file

@ -32,6 +32,10 @@ impl ConnectOps {
Runtime::value(|rt| {
let mut inner = None;
rt.driver().register(|api| {
if !api.is_supported(opcode::Connect::CODE) {
panic!("opcode::Connect is required for io-uring support");
}
let ops = Rc::new(ConnectOpsInner {
api,
ops: RefCell::new(Slab::new()),

View file

@ -61,6 +61,16 @@ impl<T: os::fd::AsRawFd + 'static> StreamOps<T> {
Runtime::value(|rt| {
let mut inner = None;
rt.driver().register(|api| {
if !api.is_supported(opcode::Recv::CODE) {
panic!("opcode::Recv is required for io-uring support");
}
if !api.is_supported(opcode::Send::CODE) {
panic!("opcode::Send is required for io-uring support");
}
if !api.is_supported(opcode::Close::CODE) {
panic!("opcode::Close is required for io-uring support");
}
let mut ops = Slab::new();
ops.insert(Operation::Nop);