77
88// spell-checker:ignore DATETIME getmntinfo subsecond (fs) cifs smbfs
99
10- #[ cfg( any( target_os ="linux" , target_os ="android" ) ) ]
10+ #[ cfg( any( target_os ="linux" , target_os ="android" , target_os = "cygwin" ) ) ]
1111const LINUX_MTAB : & str ="/etc/mtab" ;
12- #[ cfg( any( target_os ="linux" , target_os ="android" ) ) ]
12+ #[ cfg( any( target_os ="linux" , target_os ="android" , target_os = "cygwin" ) ) ]
1313const LINUX_MOUNTINFO : & str ="/proc/self/mountinfo" ;
1414#[ cfg( all( unix, not( any( target_os ="aix" , target_os ="redox" ) ) ) ) ]
1515static MOUNT_OPT_BIND : & str ="bind" ;
@@ -94,7 +94,8 @@ pub use libc::statfs as StatFs;
9494 target_os ="dragonfly" ,
9595 target_os ="illumos" ,
9696 target_os ="solaris" ,
97- target_os ="redox"
97+ target_os ="redox" ,
98+ target_os ="cygwin" ,
9899) ) ]
99100pub use libc:: statvfsas StatFs ;
100101
@@ -112,7 +113,8 @@ pub use libc::statfs as statfs_fn;
112113 target_os ="illumos" ,
113114 target_os ="solaris" ,
114115 target_os ="dragonfly" ,
115- target_os ="redox"
116+ target_os ="redox" ,
117+ target_os ="cygwin" ,
116118) ) ]
117119pub use libc:: statvfsas statfs_fn;
118120
@@ -189,7 +191,7 @@ pub struct MountInfo {
189191pub dummy : bool ,
190192}
191193
192- #[ cfg( any( target_os ="linux" , target_os ="android" ) ) ]
194+ #[ cfg( any( target_os ="linux" , target_os ="android" , target_os = "cygwin" ) ) ]
193195fn replace_special_chars ( s : & [ u8 ] ) ->Vec < u8 > {
194196use bstr:: ByteSlice ;
195197
@@ -205,7 +207,7 @@ fn replace_special_chars(s: &[u8]) -> Vec<u8> {
205207}
206208
207209impl MountInfo {
208- #[ cfg( any( target_os ="linux" , target_os ="android" ) ) ]
210+ #[ cfg( any( target_os ="linux" , target_os ="android" , target_os = "cygwin" ) ) ]
209211fn new ( file_name : & str , raw : & [ & [ u8 ] ] ) ->Option < Self > {
210212use std:: ffi:: OsStr ;
211213use std:: os:: unix:: ffi:: OsStrExt ;
@@ -459,9 +461,9 @@ use crate::error::UResult;
459461 target_os ="windows"
460462) ) ]
461463use crate :: error:: USimpleError ;
462- #[ cfg( any( target_os ="linux" , target_os ="android" ) ) ]
464+ #[ cfg( any( target_os ="linux" , target_os ="android" , target_os = "cygwin" ) ) ]
463465use std:: fs:: File ;
464- #[ cfg( any( target_os ="linux" , target_os ="android" ) ) ]
466+ #[ cfg( any( target_os ="linux" , target_os ="android" , target_os = "cygwin" ) ) ]
465467use std:: io:: { BufRead , BufReader } ;
466468#[ cfg( any(
467469 target_vendor ="apple" ,
@@ -481,7 +483,7 @@ use std::slice;
481483
482484/// Read file system list.
483485pub fn read_fs_list ( ) ->UResult < Vec < MountInfo > > {
484- #[ cfg( any( target_os ="linux" , target_os ="android" ) ) ]
486+ #[ cfg( any( target_os ="linux" , target_os ="android" , target_os = "cygwin" ) ) ]
485487{
486488let ( file_name, f) =File :: open ( LINUX_MOUNTINFO )
487489. map ( |f|( LINUX_MOUNTINFO , f) )
@@ -722,6 +724,7 @@ impl FsMeta for StatFs {
722724 not( target_os ="solaris" ) ,
723725 not( target_os ="redox" ) ,
724726 not( target_arch ="s390x" ) ,
727+ not( target_os ="cygwin" ) ,
725728 target_pointer_width ="64"
726729) ) ]
727730return self . f_bsize ;
@@ -730,6 +733,7 @@ impl FsMeta for StatFs {
730733 not( target_os ="freebsd" ) ,
731734 not( target_os ="netbsd" ) ,
732735 not( target_os ="redox" ) ,
736+ not( target_os ="cygwin" ) ,
733737 any(
734738 target_arch ="s390x" ,
735739 target_vendor ="apple" ,
@@ -747,6 +751,7 @@ impl FsMeta for StatFs {
747751 target_os ="illumos" ,
748752 target_os ="solaris" ,
749753 target_os ="redox" ,
754+ target_os ="cygwin" ,
750755 all( target_os ="android" , target_pointer_width ="64" ) ,
751756) ) ]
752757return self . f_bsize . try_into ( ) . unwrap ( ) ;