File tree 5 files changed +14
-5
lines changed
5 files changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -45,6 +45,7 @@ pub use self::stream::*;
45
45
target_os = "openbsd" ,
46
46
target_os = "nto" ,
47
47
target_vendor = "apple" ,
48
+ target_os = "cygwin" ,
48
49
) ) ]
49
50
#[ unstable( feature = "peer_credentials_unix_socket" , issue = "42839" , reason = "unstable" ) ]
50
51
pub use self :: ucred:: * ;
Original file line number Diff line number Diff line change @@ -75,6 +75,7 @@ const fn max_iov() -> usize {
75
75
target_os = "horizon" ,
76
76
target_os = "vita" ,
77
77
target_vendor = "apple" ,
78
+ target_os = "cygwin" ,
78
79
) ) ) ]
79
80
const fn max_iov ( ) -> usize {
80
81
16 // The minimum value required by POSIX.
Original file line number Diff line number Diff line change @@ -316,7 +316,8 @@ mod imp {
316
316
target_os = "netbsd" ,
317
317
target_os = "hurd" ,
318
318
target_os = "linux" ,
319
- target_os = "l4re"
319
+ target_os = "l4re" ,
320
+ target_os = "cygwin"
320
321
) ) ]
321
322
unsafe fn get_stack_start ( ) -> Option < * mut libc:: c_void > {
322
323
let mut ret = None ;
@@ -371,7 +372,7 @@ mod imp {
371
372
// this way someone on any unix-y OS can check that all these compile
372
373
if cfg ! ( all( target_os = "linux" , not( target_env = "musl" ) ) ) {
373
374
install_main_guard_linux ( page_size)
374
- } else if cfg ! ( all( target_os = "linux" , target_env = "musl" ) ) {
375
+ } else if cfg ! ( any ( all( target_os = "linux" , target_env = "musl" ) , target_os = "cygwin ") ) {
375
376
install_main_guard_linux_musl ( page_size)
376
377
} else if cfg ! ( target_os = "freebsd" ) {
377
378
install_main_guard_freebsd ( page_size)
@@ -511,7 +512,8 @@ mod imp {
511
512
target_os = "hurd" ,
512
513
target_os = "linux" ,
513
514
target_os = "netbsd" ,
514
- target_os = "l4re"
515
+ target_os = "l4re" ,
516
+ target_os = "cygwin"
515
517
) ) ]
516
518
// FIXME: I am probably not unsafe.
517
519
unsafe fn current_guard ( ) -> Option < Range < usize > > {
Original file line number Diff line number Diff line change @@ -94,7 +94,10 @@ fn getrandom(mut bytes: &mut [u8], insecure: bool) {
94
94
95
95
let flags = if insecure {
96
96
if GRND_INSECURE_AVAILABLE . load ( Relaxed ) {
97
- libc:: GRND_INSECURE
97
+ #[ cfg( target_os = "cygwin" ) ]
98
+ { libc:: GRND_NONBLOCK }
99
+ #[ cfg( not( target_os = "cygwin" ) ) ]
100
+ { libc:: GRND_INSECURE }
98
101
} else {
99
102
libc:: GRND_NONBLOCK
100
103
}
@@ -110,6 +113,7 @@ fn getrandom(mut bytes: &mut [u8], insecure: bool) {
110
113
libc:: EINTR => continue ,
111
114
// `GRND_INSECURE` is not available, try
112
115
// `GRND_NONBLOCK`.
116
+ #[ cfg( not( target_os = "cygwin" ) ) ]
113
117
libc:: EINVAL if flags == libc:: GRND_INSECURE => {
114
118
GRND_INSECURE_AVAILABLE . store ( false , Relaxed ) ;
115
119
continue ;
Original file line number Diff line number Diff line change 1
1
cfg_if:: cfg_if! {
2
2
// Tier 1
3
- if #[ cfg( any( target_os = "linux" , target_os = "android" ) ) ] {
3
+ if #[ cfg( any( target_os = "linux" , target_os = "android" , target_os = "cygwin" ) ) ] {
4
4
mod linux;
5
5
pub use linux:: { fill_bytes, hashmap_random_keys} ;
6
6
} else if #[ cfg( target_os = "windows" ) ] {
@@ -88,6 +88,7 @@ cfg_if::cfg_if! {
88
88
target_os = "android" ,
89
89
all( target_family = "wasm" , target_os = "unknown" ) ,
90
90
target_os = "xous" ,
91
+ target_os = "cygwin" ,
91
92
) ) ) ]
92
93
pub fn hashmap_random_keys ( ) -> ( u64 , u64 ) {
93
94
let mut buf = [ 0 ; 16 ] ;
You can’t perform that action at this time.
0 commit comments