Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add std support to cygwin target #137621

Merged
merged 13 commits into from
Mar 17, 2025
Prev Previous commit
Next Next commit
Fix code style
Rate limit · GitHub

Whoa there!

You have exceeded a secondary rate limit.

Please wait a few minutes before you try again;
in some cases this may take up to an hour.

Berrysoft committed Mar 10, 2025
commit d24c6a29f5dca8c52ecf1ff88e4786e537078fb6
7 changes: 6 additions & 1 deletion library/std/src/sys/fs/unix.rs
Original file line number Diff line number Diff line change
@@ -543,7 +543,12 @@ impl FileAttr {
SystemTime::new(self.stat.st_atim.tv_sec as i64, self.stat.st_atim.tv_nsec as i64)
}

#[cfg(any(target_os = "freebsd", target_os = "openbsd", target_vendor = "apple", target_os = "cygwin"))]
#[cfg(any(
target_os = "freebsd",
target_os = "openbsd",
target_vendor = "apple",
target_os = "cygwin",
))]
pub fn created(&self) -> io::Result<SystemTime> {
SystemTime::new(self.stat.st_birthtime as i64, self.stat.st_birthtime_nsec as i64)
}
3 changes: 2 additions & 1 deletion library/std/src/sys/pal/unix/stack_overflow.rs
Original file line number Diff line number Diff line change
@@ -372,7 +372,8 @@ 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!(any(all(target_os = "linux", target_env = "musl"), target_os = "cygwin")) {
} 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)
8 changes: 6 additions & 2 deletions library/std/src/sys/random/linux.rs
Original file line number Diff line number Diff line change
@@ -95,9 +95,13 @@ fn getrandom(mut bytes: &mut [u8], insecure: bool) {
let flags = if insecure {
if GRND_INSECURE_AVAILABLE.load(Relaxed) {
#[cfg(target_os = "cygwin")]
{ libc::GRND_NONBLOCK }
{
libc::GRND_NONBLOCK
}
#[cfg(not(target_os = "cygwin"))]
{ libc::GRND_INSECURE }
{
libc::GRND_INSECURE
}
} else {
libc::GRND_NONBLOCK
}