Skip to content

solarish: Restrict openpty and forkpty polyfills to illumos, replace Solaris implementation with FFI #4329

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

Merged
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
2 changes: 2 additions & 0 deletions src/unix/solarish/compat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ unsafe fn bail(fdm: c_int, fds: c_int) -> c_int {
return -1;
}

#[cfg(target_os = "illumos")]
pub unsafe fn openpty(
amain: *mut c_int,
asubord: *mut c_int,
Expand Down Expand Up @@ -123,6 +124,7 @@ pub unsafe fn openpty(
0
}

#[cfg(target_os = "illumos")]
pub unsafe fn forkpty(
amain: *mut c_int,
name: *mut c_char,
Expand Down
17 changes: 16 additions & 1 deletion src/unix/solarish/solaris.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::prelude::*;
use crate::{
exit_status, off_t, NET_MAC_AWARE, NET_MAC_AWARE_INHERIT, PRIV_AWARE_RESET, PRIV_DEBUG,
PRIV_PFEXEC, PRIV_XPOLICY,
PRIV_PFEXEC, PRIV_XPOLICY, termios,
};

pub type door_attr_t = c_uint;
Expand Down Expand Up @@ -241,4 +241,19 @@ extern "C" {
pub fn pthread_getattr_np(thread: crate::pthread_t, attr: *mut crate::pthread_attr_t) -> c_int;

pub fn euidaccess(path: *const c_char, amode: c_int) -> c_int;

pub fn openpty(
amain: *mut c_int,
asubord: *mut c_int,
name: *mut c_char,
termp: *mut termios,
winp: *mut crate::winsize,
) -> c_int;

pub fn forkpty(
amain: *mut c_int,
name: *mut c_char,
termp: *mut termios,
winp: *mut crate::winsize,
) -> crate::pid_t;
}