From f56514d61b064d403c61aca016edc3b9506ce229 Mon Sep 17 00:00:00 2001 From: David Carlier Date: Sun, 31 Oct 2021 08:41:14 +0000 Subject: [PATCH] netbsd build fix proposal --- stdlib/src/socket.rs | 2 +- vm/src/stdlib/errno.rs | 7 +++++-- vm/src/stdlib/os.rs | 7 +++++++ vm/src/stdlib/signal.rs | 7 ++++++- 4 files changed, 19 insertions(+), 4 deletions(-) diff --git a/stdlib/src/socket.rs b/stdlib/src/socket.rs index 59222d223..bdc4b8f5d 100644 --- a/stdlib/src/socket.rs +++ b/stdlib/src/socket.rs @@ -61,7 +61,7 @@ mod _socket { #[pyattr] use c::{AF_UNIX, SO_REUSEPORT}; - #[cfg(not(target_os = "freebsd"))] + #[cfg(not(any(target_os = "freebsd", target_os = "netbsd", target_os = "openbsd")))] #[pyattr] use c::{AI_ADDRCONFIG, AI_ALL, AI_NUMERICHOST, AI_NUMERICSERV, AI_PASSIVE}; diff --git a/vm/src/stdlib/errno.rs b/vm/src/stdlib/errno.rs index 6dac3e8e4..73a20ef37 100644 --- a/vm/src/stdlib/errno.rs +++ b/vm/src/stdlib/errno.rs @@ -176,8 +176,11 @@ const ERROR_CODES: &[(&str, i32)] = &[ e!(ENXIO), e!(ECANCELED), e!(EWOULDBLOCK), - e!(cfg(not(windows)), EOWNERDEAD), - e!(cfg(not(windows)), ENOTRECOVERABLE), + e!(cfg(not(any(windows, target_os = "netbsd"))), EOWNERDEAD), + e!( + cfg(not(any(windows, target_os = "netbsd"))), + ENOTRECOVERABLE + ), e!(cfg(windows), WSAEHOSTDOWN), e!(cfg(windows), WSAENETDOWN), e!(cfg(windows), WSAENOTSOCK), diff --git a/vm/src/stdlib/os.rs b/vm/src/stdlib/os.rs index fef36ed50..63bddbcf0 100644 --- a/vm/src/stdlib/os.rs +++ b/vm/src/stdlib/os.rs @@ -1004,11 +1004,18 @@ pub(super) mod _os { fn from_stat(stat: &StatStruct, vm: &VirtualMachine) -> Self { let (atime, mtime, ctime); #[cfg(any(unix, windows))] + #[cfg(not(target_os = "netbsd"))] { atime = (stat.st_atime, stat.st_atime_nsec); mtime = (stat.st_mtime, stat.st_mtime_nsec); ctime = (stat.st_ctime, stat.st_ctime_nsec); } + #[cfg(target_os = "netbsd")] + { + atime = (stat.st_atime, stat.st_atimensec); + mtime = (stat.st_mtime, stat.st_mtimensec); + ctime = (stat.st_ctime, stat.st_ctimensec); + } #[cfg(target_os = "wasi")] { atime = (stat.st_atim.tv_sec, stat.st_atim.tv_nsec); diff --git a/vm/src/stdlib/signal.rs b/vm/src/stdlib/signal.rs index 4093c538f..a47906b3d 100644 --- a/vm/src/stdlib/signal.rs +++ b/vm/src/stdlib/signal.rs @@ -97,7 +97,12 @@ pub(crate) mod _signal { }; #[cfg(unix)] - #[cfg(not(any(target_os = "macos", target_os = "openbsd", target_os = "freebsd")))] + #[cfg(not(any( + target_os = "macos", + target_os = "openbsd", + target_os = "freebsd", + target_os = "netbsd" + )))] #[pyattr] pub use libc::{SIGPWR, SIGSTKFLT};