Skip to content

Commit 8e5fa76

Browse files
yuvraj-waletgross35
authored andcommitted
solarish: restrict openpty and forkpty polyfills to illumos, replace Solaris implementation with FFI
(backport <#4329>) (cherry picked from commit e9d29ec)
1 parent cb50c4a commit 8e5fa76

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

src/unix/solarish/compat.rs

Lines changed: 2 additions & 0 deletions
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,

src/unix/solarish/solaris.rs

Lines changed: 16 additions & 1 deletion
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;
@@ -242,4 +242,19 @@ extern "C" {
242242
pub fn pthread_getattr_np(thread: crate::pthread_t, attr: *mut crate::pthread_attr_t) -> c_int;
243243

244244
pub fn euidaccess(path: *const c_char, amode: c_int) -> c_int;
245+
246+
pub fn openpty(
247+
amain: *mut c_int,
248+
asubord: *mut c_int,
249+
name: *mut c_char,
250+
termp: *mut termios,
251+
winp: *mut crate::winsize,
252+
) -> c_int;
253+
254+
pub fn forkpty(
255+
amain: *mut c_int,
256+
name: *mut c_char,
257+
termp: *mut termios,
258+
winp: *mut crate::winsize,
259+
) -> crate::pid_t;
245260
}

0 commit comments

Comments
 (0)