aboutsummaryrefslogtreecommitdiff
path: root/libc/src/unix/solarish/compat.rs
blob: a33645211ce37381d5891e024f8605aab359a33e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// Common functions that are unfortunately missing on illumos and
// Solaris, but often needed by other crates.

use unix::solarish::*;

pub unsafe fn cfmakeraw(termios: *mut ::termios) {
    let mut t = *termios as ::termios;
    t.c_iflag &= !(IMAXBEL
        | IGNBRK
        | BRKINT
        | PARMRK
        | ISTRIP
        | INLCR
        | IGNCR
        | ICRNL
        | IXON);
    t.c_oflag &= !OPOST;
    t.c_lflag &= !(ECHO | ECHONL | ICANON | ISIG | IEXTEN);
    t.c_cflag &= !(CSIZE | PARENB);
    t.c_cflag |= CS8;
}

pub unsafe fn cfsetspeed(
    termios: *mut ::termios,
    speed: ::speed_t,
) -> ::c_int {
    // Neither of these functions on illumos or Solaris actually ever
    // return an error
    ::cfsetispeed(termios, speed);
    ::cfsetospeed(termios, speed);
    0
}