File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -631,6 +631,17 @@ impl FileOps for TtyFileOps {
631631 let new_termios = ptr. read ( ) . ok_or ( Errno :: EFAULT ) ?;
632632 self . tty . ldisc . lock ( ) . termios = new_termios;
633633 }
634+ uapi:: ioctls:: TCFLSH => {
635+ let queue = arg. value ( ) ;
636+ if queue != TCIFLUSH && queue != TCOFLUSH && queue != TCIOFLUSH {
637+ return Err ( Errno :: EINVAL ) ;
638+ }
639+ if queue == TCIFLUSH || queue == TCIOFLUSH {
640+ let mut ldisc = self . tty . ldisc . lock ( ) ;
641+ ldisc. read_buf . clear ( ) ;
642+ ldisc. canon_buf . clear ( ) ;
643+ }
644+ }
634645 uapi:: ioctls:: TIOCGWINSZ => {
635646 let mut ptr = UserPtr :: new ( arg) ;
636647 let ws = * self . tty . winsize . lock ( ) ;
Original file line number Diff line number Diff line change @@ -97,6 +97,10 @@ pub const NOFLSH: u32 = 0o000200;
9797pub const TOSTOP : u32 = 0o000400 ;
9898pub const IEXTEN : u32 = 0o100000 ;
9999
100+ pub const TCIFLUSH : usize = 0 ;
101+ pub const TCOFLUSH : usize = 1 ;
102+ pub const TCIOFLUSH : usize = 2 ;
103+
100104pub const EXTA : u32 = 0o000016 ;
101105pub const EXTB : u32 = 0o000017 ;
102106pub const CBAUD : u32 = 0o010017 ;
You can’t perform that action at this time.
0 commit comments