aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/tty')
-rw-r--r--drivers/tty/pty.c21
-rw-r--r--drivers/tty/tty_io.c5
2 files changed, 26 insertions, 0 deletions
diff --git a/drivers/tty/pty.c b/drivers/tty/pty.c
index df3c64272d21..0ce0b3ec2bb0 100644
--- a/drivers/tty/pty.c
+++ b/drivers/tty/pty.c
@@ -171,6 +171,12 @@ static int pty_set_lock(struct tty_struct *tty, int __user *arg)
171 return 0; 171 return 0;
172} 172}
173 173
174static int pty_get_lock(struct tty_struct *tty, int __user *arg)
175{
176 int locked = test_bit(TTY_PTY_LOCK, &tty->flags);
177 return put_user(locked, arg);
178}
179
174/* Set the packet mode on a pty */ 180/* Set the packet mode on a pty */
175static int pty_set_pktmode(struct tty_struct *tty, int __user *arg) 181static int pty_set_pktmode(struct tty_struct *tty, int __user *arg)
176{ 182{
@@ -193,6 +199,13 @@ static int pty_set_pktmode(struct tty_struct *tty, int __user *arg)
193 return 0; 199 return 0;
194} 200}
195 201
202/* Get the packet mode of a pty */
203static int pty_get_pktmode(struct tty_struct *tty, int __user *arg)
204{
205 int pktmode = tty->packet;
206 return put_user(pktmode, arg);
207}
208
196/* Send a signal to the slave */ 209/* Send a signal to the slave */
197static int pty_signal(struct tty_struct *tty, int sig) 210static int pty_signal(struct tty_struct *tty, int sig)
198{ 211{
@@ -420,8 +433,12 @@ static int pty_bsd_ioctl(struct tty_struct *tty,
420 switch (cmd) { 433 switch (cmd) {
421 case TIOCSPTLCK: /* Set PT Lock (disallow slave open) */ 434 case TIOCSPTLCK: /* Set PT Lock (disallow slave open) */
422 return pty_set_lock(tty, (int __user *) arg); 435 return pty_set_lock(tty, (int __user *) arg);
436 case TIOCGPTLCK: /* Get PT Lock status */
437 return pty_get_lock(tty, (int __user *)arg);
423 case TIOCPKT: /* Set PT packet mode */ 438 case TIOCPKT: /* Set PT packet mode */
424 return pty_set_pktmode(tty, (int __user *)arg); 439 return pty_set_pktmode(tty, (int __user *)arg);
440 case TIOCGPKT: /* Get PT packet mode */
441 return pty_get_pktmode(tty, (int __user *)arg);
425 case TIOCSIG: /* Send signal to other side of pty */ 442 case TIOCSIG: /* Send signal to other side of pty */
426 return pty_signal(tty, (int) arg); 443 return pty_signal(tty, (int) arg);
427 } 444 }
@@ -536,8 +553,12 @@ static int pty_unix98_ioctl(struct tty_struct *tty,
536 switch (cmd) { 553 switch (cmd) {
537 case TIOCSPTLCK: /* Set PT Lock (disallow slave open) */ 554 case TIOCSPTLCK: /* Set PT Lock (disallow slave open) */
538 return pty_set_lock(tty, (int __user *)arg); 555 return pty_set_lock(tty, (int __user *)arg);
556 case TIOCGPTLCK: /* Get PT Lock status */
557 return pty_get_lock(tty, (int __user *)arg);
539 case TIOCPKT: /* Set PT packet mode */ 558 case TIOCPKT: /* Set PT packet mode */
540 return pty_set_pktmode(tty, (int __user *)arg); 559 return pty_set_pktmode(tty, (int __user *)arg);
560 case TIOCGPKT: /* Get PT packet mode */
561 return pty_get_pktmode(tty, (int __user *)arg);
541 case TIOCGPTN: /* Get PT Number */ 562 case TIOCGPTN: /* Get PT Number */
542 return put_user(tty->index, (unsigned int __user *)arg); 563 return put_user(tty->index, (unsigned int __user *)arg);
543 case TIOCSIG: /* Send signal to other side of pty */ 564 case TIOCSIG: /* Send signal to other side of pty */
diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c
index a3eba7f359ed..739ea86c1cf1 100644
--- a/drivers/tty/tty_io.c
+++ b/drivers/tty/tty_io.c
@@ -2687,6 +2687,11 @@ long tty_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
2687 case TIOCNXCL: 2687 case TIOCNXCL:
2688 clear_bit(TTY_EXCLUSIVE, &tty->flags); 2688 clear_bit(TTY_EXCLUSIVE, &tty->flags);
2689 return 0; 2689 return 0;
2690 case TIOCGEXCL:
2691 {
2692 int excl = test_bit(TTY_EXCLUSIVE, &tty->flags);
2693 return put_user(excl, (int __user *)p);
2694 }
2690 case TIOCNOTTY: 2695 case TIOCNOTTY:
2691 if (current->signal->tty != tty) 2696 if (current->signal->tty != tty)
2692 return -ENOTTY; 2697 return -ENOTTY;