Fix building for cygwin
This commit is contained in:
parent
e3e98c84d3
commit
1aad114afd
5 changed files with 14 additions and 5 deletions
|
@ -45,6 +45,7 @@ pub use self::stream::*;
|
|||
target_os = "openbsd",
|
||||
target_os = "nto",
|
||||
target_vendor = "apple",
|
||||
target_os = "cygwin",
|
||||
))]
|
||||
#[unstable(feature = "peer_credentials_unix_socket", issue = "42839", reason = "unstable")]
|
||||
pub use self::ucred::*;
|
||||
|
|
|
@ -75,6 +75,7 @@ const fn max_iov() -> usize {
|
|||
target_os = "horizon",
|
||||
target_os = "vita",
|
||||
target_vendor = "apple",
|
||||
target_os = "cygwin",
|
||||
)))]
|
||||
const fn max_iov() -> usize {
|
||||
16 // The minimum value required by POSIX.
|
||||
|
|
|
@ -316,7 +316,8 @@ mod imp {
|
|||
target_os = "netbsd",
|
||||
target_os = "hurd",
|
||||
target_os = "linux",
|
||||
target_os = "l4re"
|
||||
target_os = "l4re",
|
||||
target_os = "cygwin"
|
||||
))]
|
||||
unsafe fn get_stack_start() -> Option<*mut libc::c_void> {
|
||||
let mut ret = None;
|
||||
|
@ -371,7 +372,7 @@ mod imp {
|
|||
// this way someone on any unix-y OS can check that all these compile
|
||||
if cfg!(all(target_os = "linux", not(target_env = "musl"))) {
|
||||
install_main_guard_linux(page_size)
|
||||
} else if cfg!(all(target_os = "linux", target_env = "musl")) {
|
||||
} else if cfg!(any(all(target_os = "linux", target_env = "musl"), target_os = "cygwin")) {
|
||||
install_main_guard_linux_musl(page_size)
|
||||
} else if cfg!(target_os = "freebsd") {
|
||||
install_main_guard_freebsd(page_size)
|
||||
|
@ -511,7 +512,8 @@ mod imp {
|
|||
target_os = "hurd",
|
||||
target_os = "linux",
|
||||
target_os = "netbsd",
|
||||
target_os = "l4re"
|
||||
target_os = "l4re",
|
||||
target_os = "cygwin"
|
||||
))]
|
||||
// FIXME: I am probably not unsafe.
|
||||
unsafe fn current_guard() -> Option<Range<usize>> {
|
||||
|
|
|
@ -94,7 +94,10 @@ fn getrandom(mut bytes: &mut [u8], insecure: bool) {
|
|||
|
||||
let flags = if insecure {
|
||||
if GRND_INSECURE_AVAILABLE.load(Relaxed) {
|
||||
libc::GRND_INSECURE
|
||||
#[cfg(target_os = "cygwin")]
|
||||
{ libc::GRND_NONBLOCK }
|
||||
#[cfg(not(target_os = "cygwin"))]
|
||||
{ libc::GRND_INSECURE }
|
||||
} else {
|
||||
libc::GRND_NONBLOCK
|
||||
}
|
||||
|
@ -110,6 +113,7 @@ fn getrandom(mut bytes: &mut [u8], insecure: bool) {
|
|||
libc::EINTR => continue,
|
||||
// `GRND_INSECURE` is not available, try
|
||||
// `GRND_NONBLOCK`.
|
||||
#[cfg(not(target_os = "cygwin"))]
|
||||
libc::EINVAL if flags == libc::GRND_INSECURE => {
|
||||
GRND_INSECURE_AVAILABLE.store(false, Relaxed);
|
||||
continue;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
cfg_if::cfg_if! {
|
||||
// Tier 1
|
||||
if #[cfg(any(target_os = "linux", target_os = "android"))] {
|
||||
if #[cfg(any(target_os = "linux", target_os = "android", target_os = "cygwin"))] {
|
||||
mod linux;
|
||||
pub use linux::{fill_bytes, hashmap_random_keys};
|
||||
} else if #[cfg(target_os = "windows")] {
|
||||
|
@ -88,6 +88,7 @@ cfg_if::cfg_if! {
|
|||
target_os = "android",
|
||||
all(target_family = "wasm", target_os = "unknown"),
|
||||
target_os = "xous",
|
||||
target_os = "cygwin",
|
||||
)))]
|
||||
pub fn hashmap_random_keys() -> (u64, u64) {
|
||||
let mut buf = [0; 16];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue