Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit6b40a7c

Browse files
committed
uucore: support cygwin
requires [libcpatch](rust-lang/libc@a3bb40e), miov1.1.0 and [nix patch](nix-rust/nix#\2708). behavior is mostly matched with Linux
1 parentee39b35 commit6b40a7c

File tree

3 files changed

+22
-10
lines changed

3 files changed

+22
-10
lines changed

‎src/uucore/src/lib/features/fs.rs‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ impl FileInformation {
123123
not(target_os ="openbsd"),
124124
not(target_os ="illumos"),
125125
not(target_os ="solaris"),
126+
not(target_os ="cygwin"),
126127
not(target_arch ="aarch64"),
127128
not(target_arch ="riscv64"),
128129
not(target_arch ="loongarch64"),
@@ -140,6 +141,7 @@ impl FileInformation {
140141
target_os ="openbsd",
141142
target_os ="illumos",
142143
target_os ="solaris",
144+
target_os ="cygwin",
143145
target_arch ="aarch64",
144146
target_arch ="riscv64",
145147
target_arch ="loongarch64",

‎src/uucore/src/lib/features/fsext.rs‎

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
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"))]
1111
constLINUX_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"))]
1313
constLINUX_MOUNTINFO:&str ="/proc/self/mountinfo";
1414
#[cfg(all(unix, not(any(target_os ="aix", target_os ="redox"))))]
1515
staticMOUNT_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
))]
99100
pubuse libc::statvfsasStatFs;
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
))]
117119
pubuse libc::statvfsas statfs_fn;
118120

@@ -189,7 +191,7 @@ pub struct MountInfo {
189191
pubdummy:bool,
190192
}
191193

192-
#[cfg(any(target_os ="linux", target_os ="android"))]
194+
#[cfg(any(target_os ="linux", target_os ="android", target_os ="cygwin"))]
193195
fnreplace_special_chars(s:&[u8]) ->Vec<u8>{
194196
use bstr::ByteSlice;
195197

@@ -205,7 +207,7 @@ fn replace_special_chars(s: &[u8]) -> Vec<u8> {
205207
}
206208

207209
implMountInfo{
208-
#[cfg(any(target_os ="linux", target_os ="android"))]
210+
#[cfg(any(target_os ="linux", target_os ="android", target_os ="cygwin"))]
209211
fnnew(file_name:&str,raw:&[&[u8]]) ->Option<Self>{
210212
use std::ffi::OsStr;
211213
use std::os::unix::ffi::OsStrExt;
@@ -459,9 +461,9 @@ use crate::error::UResult;
459461
target_os ="windows"
460462
))]
461463
usecrate::error::USimpleError;
462-
#[cfg(any(target_os ="linux", target_os ="android"))]
464+
#[cfg(any(target_os ="linux", target_os ="android", target_os ="cygwin"))]
463465
use std::fs::File;
464-
#[cfg(any(target_os ="linux", target_os ="android"))]
466+
#[cfg(any(target_os ="linux", target_os ="android", target_os ="cygwin"))]
465467
use std::io::{BufRead,BufReader};
466468
#[cfg(any(
467469
target_vendor ="apple",
@@ -481,7 +483,7 @@ use std::slice;
481483

482484
/// Read file system list.
483485
pubfnread_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
{
486488
let(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
))]
727730
returnself.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
))]
752757
returnself.f_bsize.try_into().unwrap();

‎src/uucore/src/lib/features/signals.rs‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,12 @@ Linux Programmer's Manual
3434
*/
3535

3636
/// The list of all signals.
37-
#[cfg(any(target_os ="linux", target_os ="android", target_os ="redox"))]
37+
#[cfg(any(
38+
target_os ="linux",
39+
target_os ="android",
40+
target_os ="redox",
41+
target_os ="cygwin"
42+
))]
3843
pubstaticALL_SIGNALS:[&str;32] =[
3944
"EXIT","HUP","INT","QUIT","ILL","TRAP","ABRT","BUS","FPE","KILL","USR1","SEGV",
4045
"USR2","PIPE","ALRM","TERM","STKFLT","CHLD","CONT","STOP","TSTP","TTIN","TTOU",

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp