compat: backport tty_set_termios