[Devel] [PATCH RHEL8 COMMIT] ve/vtty: Don't zap termios fields on slave peer
Konstantin Khorenko
khorenko at virtuozzo.com
Mon Jul 26 20:15:25 MSK 2021
The commit is pushed to "branch-rh8-4.18.0-305.3.1.vz8.7.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh8-4.18.0-305.3.1.el8
------>
commit fb372dc1525510b8401489fdfc9c3180a7847818
Author: Cyrill Gorcunov <gorcunov at virtuozzo.com>
Date: Mon Jul 26 20:15:25 2021 +0300
ve/vtty: Don't zap termios fields on slave peer
These fields are sensitive to userspace so was a copy-paste
bug in first place when I defined driver fields (the pty
as well as vtty devices have same structure in drivers).
Also I defined @chars_in_buffer, @flush_buffer and @resize
methods for driver to be close to former pcs6 driver structure.
Note there is still problem remains: upon vzctl console
call the carrige return (enter press) is still required
for login prompt to appear, I'm investigating it now.
https://jira.sw.ru/browse/PSBM-41057
Signed-off-by: Cyrill Gorcunov <gorcunov at virtuozzo.com>
Reviewed-by: Vladimir Davydov <vdavydov at virtuozzo.com>
https://jira.sw.ru/browse/PSBM-132299
(cherry-picked from ca82283e668fa36738231594f8d325ad5d3dad6a)
Signed-off-by: Valeriy Vdovin <valeriy.vdovin at virtuozzo.com>
---
drivers/tty/pty.c | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/drivers/tty/pty.c b/drivers/tty/pty.c
index a7f9bb404d70..d9cc63b0c11e 100644
--- a/drivers/tty/pty.c
+++ b/drivers/tty/pty.c
@@ -903,6 +903,13 @@ static void vtty_remove(struct tty_driver *driver, struct tty_struct *tty)
{
}
+static int vtty_resize(struct tty_struct *tty, struct winsize *ws)
+{
+ if (tty->driver == vttym_driver)
+ return pty_resize(tty, ws);
+ return tty_do_resize(tty, ws);
+}
+
static const struct tty_operations vtty_ops = {
.lookup = vtty_lookup,
.install = vtty_install,
@@ -912,9 +919,12 @@ static const struct tty_operations vtty_ops = {
.cleanup = pty_cleanup,
.write = vtty_write,
.write_room = vtty_write_room,
+ .chars_in_buffer= pty_chars_in_buffer,
.set_termios = pty_set_termios,
.unthrottle = pty_unthrottle,
+ .flush_buffer = pty_flush_buffer,
.remove = vtty_remove,
+ .resize = vtty_resize,
};
struct tty_driver *vtty_console_driver(int *index)
@@ -984,8 +994,6 @@ static int __init vtty_init(void)
/* 38400 boud rate, 8 bit char size, enable receiver */
vttym_driver->init_termios.c_cflag = B38400 | CS8 | CREAD;
vttym_driver->init_termios.c_lflag = 0;
- vttym_driver->init_termios.c_ispeed = 38400;
- vttym_driver->init_termios.c_ospeed = 38400;
tty_set_operations(vttym_driver, &vtty_ops);
vttys_driver->driver_name = "vtty_slave";
@@ -996,12 +1004,7 @@ static int __init vtty_init(void)
vttys_driver->type = TTY_DRIVER_TYPE_PTY;
vttys_driver->subtype = PTY_TYPE_SLAVE;
vttys_driver->init_termios = tty_std_termios;
- vttys_driver->init_termios.c_iflag = 0;
- vttys_driver->init_termios.c_oflag = 0;
vttys_driver->init_termios.c_cflag = B38400 | CS8 | CREAD;
- vttys_driver->init_termios.c_lflag = 0;
- vttys_driver->init_termios.c_ispeed = 38400;
- vttys_driver->init_termios.c_ospeed = 38400;
tty_set_operations(vttys_driver, &vtty_ops);
if (tty_register_driver(vttym_driver))
More information about the Devel
mailing list