Skip to content

io_safety feature is incomplete #377

Description

@betelgeuse

The io_safety feature introduced in #134 is incomplete. The API still allows usage of raw file descriptors.

$ cargo add io_uring --features io_safety
warning: translating `io_uring` to `io-uring`
    Updating crates.io index
      Adding io-uring v0.7.11 to dependencies
             Features:
             + io_safety
             - bindgen
             - direct-syscall
             - overwrite
             - sc
use io_uring::*;

fn main() {
    let entry = opcode::Splice::new(types::Fd(666), -1, types::Fd(666), -1, 100).build();
}
root@14c0e8d412b1:/app# cargo build
   Compiling libc v0.2.178
   Compiling io-uring v0.7.11
   Compiling io_uring_safe_example v0.1.0 (/app)
warning: unused variable: `entry`
 --> src/main.rs:4:9
  |
4 |     let entry = opcode::Splice::new(types::Fd(666), -1, types::Fd(666), -1, 100).build();
  |         ^^^^^ help: if this is intentional, prefix it with an underscore: `_entry`
  |
  = note: `#[warn(unused_variables)]` (part of `#[warn(unused)]`) on by default

warning: `io_uring_safe_example` (bin "io_uring_safe_example") generated 1 warning (run `cargo fix --bin "io_uring_safe_example" -p io_uring_safe_example` to apply 1 suggestion)
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 1.22s

A proper IO safe API would not allow taking integers as parameters.

https://rust-lang.github.io/rfcs/3128-io-safety.html

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions