From d444f1bcf20b29d0ec69e30046c71d005a2b9d72 Mon Sep 17 00:00:00 2001 From: Jason King Date: Wed, 17 Jun 2020 01:11:05 +0000 Subject: illumos and Solaris support Co-authored-by: Dominik Hassler Co-authored-by: Joshua M. Clulow --- src/sys/termios.rs | 52 +++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 41 insertions(+), 11 deletions(-) (limited to 'src/sys/termios.rs') diff --git a/src/sys/termios.rs b/src/sys/termios.rs index c30de80d..f6981db9 100644 --- a/src/sys/termios.rs +++ b/src/sys/termios.rs @@ -299,11 +299,17 @@ libc_enum!{ target_os = "openbsd"))] B76800, B115200, + #[cfg(any(target_os = "illumos", target_os = "solaris"))] + B153600, B230400, + #[cfg(any(target_os = "illumos", target_os = "solaris"))] + B307200, #[cfg(any(target_os = "android", target_os = "freebsd", + target_os = "illumos", target_os = "linux", - target_os = "netbsd"))] + target_os = "netbsd", + target_os = "solaris"))] B460800, #[cfg(any(target_os = "android", target_os = "linux"))] B500000, @@ -311,8 +317,10 @@ libc_enum!{ B576000, #[cfg(any(target_os = "android", target_os = "freebsd", + target_os = "illumos", target_os = "linux", - target_os = "netbsd"))] + target_os = "netbsd", + target_os = "solaris"))] B921600, #[cfg(any(target_os = "android", target_os = "linux"))] B1000000, @@ -354,6 +362,8 @@ impl TryFrom for BaudRate { target_os = "linux", target_os = "netbsd"))] use libc::{B460800, B921600}; + #[cfg(any(target_os = "illumos", target_os = "solaris"))] + use libc::{B153600, B307200, B460800, B921600}; match s { B0 => Ok(BaudRate::B0), @@ -398,11 +408,19 @@ impl TryFrom for BaudRate { target_os = "openbsd"))] B76800 => Ok(BaudRate::B76800), B115200 => Ok(BaudRate::B115200), + #[cfg(any(target_os = "illumos", + target_os = "solaris"))] + B153600 => Ok(BaudRate::B153600), B230400 => Ok(BaudRate::B230400), + #[cfg(any(target_os = "illumos", + target_os = "solaris"))] + B307200 => Ok(BaudRate::B307200), #[cfg(any(target_os = "android", target_os = "freebsd", + target_os = "illumos", target_os = "linux", - target_os = "netbsd"))] + target_os = "netbsd", + target_os = "solaris"))] B460800 => Ok(BaudRate::B460800), #[cfg(any(target_os = "android", target_os = "linux"))] B500000 => Ok(BaudRate::B500000), @@ -410,8 +428,10 @@ impl TryFrom for BaudRate { B576000 => Ok(BaudRate::B576000), #[cfg(any(target_os = "android", target_os = "freebsd", + target_os = "illumos", target_os = "linux", - target_os = "netbsd"))] + target_os = "netbsd", + target_os = "solaris"))] B921600 => Ok(BaudRate::B921600), #[cfg(any(target_os = "android", target_os = "linux"))] B1000000 => Ok(BaudRate::B1000000), @@ -502,37 +522,46 @@ libc_enum! { VDISCARD, #[cfg(any(target_os = "dragonfly", target_os = "freebsd", + target_os = "illumos", target_os = "macos", target_os = "netbsd", - target_os = "openbsd"))] + target_os = "openbsd", + target_os = "solaris"))] VDSUSP, VEOF, VEOL, VEOL2, VERASE, - #[cfg(any(target_os = "dragonfly", target_os = "freebsd"))] + #[cfg(any(target_os = "dragonfly", + target_os = "freebsd", + target_os = "illumos", + target_os = "solaris"))] VERASE2, VINTR, VKILL, VLNEXT, - #[cfg(not(all(target_os = "linux", target_arch = "sparc64")))] + #[cfg(not(any(all(target_os = "linux", target_arch = "sparc64"), + target_os = "illumos", target_os = "solaris")))] VMIN, VQUIT, VREPRINT, VSTART, #[cfg(any(target_os = "dragonfly", target_os = "freebsd", + target_os = "illumos", target_os = "macos", target_os = "netbsd", - target_os = "openbsd"))] + target_os = "openbsd", + target_os = "solaris"))] VSTATUS, VSTOP, VSUSP, #[cfg(target_os = "linux")] VSWTC, - #[cfg(target_os = "haiku")] + #[cfg(any(target_os = "haiku", target_os = "illumos", target_os = "solaris"))] VSWTCH, - #[cfg(not(all(target_os = "linux", target_arch = "sparc64")))] + #[cfg(not(any(all(target_os = "linux", target_arch = "sparc64"), + target_os = "illumos", target_os = "solaris")))] VTIME, VWERASE, #[cfg(target_os = "dragonfly")] @@ -540,7 +569,8 @@ libc_enum! { } } -#[cfg(all(target_os = "linux", target_arch = "sparc64"))] +#[cfg(any(all(target_os = "linux", target_arch = "sparc64"), + target_os = "illumos", target_os = "solaris"))] impl SpecialCharacterIndices { pub const VMIN: SpecialCharacterIndices = SpecialCharacterIndices::VEOF; pub const VTIME: SpecialCharacterIndices = SpecialCharacterIndices::VEOL; -- cgit v1.2.3