|
@@ -2658,6 +2658,28 @@ static int tiocsetd(struct tty_struct *tty, int __user *p)
|
|
|
return ret;
|
|
|
}
|
|
|
|
|
|
+/**
|
|
|
+ * tiocgetd - get line discipline
|
|
|
+ * @tty: tty device
|
|
|
+ * @p: pointer to user data
|
|
|
+ *
|
|
|
+ * Retrieves the line discipline id directly from the ldisc.
|
|
|
+ *
|
|
|
+ * Locking: waits for ldisc reference (in case the line discipline
|
|
|
+ * is changing or the tty is being hungup)
|
|
|
+ */
|
|
|
+
|
|
|
+static int tiocgetd(struct tty_struct *tty, int __user *p)
|
|
|
+{
|
|
|
+ struct tty_ldisc *ld;
|
|
|
+ int ret;
|
|
|
+
|
|
|
+ ld = tty_ldisc_ref_wait(tty);
|
|
|
+ ret = put_user(ld->ops->num, p);
|
|
|
+ tty_ldisc_deref(ld);
|
|
|
+ return ret;
|
|
|
+}
|
|
|
+
|
|
|
/**
|
|
|
* send_break - performed time break
|
|
|
* @tty: device to break on
|
|
@@ -2884,7 +2906,7 @@ long tty_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
|
|
|
case TIOCGSID:
|
|
|
return tiocgsid(tty, real_tty, p);
|
|
|
case TIOCGETD:
|
|
|
- return put_user(tty->ldisc->ops->num, (int __user *)p);
|
|
|
+ return tiocgetd(tty, p);
|
|
|
case TIOCSETD:
|
|
|
return tiocsetd(tty, p);
|
|
|
case TIOCVHANGUP:
|