You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Auto merge of #1026 - papertigers:master, r=alexcrichton
illumos header translation is wrong 02000000 should be 0x80000
I am recently getting into rust and discovered that tokio wasn't working on illumos. I traced it back to mio but ultimately the issue ended up being this value in the libc crate. It looks like the octal value isn't properly translated to the rust crate as hex. Here's a test program I was using on linux and illumos:
```rust
extern crate libc;
#[allow(dead_code)]
const ILLUMOS_EPOLL_CLOEXEC: i32 = 0x80000;
fn find_func() -> usize {
unsafe { libc::dlsym(libc::RTLD_DEFAULT, "epoll_create1\0".as_ptr() as *const _) as usize }
}
fn main() {
let addr = find_func();
#[allow(unused_variables)]
let hex = format!("{:x}", addr);
// I think the position changes per run on linux due to something like ASLR
// so we only test on solaris for this use case
#[cfg(target_os = "solaris")]
assert_eq!(hex, "ffffbf7fff226fe0"); // confirmed with addrtosymstr
unsafe {
let f = std::mem::transmute::<usize, fn(i32) -> i32>(addr);
#[cfg(target_os = "linux")]
let epfd = f(libc::EPOLL_CLOEXEC);
#[cfg(target_os = "solaris")]
let epfd = f(ILLUMOS_EPOLL_CLOEXEC);
println!("call to epoll_create1 returned: {}", epfd);
}
}
```
Which outputs the following:
```
# cargo run
Finished dev [unoptimized + debuginfo] target(s) in 0.04s
Running `target/debug/dlsym`
call to epoll_create1 returned: 3
```
Edit: typo
0 commit comments