Skip to content

Conversation

@dcuddeback
Copy link

On FreeBSD ioctl() is defined as taking c_ulong as the request parameter:

fn ioctl(fd: c_int, request: c_ulong, ...) -> c_int

Constants meant to be passed as the request parameter were being defined as a mixture of c_uint and c_ulong, which can cause type errors. For example, the following program

extern crate libc;

fn main() {
    unsafe {
        libc::ioctl(1, libc::TIOCEXCL);
    }
}

results in a type error:

error[E0308]: mismatched types
 --> src/main.rs:5:24
  |
5 |         libc::ioctl(1, libc::TIOCEXCL);
  |                        ^^^^^^^^^^^^^^ expected u64, found u32

This commit changes ioctl request constants on FreeBSD to c_ulong, which fixes the compilation error in the above test program.

On FreeBSD `ioctl()` is defined as taking `c_ulong` as the `request`
parameter:

    fn ioctl(fd: c_int, request: c_ulong, ...) -> c_int

Constants meant to be passed as the `request` parameter should be
defined as `c_ulong` to avoid requiring explicit type casts. These
constants were being defined as a mixture of `c_uint` and `c_ulong`.
This commit changes ioctl request constants on FreeBSD to `c_ulong`.
@rust-highfive
Copy link

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @alexcrichton (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@dcuddeback
Copy link
Author

Duplicate of #704. Sorry, I overlooked that there was an existing PR before opening this one.

@dcuddeback dcuddeback closed this Jun 21, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants