summaryrefslogtreecommitdiffstats
path: root/sys/kern/tty_ttydisc.c
diff options
context:
space:
mode:
authored <ed@FreeBSD.org>2012-10-25 09:05:21 +0000
committered <ed@FreeBSD.org>2012-10-25 09:05:21 +0000
commitae88b227912c0ec48a0dde46fe47f423ca864059 (patch)
tree0b7387e61e42451b385944d1c8a832f952bfe5a3 /sys/kern/tty_ttydisc.c
parent3d11eb1465fb275027ac5463f340907bdc11a0ad (diff)
downloadFreeBSD-src-ae88b227912c0ec48a0dde46fe47f423ca864059.zip
FreeBSD-src-ae88b227912c0ec48a0dde46fe47f423ca864059.tar.gz
Correct SIGTTIN handling.
In the old TTY layer, SIGTTIN was correctly handled like this: while (data should be read) { send SIGTTIN if not foreground process group read data } In the new TTY layer, however, this behaviour was changed, based on a false interpretation of the standard: send SIGTTIN if not foreground process group while (data should be read) { read data } Correct this by pushing tty_wait_background() into the ttydisc_read_*() functions. Reported by: koitsu PR: kern/173010 MFC after: 2 weeks
Diffstat (limited to 'sys/kern/tty_ttydisc.c')
-rw-r--r--sys/kern/tty_ttydisc.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/sys/kern/tty_ttydisc.c b/sys/kern/tty_ttydisc.c
index 52a5df2..63b144a 100644
--- a/sys/kern/tty_ttydisc.c
+++ b/sys/kern/tty_ttydisc.c
@@ -126,6 +126,10 @@ ttydisc_read_canonical(struct tty *tp, struct uio *uio, int ioflag)
breakc[n] = '\0';
do {
+ error = tty_wait_background(tp, curthread, SIGTTIN);
+ if (error)
+ return (error);
+
/*
* Quite a tricky case: unlike the old TTY
* implementation, this implementation copies data back
@@ -192,6 +196,10 @@ ttydisc_read_raw_no_timer(struct tty *tp, struct uio *uio, int ioflag)
*/
for (;;) {
+ error = tty_wait_background(tp, curthread, SIGTTIN);
+ if (error)
+ return (error);
+
error = ttyinq_read_uio(&tp->t_inq, tp, uio,
uio->uio_resid, 0);
if (error)
@@ -229,6 +237,10 @@ ttydisc_read_raw_read_timer(struct tty *tp, struct uio *uio, int ioflag,
timevaladd(&end, &now);
for (;;) {
+ error = tty_wait_background(tp, curthread, SIGTTIN);
+ if (error)
+ return (error);
+
error = ttyinq_read_uio(&tp->t_inq, tp, uio,
uio->uio_resid, 0);
if (error)
@@ -278,6 +290,10 @@ ttydisc_read_raw_interbyte_timer(struct tty *tp, struct uio *uio, int ioflag)
*/
for (;;) {
+ error = tty_wait_background(tp, curthread, SIGTTIN);
+ if (error)
+ return (error);
+
error = ttyinq_read_uio(&tp->t_inq, tp, uio,
uio->uio_resid, 0);
if (error)
OpenPOWER on IntegriCloud