Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions vm/src/stdlib/errno.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ const ERROR_CODES: &[(&str, i32)] = &[
e!(ENODEV),
e!(EHOSTUNREACH),
e!(cfg(not(windows)), ENOMSG),
e!(cfg(not(windows)), ENODATA),
e!(cfg(not(any(target_os = "openbsd", windows))), ENODATA),
e!(cfg(not(windows)), ENOTBLK),
e!(ENOSYS),
e!(EPIPE),
Expand All @@ -115,7 +115,7 @@ const ERROR_CODES: &[(&str, i32)] = &[
e!(EISCONN),
e!(ESHUTDOWN),
e!(EBADF),
e!(cfg(not(windows)), EMULTIHOP),
e!(cfg(not(any(target_os = "openbsd", windows))), EMULTIHOP),
e!(EIO),
e!(EPROTOTYPE),
e!(ENOSPC),
Expand All @@ -136,13 +136,13 @@ const ERROR_CODES: &[(&str, i32)] = &[
e!(cfg(not(windows)), EBADMSG),
e!(ENFILE),
e!(ESPIPE),
e!(cfg(not(windows)), ENOLINK),
e!(cfg(not(any(target_os = "openbsd", windows))), ENOLINK),
e!(ENETRESET),
e!(ETIMEDOUT),
e!(ENOENT),
e!(EEXIST),
e!(EDQUOT),
e!(cfg(not(windows)), ENOSTR),
e!(cfg(not(any(target_os = "openbsd", windows))), ENOSTR),
e!(EFAULT),
e!(EFBIG),
e!(ENOTCONN),
Expand All @@ -151,7 +151,7 @@ const ERROR_CODES: &[(&str, i32)] = &[
e!(ECONNABORTED),
e!(ENETUNREACH),
e!(ESTALE),
e!(cfg(not(windows)), ENOSR),
e!(cfg(not(any(target_os = "openbsd", windows))), ENOSR),
e!(ENOMEM),
e!(ENOTSOCK),
e!(EMLINK),
Expand All @@ -162,7 +162,7 @@ const ERROR_CODES: &[(&str, i32)] = &[
e!(ENAMETOOLONG),
e!(ENOTTY),
e!(ESOCKTNOSUPPORT),
e!(cfg(not(windows)), ETIME),
e!(cfg(not(any(target_os = "openbsd", windows))), ETIME),
e!(ETOOMANYREFS),
e!(EMFILE),
e!(cfg(not(windows)), ETXTBSY),
Expand Down
11 changes: 7 additions & 4 deletions vm/src/stdlib/os.rs
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ fn getgroups() -> nix::Result<Vec<Gid>> {
})
}

#[cfg(any(target_os = "linux", target_os = "android"))]
#[cfg(any(target_os = "linux", target_os = "android", target_os = "openbsd"))]
use nix::unistd::getgroups;

#[cfg(target_os = "redox")]
Expand Down Expand Up @@ -813,6 +813,8 @@ fn os_stat(
use std::os::linux::fs::MetadataExt;
#[cfg(target_os = "macos")]
use std::os::macos::fs::MetadataExt;
#[cfg(target_os = "openbsd")]
use std::os::openbsd::fs::MetadataExt;
#[cfg(target_os = "redox")]
use std::os::redox::fs::MetadataExt;

Expand Down Expand Up @@ -919,7 +921,8 @@ fn os_stat(
target_os = "macos",
target_os = "android",
target_os = "redox",
windows
windows,
unix
)))]
fn os_stat(
file: Either<PyPathLike, i64>,
Expand Down Expand Up @@ -1308,13 +1311,13 @@ fn os_urandom(size: usize, vm: &VirtualMachine) -> PyResult<Vec<u8>> {
}
}

#[cfg(target_os = "linux")]
#[cfg(any(target_os = "linux", target_os = "openbsd"))]
type ModeT = u32;

#[cfg(target_os = "macos")]
type ModeT = u16;

#[cfg(any(target_os = "macos", target_os = "linux"))]
#[cfg(any(target_os = "macos", target_os = "linux", target_os = "openbsd"))]
fn os_umask(mask: ModeT, _vm: &VirtualMachine) -> PyResult<ModeT> {
let ret_mask = unsafe { libc::umask(mask) };
Ok(ret_mask)
Expand Down
2 changes: 1 addition & 1 deletion vm/src/stdlib/signal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ fn extend_module_platform_specific(vm: &VirtualMachine, module: &PyObjectRef) {
"SIGSYS" => ctx.new_int(libc::SIGSYS as u8),
});

#[cfg(not(target_os = "macos"))]
#[cfg(not(any(target_os = "macos", target_os = "openbsd")))]
{
extend_module!(vm, module, {
"SIGPWR" => ctx.new_int(libc::SIGPWR as u8),
Expand Down