|
@@ -2048,7 +2048,6 @@ static int tiocgwinsz(struct tty_struct *tty, struct winsize __user *arg)
|
|
/**
|
|
/**
|
|
* tty_do_resize - resize event
|
|
* tty_do_resize - resize event
|
|
* @tty: tty being resized
|
|
* @tty: tty being resized
|
|
- * @real_tty: real tty (not the same as tty if using a pty/tty pair)
|
|
|
|
* @rows: rows (character)
|
|
* @rows: rows (character)
|
|
* @cols: cols (character)
|
|
* @cols: cols (character)
|
|
*
|
|
*
|
|
@@ -2056,41 +2055,34 @@ static int tiocgwinsz(struct tty_struct *tty, struct winsize __user *arg)
|
|
* peform a terminal resize correctly
|
|
* peform a terminal resize correctly
|
|
*/
|
|
*/
|
|
|
|
|
|
-int tty_do_resize(struct tty_struct *tty, struct tty_struct *real_tty,
|
|
|
|
- struct winsize *ws)
|
|
|
|
|
|
+int tty_do_resize(struct tty_struct *tty, struct winsize *ws)
|
|
{
|
|
{
|
|
- struct pid *pgrp, *rpgrp;
|
|
|
|
|
|
+ struct pid *pgrp;
|
|
unsigned long flags;
|
|
unsigned long flags;
|
|
|
|
|
|
- /* For a PTY we need to lock the tty side */
|
|
|
|
- mutex_lock(&real_tty->termios_mutex);
|
|
|
|
- if (!memcmp(ws, &real_tty->winsize, sizeof(*ws)))
|
|
|
|
|
|
+ /* Lock the tty */
|
|
|
|
+ mutex_lock(&tty->termios_mutex);
|
|
|
|
+ if (!memcmp(ws, &tty->winsize, sizeof(*ws)))
|
|
goto done;
|
|
goto done;
|
|
/* Get the PID values and reference them so we can
|
|
/* Get the PID values and reference them so we can
|
|
avoid holding the tty ctrl lock while sending signals */
|
|
avoid holding the tty ctrl lock while sending signals */
|
|
spin_lock_irqsave(&tty->ctrl_lock, flags);
|
|
spin_lock_irqsave(&tty->ctrl_lock, flags);
|
|
pgrp = get_pid(tty->pgrp);
|
|
pgrp = get_pid(tty->pgrp);
|
|
- rpgrp = get_pid(real_tty->pgrp);
|
|
|
|
spin_unlock_irqrestore(&tty->ctrl_lock, flags);
|
|
spin_unlock_irqrestore(&tty->ctrl_lock, flags);
|
|
|
|
|
|
if (pgrp)
|
|
if (pgrp)
|
|
kill_pgrp(pgrp, SIGWINCH, 1);
|
|
kill_pgrp(pgrp, SIGWINCH, 1);
|
|
- if (rpgrp != pgrp && rpgrp)
|
|
|
|
- kill_pgrp(rpgrp, SIGWINCH, 1);
|
|
|
|
-
|
|
|
|
put_pid(pgrp);
|
|
put_pid(pgrp);
|
|
- put_pid(rpgrp);
|
|
|
|
|
|
|
|
tty->winsize = *ws;
|
|
tty->winsize = *ws;
|
|
- real_tty->winsize = *ws;
|
|
|
|
done:
|
|
done:
|
|
- mutex_unlock(&real_tty->termios_mutex);
|
|
|
|
|
|
+ mutex_unlock(&tty->termios_mutex);
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
* tiocswinsz - implement window size set ioctl
|
|
* tiocswinsz - implement window size set ioctl
|
|
- * @tty; tty
|
|
|
|
|
|
+ * @tty; tty side of tty
|
|
* @arg: user buffer for result
|
|
* @arg: user buffer for result
|
|
*
|
|
*
|
|
* Copies the user idea of the window size to the kernel. Traditionally
|
|
* Copies the user idea of the window size to the kernel. Traditionally
|
|
@@ -2103,17 +2095,16 @@ done:
|
|
* then calls into the default method.
|
|
* then calls into the default method.
|
|
*/
|
|
*/
|
|
|
|
|
|
-static int tiocswinsz(struct tty_struct *tty, struct tty_struct *real_tty,
|
|
|
|
- struct winsize __user *arg)
|
|
|
|
|
|
+static int tiocswinsz(struct tty_struct *tty, struct winsize __user *arg)
|
|
{
|
|
{
|
|
struct winsize tmp_ws;
|
|
struct winsize tmp_ws;
|
|
if (copy_from_user(&tmp_ws, arg, sizeof(*arg)))
|
|
if (copy_from_user(&tmp_ws, arg, sizeof(*arg)))
|
|
return -EFAULT;
|
|
return -EFAULT;
|
|
|
|
|
|
if (tty->ops->resize)
|
|
if (tty->ops->resize)
|
|
- return tty->ops->resize(tty, real_tty, &tmp_ws);
|
|
|
|
|
|
+ return tty->ops->resize(tty, &tmp_ws);
|
|
else
|
|
else
|
|
- return tty_do_resize(tty, real_tty, &tmp_ws);
|
|
|
|
|
|
+ return tty_do_resize(tty, &tmp_ws);
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -2538,7 +2529,7 @@ long tty_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
|
|
case TIOCGWINSZ:
|
|
case TIOCGWINSZ:
|
|
return tiocgwinsz(real_tty, p);
|
|
return tiocgwinsz(real_tty, p);
|
|
case TIOCSWINSZ:
|
|
case TIOCSWINSZ:
|
|
- return tiocswinsz(tty, real_tty, p);
|
|
|
|
|
|
+ return tiocswinsz(real_tty, p);
|
|
case TIOCCONS:
|
|
case TIOCCONS:
|
|
return real_tty != tty ? -EINVAL : tioccons(file);
|
|
return real_tty != tty ? -EINVAL : tioccons(file);
|
|
case FIONBIO:
|
|
case FIONBIO:
|