[haiku-commits] Change in haiku[master]: tty: implement TCFLSH to flush buffers

  • From: Gerrit <review@xxxxxxxxxxxxxxxxxxx>
  • To: waddlesplash <waddlesplash@xxxxxxxxx>, haiku-commits@xxxxxxxxxxxxx
  • Date: Sun, 26 Apr 2020 09:58:14 +0000

From Adrien Destugues <pulkomandy@xxxxxxxxx>:

Adrien Destugues has uploaded this change for review. ( 
https://review.haiku-os.org/c/haiku/+/2516 ;)


Change subject: tty: implement TCFLSH to flush buffers
......................................................................

tty: implement TCFLSH to flush buffers

This is probably incomplete. Is locking needed? Should we notify the
next writer (if any) that the port is writable when flushing the output?
Should this be forwarded to the driver to also flush hardware buffers?
---
M src/add-ons/kernel/generic/tty/tty.cpp
1 file changed, 16 insertions(+), 0 deletions(-)



  git pull ssh://git.haiku-os.org:22/haiku refs/changes/16/2516/1

diff --git a/src/add-ons/kernel/generic/tty/tty.cpp 
b/src/add-ons/kernel/generic/tty/tty.cpp
index 8d09fa9..8f03021 100644
--- a/src/add-ons/kernel/generic/tty/tty.cpp
+++ b/src/add-ons/kernel/generic/tty/tty.cpp
@@ -1810,6 +1810,22 @@

                        return B_ERROR;
                }
+
+               case TCFLSH:
+               {
+                       if (op & TCOFLUSH) {
+                               struct tty* otherTTY = cookie->other_tty;
+                               if (otherTTY->open_count <= 0)
+                                       return B_ERROR;
+
+                               clear_line_buffer(otherTTY->input_buffer);
+                       }
+
+                       if (op & TCIFLUSH)
+                               clear_line_buffer(tty->input_buffer);
+
+                       return B_OK;
+               }
        }

        TRACE(("tty: unsupported opcode %lu\n", op));

--
To view, visit https://review.haiku-os.org/c/haiku/+/2516
To unsubscribe, or for help writing mail filters, visit 
https://review.haiku-os.org/settings

Gerrit-Project: haiku
Gerrit-Branch: master
Gerrit-Change-Id: I2566e2d036a61af4819894a44f57603179aa27df
Gerrit-Change-Number: 2516
Gerrit-PatchSet: 1
Gerrit-Owner: Adrien Destugues <pulkomandy@xxxxxxxxx>
Gerrit-MessageType: newchange

Other related posts:

  • » [haiku-commits] Change in haiku[master]: tty: implement TCFLSH to flush buffers - Gerrit