X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=drivers%2Ftty%2Fpty.c;h=f882ac81b93a2d54a602bf8c21d84a60f182ca47;hb=c81622ac4282b0183e738e192c91fabe4a782715;hp=a9d256d6e909c1aecfc854732694d608256aeb15;hpb=6ae840e7cc4be0be3aa40d9f67c35c75cfc67d83;p=firefly-linux-kernel-4.4.55.git diff --git a/drivers/tty/pty.c b/drivers/tty/pty.c index a9d256d6e909..f882ac81b93a 100644 --- a/drivers/tty/pty.c +++ b/drivers/tty/pty.c @@ -87,19 +87,6 @@ static void pty_unthrottle(struct tty_struct *tty) set_bit(TTY_THROTTLED, &tty->flags); } -/** - * pty_space - report space left for writing - * @to: tty we are writing into - * - * Limit the buffer space used by ptys to 8k. - */ - -static int pty_space(struct tty_struct *to) -{ - int n = tty_buffer_space_avail(to->port); - return min(n, 8192); -} - /** * pty_write - write to a pty * @tty: the tty we write from @@ -141,7 +128,7 @@ static int pty_write_room(struct tty_struct *tty) { if (tty->stopped) return 0; - return pty_space(tty->link); + return tty_buffer_space_avail(tty->link->port); } /** @@ -210,6 +197,9 @@ static int pty_signal(struct tty_struct *tty, int sig) { struct pid *pgrp; + if (sig != SIGINT && sig != SIGQUIT && sig != SIGTSTP) + return -EINVAL; + if (tty->link) { pgrp = tty_get_pgrp(tty->link); if (pgrp) @@ -429,6 +419,8 @@ static int pty_common_install(struct tty_driver *driver, struct tty_struct *tty, o_tty->link = tty; tty_port_init(ports[0]); tty_port_init(ports[1]); + tty_buffer_set_limit(ports[0], 8192); + tty_buffer_set_limit(ports[1], 8192); o_tty->port = ports[0]; tty->port = ports[1]; o_tty->port->itty = o_tty;