Skip to content

Commit 7a9f031

Browse files
committed
Auto merge of #1065 - eeyun:eeyun/solaris_termios, r=alexcrichton
Add TIOCGWINSZ accessor to solaris module Signed-off-by: Ian Henry <[email protected]> I recently noticed downstream that these request values were unavailable and needed for things like [the pb crate](https://github.com/a8m/pb). To get access to the request value I ran the following simple C code: ``` #include <sys/ioctl.h> #include <stdio.h> #include <sys/termios.h> int main(int argc, char **argv) { printf("Code: 0x%04lx\n", TIOCGWINSZ); printf("Code: 0x%04lx\n", TIOCSWINSZ); return 0; } ``` To then validate the change I ran the following simple rust: ``` extern crate libc; use libc::{ioctl, winsize, STDOUT_FILENO, TIOCGWINSZ}; fn main() { let mut wsize = winsize { ws_row: 0, ws_col: 0, ws_xpixel: 0, ws_ypixel: 0, }; unsafe { ioctl(STDOUT_FILENO, TIOCGWINSZ, &mut wsize); } println!("Sizes: {{ rows: {}, cols: {}, xpixel: {}, ypixel: {} }}", wsize.ws_row, wsize.ws_col, wsize.ws_xpixel, wsize.ws_ypixel); } ```
2 parents b9c613f + a3c843b commit 7a9f031

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/unix/solaris/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1195,6 +1195,9 @@ pub const PORT_SOURCE_FILE: ::c_int = 7;
11951195
pub const PORT_SOURCE_POSTWAIT: ::c_int = 8;
11961196
pub const PORT_SOURCE_SIGNAL: ::c_int = 9;
11971197

1198+
pub const TIOCGWINSZ: ::c_int = 0x5468;
1199+
pub const TIOCSWINSZ: ::c_int = 0x5467;
1200+
11981201
pub const EPOLLIN: ::c_int = 0x1;
11991202
pub const EPOLLPRI: ::c_int = 0x2;
12001203
pub const EPOLLOUT: ::c_int = 0x4;

0 commit comments

Comments
 (0)