Skip to content

Commit 2235559

Browse files
authored
Merge pull request #4329 from yuvraj-wale/remove-solarish-compat-openpty-forkpty
solarish: Restrict openpty and forkpty polyfills to illumos, replace Solaris implementation with FFI
2 parents 6edce63 + e9d29ec commit 2235559

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;
@@ -241,4 +241,19 @@ extern "C" {
241241
pub fn pthread_getattr_np(thread: crate::pthread_t, attr: *mut crate::pthread_attr_t) -> c_int;
242242

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

0 commit comments

Comments
 (0)