Re: [PATCH 1/1] tty: Fix pty master poll() after slave closes
From: Francesco Ruggeri <hidden>
Date: 2014-10-09 17:39:48
Also in:
lkml
From: Francesco Ruggeri <hidden>
Date: 2014-10-09 17:39:48
Also in:
lkml
Hi Peter, thanks for your reply.
quoted
poll_wait(file, &tty->read_wait, wait); poll_wait(file, &tty->write_wait, wait); - if (input_available_p(tty, 1)) - mask |= POLLIN | POLLRDNORM; if (tty->packet && tty->link->ctrl_status) mask |= POLLPRI | POLLIN | POLLRDNORM; if (test_bit(TTY_OTHER_CLOSED, &tty->flags)) mask |= POLLHUP; if (tty_hung_up_p(file)) mask |= POLLHUP; + if (mask & POLLHUP) + tty_flush_to_ldisc(tty);This isn't necessary for the tty_hung_up_p() case because, when the poll() is woken from hangup, the read buffer has already been flushed (ie., cleared). Plus, this waits even if input_available_p() would already return true.
Let me work on a patch for stable along the lines you suggest. Francesco