Skip to content

Commit a9666f6

Browse files
committed
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
2 parents 7cac8d0 + 2341e6f commit a9666f6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/unix/solaris/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1208,7 +1208,7 @@ pub const EPOLLET: ::c_int = 0x80000000;
12081208
pub const EPOLLRDHUP: ::c_int = 0x2000;
12091209
pub const EPOLLEXCLUSIVE: ::c_int = 0x10000000;
12101210
pub const EPOLLONESHOT: ::c_int = 0x40000000;
1211-
pub const EPOLL_CLOEXEC: ::c_int = 0x02000000;
1211+
pub const EPOLL_CLOEXEC: ::c_int = 0x80000;
12121212
pub const EPOLL_CTL_ADD: ::c_int = 1;
12131213
pub const EPOLL_CTL_MOD: ::c_int = 3;
12141214
pub const EPOLL_CTL_DEL: ::c_int = 2;

0 commit comments

Comments
 (0)