diff options
author | Werner Fink <werner@suse.de> | 2010-12-03 06:48:23 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-12-16 19:18:28 -0500 |
commit | b7b8de087384cc1954a8cd075af3f9e5977caa2e (patch) | |
tree | e362fe2c886c610caa9bd45fead9c4ae4789529e | |
parent | fbc92a3455577ab17615cbcb91826399061bd789 (diff) |
TTY: Add tty ioctl to figure device node of the system console.
This has been in the SuSE kernels for a very long time.
Signed-off-by: Werner Fink <werner@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r-- | arch/alpha/include/asm/ioctls.h | 1 | ||||
-rw-r--r-- | arch/mips/include/asm/ioctls.h | 1 | ||||
-rw-r--r-- | arch/parisc/include/asm/ioctls.h | 1 | ||||
-rw-r--r-- | arch/powerpc/include/asm/ioctls.h | 1 | ||||
-rw-r--r-- | arch/sh/include/asm/ioctls.h | 1 | ||||
-rw-r--r-- | arch/sparc/include/asm/ioctls.h | 1 | ||||
-rw-r--r-- | arch/xtensa/include/asm/ioctls.h | 1 | ||||
-rw-r--r-- | drivers/tty/tty_io.c | 5 | ||||
-rw-r--r-- | fs/compat_ioctl.c | 1 | ||||
-rw-r--r-- | include/asm-generic/ioctls.h | 1 |
10 files changed, 14 insertions, 0 deletions
diff --git a/arch/alpha/include/asm/ioctls.h b/arch/alpha/include/asm/ioctls.h index 59617c3c2be..034b6cf5d9f 100644 --- a/arch/alpha/include/asm/ioctls.h +++ b/arch/alpha/include/asm/ioctls.h | |||
@@ -92,6 +92,7 @@ | |||
92 | #define TIOCGSID 0x5429 /* Return the session ID of FD */ | 92 | #define TIOCGSID 0x5429 /* Return the session ID of FD */ |
93 | #define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */ | 93 | #define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */ |
94 | #define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */ | 94 | #define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */ |
95 | #define TIOCGDEV _IOR('T',0x32, unsigned int) /* Get primary device node of /dev/console */ | ||
95 | #define TIOCSIG _IOW('T',0x36, int) /* Generate signal on Pty slave */ | 96 | #define TIOCSIG _IOW('T',0x36, int) /* Generate signal on Pty slave */ |
96 | 97 | ||
97 | #define TIOCSERCONFIG 0x5453 | 98 | #define TIOCSERCONFIG 0x5453 |
diff --git a/arch/mips/include/asm/ioctls.h b/arch/mips/include/asm/ioctls.h index d87cb046569..d967b899762 100644 --- a/arch/mips/include/asm/ioctls.h +++ b/arch/mips/include/asm/ioctls.h | |||
@@ -83,6 +83,7 @@ | |||
83 | #define TCSETSF2 _IOW('T', 0x2D, struct termios2) | 83 | #define TCSETSF2 _IOW('T', 0x2D, struct termios2) |
84 | #define TIOCGPTN _IOR('T', 0x30, unsigned int) /* Get Pty Number (of pty-mux device) */ | 84 | #define TIOCGPTN _IOR('T', 0x30, unsigned int) /* Get Pty Number (of pty-mux device) */ |
85 | #define TIOCSPTLCK _IOW('T', 0x31, int) /* Lock/unlock Pty */ | 85 | #define TIOCSPTLCK _IOW('T', 0x31, int) /* Lock/unlock Pty */ |
86 | #define TIOCGDEV _IOR('T', 0x32, unsigned int) /* Get primary device node of /dev/console */ | ||
86 | #define TIOCSIG _IOW('T', 0x36, int) /* Generate signal on Pty slave */ | 87 | #define TIOCSIG _IOW('T', 0x36, int) /* Generate signal on Pty slave */ |
87 | 88 | ||
88 | /* I hope the range from 0x5480 on is free ... */ | 89 | /* I hope the range from 0x5480 on is free ... */ |
diff --git a/arch/parisc/include/asm/ioctls.h b/arch/parisc/include/asm/ioctls.h index 4e0614456be..6ba80d03623 100644 --- a/arch/parisc/include/asm/ioctls.h +++ b/arch/parisc/include/asm/ioctls.h | |||
@@ -52,6 +52,7 @@ | |||
52 | #define TCSETSF2 _IOW('T',0x2D, struct termios2) | 52 | #define TCSETSF2 _IOW('T',0x2D, struct termios2) |
53 | #define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */ | 53 | #define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */ |
54 | #define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */ | 54 | #define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */ |
55 | #define TIOCGDEV _IOR('T',0x32, int) /* Get primary device node of /dev/console */ | ||
55 | #define TIOCSIG _IOW('T',0x36, int) /* Generate signal on Pty slave */ | 56 | #define TIOCSIG _IOW('T',0x36, int) /* Generate signal on Pty slave */ |
56 | 57 | ||
57 | #define FIONCLEX 0x5450 /* these numbers need to be adjusted. */ | 58 | #define FIONCLEX 0x5450 /* these numbers need to be adjusted. */ |
diff --git a/arch/powerpc/include/asm/ioctls.h b/arch/powerpc/include/asm/ioctls.h index 851920052e0..c7dc17cf84f 100644 --- a/arch/powerpc/include/asm/ioctls.h +++ b/arch/powerpc/include/asm/ioctls.h | |||
@@ -94,6 +94,7 @@ | |||
94 | #define TIOCSRS485 0x542f | 94 | #define TIOCSRS485 0x542f |
95 | #define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */ | 95 | #define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */ |
96 | #define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */ | 96 | #define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */ |
97 | #define TIOCGDEV _IOR('T',0x32, unsigned int) /* Get primary device node of /dev/console */ | ||
97 | #define TIOCSIG _IOW('T',0x36, int) /* Generate signal on Pty slave */ | 98 | #define TIOCSIG _IOW('T',0x36, int) /* Generate signal on Pty slave */ |
98 | 99 | ||
99 | #define TIOCSERCONFIG 0x5453 | 100 | #define TIOCSERCONFIG 0x5453 |
diff --git a/arch/sh/include/asm/ioctls.h b/arch/sh/include/asm/ioctls.h index eb6c4c68797..84e85a79263 100644 --- a/arch/sh/include/asm/ioctls.h +++ b/arch/sh/include/asm/ioctls.h | |||
@@ -85,6 +85,7 @@ | |||
85 | #define TCSETSF2 _IOW('T', 45, struct termios2) | 85 | #define TCSETSF2 _IOW('T', 45, struct termios2) |
86 | #define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */ | 86 | #define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */ |
87 | #define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */ | 87 | #define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */ |
88 | #define TIOCGDEV _IOR('T',0x32, unsigned int) /* Get primary device node of /dev/console */ | ||
88 | #define TIOCSIG _IOW('T',0x36, int) /* Generate signal on Pty slave */ | 89 | #define TIOCSIG _IOW('T',0x36, int) /* Generate signal on Pty slave */ |
89 | 90 | ||
90 | #define TIOCSERCONFIG _IO('T', 83) /* 0x5453 */ | 91 | #define TIOCSERCONFIG _IO('T', 83) /* 0x5453 */ |
diff --git a/arch/sparc/include/asm/ioctls.h b/arch/sparc/include/asm/ioctls.h index 53f4ee009bd..ed3807b96bb 100644 --- a/arch/sparc/include/asm/ioctls.h +++ b/arch/sparc/include/asm/ioctls.h | |||
@@ -19,6 +19,7 @@ | |||
19 | #define TCSETS2 _IOW('T', 13, struct termios2) | 19 | #define TCSETS2 _IOW('T', 13, struct termios2) |
20 | #define TCSETSW2 _IOW('T', 14, struct termios2) | 20 | #define TCSETSW2 _IOW('T', 14, struct termios2) |
21 | #define TCSETSF2 _IOW('T', 15, struct termios2) | 21 | #define TCSETSF2 _IOW('T', 15, struct termios2) |
22 | #define TIOCGDEV _IOR('T',0x32, unsigned int) /* Get primary device node of /dev/console */ | ||
22 | 23 | ||
23 | /* Note that all the ioctls that are not available in Linux have a | 24 | /* Note that all the ioctls that are not available in Linux have a |
24 | * double underscore on the front to: a) avoid some programs to | 25 | * double underscore on the front to: a) avoid some programs to |
diff --git a/arch/xtensa/include/asm/ioctls.h b/arch/xtensa/include/asm/ioctls.h index ab1800012ed..ccf1800f0b0 100644 --- a/arch/xtensa/include/asm/ioctls.h +++ b/arch/xtensa/include/asm/ioctls.h | |||
@@ -98,6 +98,7 @@ | |||
98 | #define TCSETSF2 _IOW('T', 45, struct termios2) | 98 | #define TCSETSF2 _IOW('T', 45, struct termios2) |
99 | #define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */ | 99 | #define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */ |
100 | #define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */ | 100 | #define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */ |
101 | #define TIOCGDEV _IOR('T',0x32, unsigned int) /* Get primary device node of /dev/console */ | ||
101 | #define TIOCSIG _IOW('T',0x36, int) /* Generate signal on Pty slave */ | 102 | #define TIOCSIG _IOW('T',0x36, int) /* Generate signal on Pty slave */ |
102 | 103 | ||
103 | #define TIOCSERCONFIG _IO('T', 83) | 104 | #define TIOCSERCONFIG _IO('T', 83) |
diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c index be5ab4ac0b9..d2333ab23d0 100644 --- a/drivers/tty/tty_io.c +++ b/drivers/tty/tty_io.c | |||
@@ -2618,6 +2618,11 @@ long tty_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
2618 | return put_user(tty->ldisc->ops->num, (int __user *)p); | 2618 | return put_user(tty->ldisc->ops->num, (int __user *)p); |
2619 | case TIOCSETD: | 2619 | case TIOCSETD: |
2620 | return tiocsetd(tty, p); | 2620 | return tiocsetd(tty, p); |
2621 | case TIOCGDEV: | ||
2622 | { | ||
2623 | unsigned int ret = new_encode_dev(tty_devnum(real_tty)); | ||
2624 | return put_user(ret, (unsigned int __user *)p); | ||
2625 | } | ||
2621 | /* | 2626 | /* |
2622 | * Break handling | 2627 | * Break handling |
2623 | */ | 2628 | */ |
diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c index 410ed188faa..a1a8f0c6735 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c | |||
@@ -837,6 +837,7 @@ COMPATIBLE_IOCTL(TCSETSW) | |||
837 | COMPATIBLE_IOCTL(TCSETSF) | 837 | COMPATIBLE_IOCTL(TCSETSF) |
838 | COMPATIBLE_IOCTL(TIOCLINUX) | 838 | COMPATIBLE_IOCTL(TIOCLINUX) |
839 | COMPATIBLE_IOCTL(TIOCSBRK) | 839 | COMPATIBLE_IOCTL(TIOCSBRK) |
840 | COMPATIBLE_IOCTL(TIOCGDEV) | ||
840 | COMPATIBLE_IOCTL(TIOCCBRK) | 841 | COMPATIBLE_IOCTL(TIOCCBRK) |
841 | COMPATIBLE_IOCTL(TIOCGSID) | 842 | COMPATIBLE_IOCTL(TIOCGSID) |
842 | COMPATIBLE_IOCTL(TIOCGICOUNT) | 843 | COMPATIBLE_IOCTL(TIOCGICOUNT) |
diff --git a/include/asm-generic/ioctls.h b/include/asm-generic/ioctls.h index a3216655d65..3f3f2d189fb 100644 --- a/include/asm-generic/ioctls.h +++ b/include/asm-generic/ioctls.h | |||
@@ -67,6 +67,7 @@ | |||
67 | #endif | 67 | #endif |
68 | #define TIOCGPTN _IOR('T', 0x30, unsigned int) /* Get Pty Number (of pty-mux device) */ | 68 | #define TIOCGPTN _IOR('T', 0x30, unsigned int) /* Get Pty Number (of pty-mux device) */ |
69 | #define TIOCSPTLCK _IOW('T', 0x31, int) /* Lock/unlock Pty */ | 69 | #define TIOCSPTLCK _IOW('T', 0x31, int) /* Lock/unlock Pty */ |
70 | #define TIOCGDEV _IOR('T', 0x32, unsigned int) /* Get primary device node of /dev/console */ | ||
70 | #define TCGETX 0x5432 /* SYS5 TCGETX compatibility */ | 71 | #define TCGETX 0x5432 /* SYS5 TCGETX compatibility */ |
71 | #define TCSETX 0x5433 | 72 | #define TCSETX 0x5433 |
72 | #define TCSETXF 0x5434 | 73 | #define TCSETXF 0x5434 |