In r320043 (https://svnweb.freebsd.org/changeset/base/320043), `struct kevent` was modified in the following way: @@ -62,8 +66,9 @@ short filter; /* filter for event */ unsigned short flags; unsigned int fflags; - __intptr_t data; + __int64_t data; void *udata; /* opaque user data identifier */ + __uint64_t ext[4]; }; It means we need to patch libc's Rust version of that structure in `src/unix/bsd/freebsdlike/mod.rs`, when built on FreeBSD 12-CURRENT: pub struct kevent { pub ident: ::uintptr_t, pub filter: ::c_short, pub flags: ::c_ushort, pub fflags: ::c_uint, pub data: ::intptr_t, pub udata: *mut ::c_void, } I don't know if it's a consequence of this problem, but the `mio` crate doesn't work on my laptop running HEAD: $ cargo test Updating registry `https://github.com/rust-lang/crates.io-index` Compiling libc v0.2.29 Compiling slab v0.3.0 ... Finished dev [unoptimized + debuginfo] target(s) in 9.10 secs Running target/debug/deps/mio-368f23a642284461 running 3 tests test sys::unix::kqueue::test_coalesce_aio ... ok test poll::as_raw_fd ... FAILED test sys::unix::kqueue::does_not_register_rw ... FAILED failures: ---- poll::as_raw_fd stdout ---- thread 'poll::as_raw_fd' panicked at 'assertion failed: `(left == right)` (left: `0`, right: `16384`)', src/sys/unix/kqueue.rs:117 ---- sys::unix::kqueue::does_not_register_rw stdout ---- thread 'sys::unix::kqueue::does_not_register_rw' panicked at 'assertion failed: `(left == right)` (left: `0`, right: `16384`)', src/sys/unix/kqueue.rs:117 note: Run with `RUST_BACKTRACE=1` for a backtrace. failures: poll::as_raw_fd sys::unix::kqueue::does_not_register_rw test result: FAILED. 1 passed; 2 failed; 0 ignored; 0 measured; 0 filtered out error: test failed, to rerun pass '--lib' This is quite problematic because important crates such as `tokio-core` or `hyper` do not work...
Maintainer informed via mail
A GitHub issue was opened some time ago in the Rust repository: https://github.com/rust-lang/rust/issues/42681 And here is the pull request to the `libc` crate to support FreeBSD 12.x: https://github.com/rust-lang/libc/pull/721 There is a second patch to the `mio` crate to know about the changes in libc: https://github.com/dumbbell/mio/tree/support-freebsd12-abi With those two patches, the testsuites of `mio` and `hyper` are successful on FreeBSD 10.3 and FreeBSD 12.0.
Cloning the patched mio + libc does not compile at this point: # git clone https://github.com/dumbbell/mio -b support-freebsd12-abi # cd mio edit the Cargo.tom to include the mentioned libc branch: libc = { git = "https://github.com/dumbbell/libc", branch = "support-freebsd12-abi" } # cargo test Updating registry `https://github.com/rust-lang/crates.io-index` Updating git repository `https://github.com/dumbbell/libc` Downloading lazycell v0.5.1 Downloading net2 v0.2.31 Downloading env_logger v0.4.3 Downloading bytes v0.3.0 Downloading iovec v0.1.0 Downloading log v0.3.8 Downloading tempdir v0.3.5 Downloading slab v0.3.0 Downloading cfg-if v0.1.2 Downloading rand v0.3.16 Downloading libc v0.2.30 Compiling libc v0.2.30 Compiling log v0.3.8 Compiling lazycell v0.5.1 Compiling libc v0.2.29 (https://github.com/dumbbell/libc?branch=support-freebsd12-abi#4bd22611) Compiling slab v0.3.0 Compiling bytes v0.3.0 Compiling cfg-if v0.1.2 Compiling env_logger v0.4.3 Compiling iovec v0.1.0 Compiling net2 v0.2.31 Compiling rand v0.3.16 Compiling mio v0.6.10 (file:///root/mio) error[E0308]: mismatched types --> src/sys/unix/tcp.rs:134:34 | 134 | slice.as_ptr(), | ^^^^^^^^^^^^^^ expected struct `libc::iovec`, found struct `libc::unix::iovec` | = note: expected type `*const libc::iovec` found type `*const libc::unix::iovec` = help: here are some functions which might fulfill your needs: - .offset(...) - .wrapping_offset(...) error[E0308]: mismatched types --> src/sys/unix/tcp.rs:149:35 | 149 | slice.as_ptr(), | ^^^^^^^^^^^^^^ expected struct `libc::iovec`, found struct `libc::unix::iovec` | = note: expected type `*const libc::iovec` found type `*const libc::unix::iovec` = help: here are some functions which might fulfill your needs: - .offset(...) - .wrapping_offset(...) error: aborting due to previous error(s) error: Could not compile `mio`. Build failed, waiting for other jobs to finish... error: build failed
Obsolete after ports r467538 which contains https://github.com/rust-lang/libc/commit/969ad2b73cdc? If so close the bug.
You're right, mio works on FreeBSD 12-CURRENT now.