diff options
author | Fred Fish <fnf@specifix.com> | 1998-03-06 20:38:45 +0000 |
---|---|---|
committer | Fred Fish <fnf@specifix.com> | 1998-03-06 20:38:45 +0000 |
commit | 3ffbdf15324b373b8a941dc58e421d1420b80ffc (patch) | |
tree | f0d22634fc0a49fcefa896ac1cc2a44742917dbe /gdb/ser-unix.c | |
parent | d030671bfc3affe14cd56137f4f343290942fbb7 (diff) | |
download | gdb-3ffbdf15324b373b8a941dc58e421d1420b80ffc.zip gdb-3ffbdf15324b373b8a941dc58e421d1420b80ffc.tar.gz gdb-3ffbdf15324b373b8a941dc58e421d1420b80ffc.tar.bz2 |
PR 15068
* utils.c (quit): Call SERIAL_DRAIN_OUTPUT rather than
SERIAL_FLUSH_OUTPUT.
* serial.h (struct serial_ops): Add drain_output, pointer to
function that waits for output to drain.
(SERIAL_DRAIN_OUTPUT): Macro to wait for output to drain.
* ser-unix.c (hardwire_drain_output): New function and prototype.
* ser-unix.c (hardwire_ops): Add entry for drain_output function.
* ser-tcp.c (tcp_ops): Ditto.
* ser-ocd.c (ocd_ops): Ditto.
* ser-mac.c (mac_ops): Ditto.
* ser-go32.c (dos_ops): Ditto.
* ser-e7kpc.c (e7000pc_ops): Ditto.
Diffstat (limited to 'gdb/ser-unix.c')
-rw-r--r-- | gdb/ser-unix.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/gdb/ser-unix.c b/gdb/ser-unix.c index a77da59..b1ffca0 100644 --- a/gdb/ser-unix.c +++ b/gdb/ser-unix.c @@ -77,6 +77,7 @@ static int hardwire_set_tty_state PARAMS ((serial_t scb, serial_ttystate state)) static int hardwire_noflush_set_tty_state PARAMS ((serial_t, serial_ttystate, serial_ttystate)); static void hardwire_print_tty_state PARAMS ((serial_t, serial_ttystate)); +static int hardwire_drain_output PARAMS ((serial_t)); static int hardwire_flush_output PARAMS ((serial_t)); static int hardwire_flush_input PARAMS ((serial_t)); static int hardwire_send_break PARAMS ((serial_t)); @@ -275,6 +276,38 @@ hardwire_print_tty_state (scb, ttystate) #endif } +/* Wait for the output to drain away, as opposed to flushing (discarding) it */ + +static int +hardwire_drain_output (scb) + serial_t scb; +{ +#ifdef HAVE_TERMIOS + return tcdrain (scb->fd); +#endif + +#ifdef HAVE_TERMIO + return ioctl (scb->fd, TCSBRK, 1); +#endif + +#ifdef HAVE_SGTTY + /* Get the current state and then restore it using TIOCSETP, + which should cause the output to drain and pending input + to be discarded. */ + { + struct hardwire_ttystate state; + if (get_tty_state (scb, &state)) + { + return (-1); + } + else + { + return (ioctl (scb->fd, TIOCSETP, &state.sgttyb)); + } + } +#endif +} + static int hardwire_flush_output (scb) serial_t scb; @@ -727,6 +760,7 @@ static struct serial_ops hardwire_ops = hardwire_noflush_set_tty_state, hardwire_setbaudrate, hardwire_setstopbits, + hardwire_drain_output, /* wait for output to drain */ }; void |