MCPcopy Create free account
hub / github.com/bytecodealliance/rustix / do_register

Function do_register

tests/io_uring/register.rs:14–37  ·  view source on GitHub ↗
(
    fd: FD,
    registered_fd: bool,
    opcode: IoringRegisterOp,
    arg: *mut c_void,
    arg_nr: u32,
)

Source from the content-addressed store, hash-verified

12use rustix::mm::{MapFlags, ProtFlags};
13
14fn do_register<FD>(
15 fd: FD,
16 registered_fd: bool,
17 opcode: IoringRegisterOp,
18 arg: *mut c_void,
19 arg_nr: u32,
20) -> Result<()>
21where
22 FD: AsFd,
23{
24 let flags = if registered_fd {
25 IoringRegisterFlags::USE_REGISTERED_RING
26 } else {
27 IoringRegisterFlags::default()
28 };
29
30 // Cast `arg` to `*const c_void` to match the current API. See
31 // <https://github.com/bytecodealliance/rustix/issues/1545>.
32 unsafe {
33 io_uring_register_with(fd, opcode, flags, arg as *const c_void, arg_nr)?;
34 }
35
36 Ok(())
37}
38
39fn register_ring(fd: BorrowedFd<'_>) -> Result<BorrowedFd<'_>> {
40 let mut update = io_uring_rsrc_update::default();

Callers 4

register_ringFunction · 0.85
unregister_ringFunction · 0.85
register_buf_ringFunction · 0.85

Calls 1

io_uring_register_withFunction · 0.50

Tested by

no test coverage detected