Skip to content

Commit

Permalink
also FIONREAD
Browse files Browse the repository at this point in the history
  • Loading branch information
jackyzha0 committed Oct 26, 2024
1 parent a1a9998 commit 1365d3a
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -261,9 +261,22 @@ impl Pty {
eprintln!("ioctl TIOCOUTQ failed: {}", controller_tiocoutq_res);
}

let mut user_inq = 0;
let user_tiocinq_res = unsafe { libc::ioctl(raw_user_fd, libc::FIONREAD, &mut user_inq) };
if user_tiocinq_res == -1 {
eprintln!("ioctl TIOCINQ failed: {}", user_tiocinq_res);
}

let mut controller_inq = 0;
let controller_tiocinq_res =
unsafe { libc::ioctl(raw_controller_fd, libc::FIONREAD, &mut controller_inq) };
if controller_tiocinq_res == -1 {
eprintln!("ioctl TIOCINQ failed: {}", controller_tiocinq_res);
}

println!(
"child process exited, user_outq: {}, controller_outq: {}",
user_outq, controller_outq
"user_outq: {}, controller_outq: {}, user_inq: {}, controller_inq: {}",
user_outq, controller_outq, user_inq, controller_inq
);

drop(user_fd);
Expand Down

0 comments on commit 1365d3a

Please sign in to comment.