summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2018-06-30 23:47:54 +0000
committerbors <bors@rust-lang.org>2018-06-30 23:47:54 +0000
commita9666f6010878c8797401fc67f56e84489bba31e (patch)
treef9260426f858d1efb1e82fffa3764ccd6ccfb1a2
parent7cac8d0c9db3eff1d8c0d0e21f4a27bedb3c0ad5 (diff)
parent2341e6f3ad2fa6aa0447a868c7fa2d5acd829810 (diff)
downloadrust-libc-a9666f6010878c8797401fc67f56e84489bba31e.tar.gz
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
-rw-r--r--src/unix/solaris/mod.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/unix/solaris/mod.rs b/src/unix/solaris/mod.rs
index d76bb80270..db122dea26 100644
--- a/src/unix/solaris/mod.rs
+++ b/src/unix/solaris/mod.rs
@@ -1208,7 +1208,7 @@ pub const EPOLLET: ::c_int = 0x80000000;
pub const EPOLLRDHUP: ::c_int = 0x2000;
pub const EPOLLEXCLUSIVE: ::c_int = 0x10000000;
pub const EPOLLONESHOT: ::c_int = 0x40000000;
-pub const EPOLL_CLOEXEC: ::c_int = 0x02000000;
+pub const EPOLL_CLOEXEC: ::c_int = 0x80000;
pub const EPOLL_CTL_ADD: ::c_int = 1;
pub const EPOLL_CTL_MOD: ::c_int = 3;
pub const EPOLL_CTL_DEL: ::c_int = 2;