Skip to content

Fails to build with musl due to incorrect arguments to libc::ioctl #8229

Open
@jirutka

Description

   Compiling below-ethtool v0.8.1 (below-0.8.1/below/ethtool)
error[E0308]: mismatched types
   --> below/ethtool/src/reader.rs:36:58
    |
36  |     let exit_code = unsafe { libc::ioctl(fd.as_raw_fd(), nix::libc::SIOCETHTOOL, &ifr) };
    |                              -----------                 ^^^^^^^^^^^^^^^^^^^^^^ expected `i32`, found `u64`
    |                              |
    |                              arguments to this function are incorrect
    |
note: function defined here
   --> .cargo/registry/src/index.crates.io-6f17d22bba15001f/libc-0.2.153/src/unix/linux_like/linux/musl/mod.rs:850:12
    |
850 |     pub fn ioctl(fd: ::c_int, request: ::c_int, ...) -> ::c_int;
    |            ^^^^^
help: you can convert a `u64` to an `i32` and panic if the converted value doesn't fit
    |
36  |     let exit_code = unsafe { libc::ioctl(fd.as_raw_fd(), nix::libc::SIOCETHTOOL.try_into().unwrap(), &ifr) };
    |                                                                                ++++++++++++++++++++
  • Alpine Linux Edge x86_64
  • musl libc 1.2.5
  • rust 1.77.0

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