diff options
Diffstat (limited to 'test/test_pty.rs')
-rw-r--r-- | test/test_pty.rs | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/test/test_pty.rs b/test/test_pty.rs index 3b654443..52b63342 100644 --- a/test/test_pty.rs +++ b/test/test_pty.rs @@ -112,6 +112,28 @@ fn open_ptty_pair() -> (PtyMaster, File) { // Open the slave device let slave_fd = open(Path::new(&slave_name), OFlag::O_RDWR, stat::Mode::empty()).unwrap(); + + #[cfg(target_os = "illumos")] + { + use libc::{ioctl, I_FIND, I_PUSH}; + + // On illumos systems, as per pts(7D), one must push STREAMS modules + // after opening a device path returned from ptsname(). + let ptem = b"ptem\0"; + let ldterm = b"ldterm\0"; + let r = unsafe { ioctl(slave_fd, I_FIND, ldterm.as_ptr()) }; + if r < 0 { + panic!("I_FIND failure"); + } else if r == 0 { + if unsafe { ioctl(slave_fd, I_PUSH, ptem.as_ptr()) } < 0 { + panic!("I_PUSH ptem failure"); + } + if unsafe { ioctl(slave_fd, I_PUSH, ldterm.as_ptr()) } < 0 { + panic!("I_PUSH ldterm failure"); + } + } + } + let slave = unsafe { File::from_raw_fd(slave_fd) }; (master, slave) |