diff options
author | Thomas Pfaff <tpfaff@pcs.com> | 2009-01-02 08:47:13 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-01-02 13:19:40 -0500 |
commit | ff8cb0fd6f195389aefe55d5dac9927d09a9de54 (patch) | |
tree | 258cbb425a03d5f444014d32c59a22f13d4ed492 /drivers/char/n_tty.c | |
parent | eff6937a46e096eb35c16a391617b7a5e098a30c (diff) |
tty: N_TTY SIGIO only works for read
The N_TTY ldisc layer does not send SIGIO POLL_OUTs correctly when output is
possible due to flawed handling of the TTY_DO_WRITE_WAKEUP bit. It will
either send no SIGIOs at all or on every tty wakeup.
The fix is to set the bit when the tty driver write would block and test
and clear it on write wakeup.
[Merged with existing N_TTY patches and a small buglet fixed -- Alan]
Signed-off-by: Thomas Pfaff <tpfaff@pcs.com>
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/char/n_tty.c')
-rw-r--r-- | drivers/char/n_tty.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/char/n_tty.c b/drivers/char/n_tty.c index 3922a084205e..f6f0e4ec2b51 100644 --- a/drivers/char/n_tty.c +++ b/drivers/char/n_tty.c | |||
@@ -1352,10 +1352,8 @@ static void n_tty_write_wakeup(struct tty_struct *tty) | |||
1352 | /* Write out any echoed characters that are still pending */ | 1352 | /* Write out any echoed characters that are still pending */ |
1353 | process_echoes(tty); | 1353 | process_echoes(tty); |
1354 | 1354 | ||
1355 | if (tty->fasync) { | 1355 | if (tty->fasync && test_and_clear_bit(TTY_DO_WRITE_WAKEUP, &tty->flags)) |
1356 | set_bit(TTY_DO_WRITE_WAKEUP, &tty->flags); | ||
1357 | kill_fasync(&tty->fasync, SIGIO, POLL_OUT); | 1356 | kill_fasync(&tty->fasync, SIGIO, POLL_OUT); |
1358 | } | ||
1359 | } | 1357 | } |
1360 | 1358 | ||
1361 | /** | 1359 | /** |
@@ -2014,6 +2012,8 @@ static ssize_t n_tty_write(struct tty_struct *tty, struct file *file, | |||
2014 | break_out: | 2012 | break_out: |
2015 | __set_current_state(TASK_RUNNING); | 2013 | __set_current_state(TASK_RUNNING); |
2016 | remove_wait_queue(&tty->write_wait, &wait); | 2014 | remove_wait_queue(&tty->write_wait, &wait); |
2015 | if (b - buf != nr && tty->fasync) | ||
2016 | set_bit(TTY_DO_WRITE_WAKEUP, &tty->flags); | ||
2017 | return (b - buf) ? b - buf : retval; | 2017 | return (b - buf) ? b - buf : retval; |
2018 | } | 2018 | } |
2019 | 2019 | ||