Skip to content

Commit a67d297

Browse files
committed
solarish: restrict openpty and forkpty polyfills to illumos, replace Solaris implementation with FFI
1 parent 094464b commit a67d297

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

Diff for: src/unix/solarish/compat.rs

+2
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ unsafe fn bail(fdm: c_int, fds: c_int) -> c_int {
5353
return -1;
5454
}
5555

56+
#[cfg(target_os = "illumos")]
5657
pub unsafe fn openpty(
5758
amain: *mut c_int,
5859
asubord: *mut c_int,
@@ -123,6 +124,7 @@ pub unsafe fn openpty(
123124
0
124125
}
125126

127+
#[cfg(target_os = "illumos")]
126128
pub unsafe fn forkpty(
127129
amain: *mut c_int,
128130
name: *mut c_char,

Diff for: src/unix/solarish/solaris.rs

+16-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use crate::prelude::*;
22
use crate::{
33
exit_status, off_t, NET_MAC_AWARE, NET_MAC_AWARE_INHERIT, PRIV_AWARE_RESET, PRIV_DEBUG,
4-
PRIV_PFEXEC, PRIV_XPOLICY,
4+
PRIV_PFEXEC, PRIV_XPOLICY, termios,
55
};
66

77
pub type door_attr_t = c_uint;
@@ -233,4 +233,19 @@ extern "C" {
233233
pub fn pthread_getattr_np(thread: crate::pthread_t, attr: *mut crate::pthread_attr_t) -> c_int;
234234

235235
pub fn euidaccess(path: *const c_char, amode: c_int) -> c_int;
236+
237+
pub fn openpty(
238+
amain: *mut c_int,
239+
asubord: *mut c_int,
240+
name: *mut c_char,
241+
termp: *mut termios,
242+
winp: *mut crate::winsize,
243+
) -> c_int;
244+
245+
pub fn forkpty(
246+
amain: *mut c_int,
247+
name: *mut c_char,
248+
termp: *mut termios,
249+
winp: *mut crate::winsize,
250+
) -> crate::pid_t;
236251
}

0 commit comments

Comments
 (0)