TTY: do not reply to KERNEL

Diagnostics messages are printed using locally generated requests,
using KERNEL as the calling endpoint.  No reply should be sent for
such cases.  This check was accidentally lost with the previous
removal of tty_reply().

Change-Id: I4b76215a4d90e927b0071675d89d861aa399abb3
This commit is contained in:
David van Moolenbroek 2014-02-25 14:44:58 +01:00 committed by Lionel Sambuc
parent e7974541d0
commit 415782f70f
3 changed files with 15 additions and 9 deletions

View file

@ -266,8 +266,9 @@ rs_write(register tty_t *tp, int try)
tp->tty_outcum += count;
if ((tp->tty_outleft -= count) == 0) {
/* Output is finished, reply to the writer. */
chardriver_reply_task(tp->tty_outcaller, tp->tty_outid,
tp->tty_outcum);
if (tp->tty_outcaller != KERNEL)
chardriver_reply_task(tp->tty_outcaller,
tp->tty_outid, tp->tty_outcum);
tp->tty_outcum = 0;
tp->tty_outcaller = NONE;
}
@ -275,7 +276,9 @@ rs_write(register tty_t *tp, int try)
}
if (tp->tty_outleft > 0 && tp->tty_termios.c_ospeed == B0) {
/* Oops, the line has hung up. */
chardriver_reply_task(tp->tty_outcaller, tp->tty_outid, EIO);
if (tp->tty_outcaller != KERNEL)
chardriver_reply_task(tp->tty_outcaller, tp->tty_outid,
EIO);
tp->tty_outleft = tp->tty_outcum = 0;
tp->tty_outcaller = NONE;
}

View file

@ -223,10 +223,11 @@ int try;
flush(cons); /* transfer anything buffered to the screen */
/* Reply to the writer if all output is finished or if an error occured. */
/* Reply to the writer if all output is finished or if an error occurred. */
if (tp->tty_outleft == 0 || result != OK) {
chardriver_reply_task(tp->tty_outcaller, tp->tty_outid,
result != OK ? result : tp->tty_outcum);
if (tp->tty_outcaller != KERNEL)
chardriver_reply_task(tp->tty_outcaller, tp->tty_outid,
result != OK ? result : tp->tty_outcum);
tp->tty_outcum = tp->tty_outleft = 0;
tp->tty_outcaller = NONE;
}

View file

@ -274,15 +274,17 @@ static int rs_write(register tty_t *tp, int try)
tp->tty_outcum += count;
if ((tp->tty_outleft -= count) == 0) {
/* Output is finished, reply to the writer. */
chardriver_reply_task(tp->tty_outcaller, tp->tty_outid,
tp->tty_outcum);
if (tp->tty_outcaller != KERNEL)
chardriver_reply_task(tp->tty_outcaller, tp->tty_outid,
tp->tty_outcum);
tp->tty_outcum = 0;
tp->tty_outcaller = NONE;
}
}
if (tp->tty_outleft > 0 && tp->tty_termios.c_ospeed == B0) {
/* Oops, the line has hung up. */
chardriver_reply_task(tp->tty_outcaller, tp->tty_outid, EIO);
if (tp->tty_outcaller != KERNEL)
chardriver_reply_task(tp->tty_outcaller, tp->tty_outid, EIO);
tp->tty_outleft = tp->tty_outcum = 0;
tp->tty_outcaller = NONE;
}