diff --git a/.travis.yml b/.travis.yml
index 41aa192..e11aaa4 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -37,6 +37,9 @@ matrix:
- rm -rf target/doc
- cargo doc --no-deps --all --all-features
- cargo deadlinks --dir target/doc
+ # also test minimum dependency versions are usable
+ - cargo generate-lockfile -Z minimal-versions
+ - cargo test
- rust: nightly
os: osx
@@ -52,6 +55,9 @@ matrix:
- rm -rf target/doc
- cargo doc --no-deps --all --all-features
- cargo deadlinks --dir target/doc
+ # also test minimum dependency versions are usable
+ - cargo generate-lockfile -Z minimal-versions
+ - cargo test
- rust: nightly
env: DESCRIPTION="WASM via emscripten, stdweb and wasm-bindgen"
@@ -97,6 +103,14 @@ matrix:
#- cargo build --target=x86_64-unknown-fuchsia --all-features
- cargo build --target=x86_64-unknown-netbsd --all-features
- cargo build --target=x86_64-unknown-redox --all-features
+ # also test minimum dependency versions are usable
+ - cargo generate-lockfile -Z minimal-versions
+ - cargo build --target=x86_64-sun-solaris --all-features
+ - cargo build --target=x86_64-unknown-cloudabi --all-features
+ - cargo build --target=x86_64-unknown-freebsd --all-features
+ #- cargo build --target=x86_64-unknown-fuchsia --all-features
+ - cargo build --target=x86_64-unknown-netbsd --all-features
+ - cargo build --target=x86_64-unknown-redox --all-features
# Trust cross-built/emulated targets. We must repeat all non-default values.
- rust: stable
diff --git a/Cargo.toml b/Cargo.toml
index 7109397..99e1dab 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -14,11 +14,15 @@ members = [
"tests/wasm_bindgen",
]
+[dependencies]
+log = { version = "0.4", optional = true }
+
[target.'cfg(unix)'.dependencies]
-libc = "0.2"
+# In general, we need at least 0.2.27. On Solaris, we need some unknown newer version.
+libc = "0.2.50"
[target.'cfg(windows)'.dependencies]
-winapi = { version = "0.3", features = ["minwindef", "ntsecapi", "winnt"] }
+winapi = { version = "0.3.6", features = ["minwindef", "ntsecapi", "winnt"] }
[target.'cfg(target_os = "cloudabi")'.dependencies]
cloudabi = "0.0.3"
@@ -27,5 +31,5 @@ cloudabi = "0.0.3"
fuchsia-cprng = "0.1"
[target.wasm32-unknown-unknown.dependencies]
-wasm-bindgen = { version = "0.2.12", optional = true }
-stdweb = { version = "0.4", optional = true }
+wasm-bindgen = { version = "0.2.29", optional = true }
+stdweb = { version = "0.4.9", optional = true }
diff --git a/README.md b/README.md
index 4330a17..6d56630 100644
--- a/README.md
+++ b/README.md
@@ -38,6 +38,9 @@ fn get_random_buf() -> Result<[u8; 32], getrandom::Error> {
This library is `no_std` compatible on SGX but requires `std` on most platforms.
+The `log` library is supported as an optional dependency. If enabled, error
+reporting will be improved on some platforms.
+
For WebAssembly (`wasm32`), Enscripten targets are supported directly; otherwise
one of the following features must be enabled:
diff --git a/src/cloudabi.rs b/src/cloudabi.rs
index 1230f31..fc5f49d 100644
--- a/src/cloudabi.rs
+++ b/src/cloudabi.rs
@@ -11,7 +11,7 @@
extern crate cloudabi;
use core::num::NonZeroU32;
-use error::Error;
+use Error;
pub fn getrandom_inner(dest: &mut [u8]) -> Result<(), Error> {
let errno = unsafe { cloudabi::random_get(dest) };
@@ -19,6 +19,10 @@ pub fn getrandom_inner(dest: &mut [u8]) -> Result<(), Error> {
Ok(())
} else {
let code = NonZeroU32::new(errno as u32).unwrap();
+ error!("cloudabi::random_get syscall failed with code {}", code);
Err(Error::from(code))
}
}
+
+#[inline(always)]
+pub fn error_msg_inner(_: NonZeroU32) -> Option<&'static str> { None }
diff --git a/src/dragonfly_haiku.rs b/src/dragonfly_haiku.rs
index 751266b..8b8b947 100644
--- a/src/dragonfly_haiku.rs
+++ b/src/dragonfly_haiku.rs
@@ -7,11 +7,12 @@
// except according to those terms.
//! Implementation for DragonFly / Haiku
-use super::Error;
-use super::utils::use_init;
+use Error;
+use utils::use_init;
use std::fs::File;
use std::io::Read;
use std::cell::RefCell;
+use std::num::NonZeroU32;
thread_local!(static RNG_FILE: RefCell