1 Subject: tiocgdev ioctl
2 Patch-mainline: never, lkml guys don't like it
5 add tty ioctl to figure physical device of the console.
7 arch/alpha/include/asm/ioctls.h | 1 +
8 arch/arm/include/asm/ioctls.h | 1 +
9 arch/ia64/include/asm/ioctls.h | 1 +
10 arch/powerpc/include/asm/ioctls.h | 1 +
11 arch/s390/include/asm/ioctls.h | 1 +
12 arch/sh/include/asm/ioctls.h | 1 +
13 arch/sparc/include/asm/ioctls.h | 1 +
14 drivers/char/tty_io.c | 15 +++++++++++++++
15 fs/compat_ioctl.c | 1 +
16 include/asm-m68k/ioctls.h | 1 +
17 include/asm-mips/ioctls.h | 1 +
18 include/asm-x86/ioctls.h | 1 +
19 12 files changed, 26 insertions(+)
21 --- a/arch/alpha/include/asm/ioctls.h
22 +++ b/arch/alpha/include/asm/ioctls.h
24 #define TIOCGSID 0x5429 /* Return the session ID of FD */
25 #define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
26 #define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */
27 +#define TIOCGDEV _IOR('T',0x32, unsigned int) /* Get real dev no below /dev/console */
29 #define TIOCSERCONFIG 0x5453
30 #define TIOCSERGWILD 0x5454
31 --- a/arch/arm/include/asm/ioctls.h
32 +++ b/arch/arm/include/asm/ioctls.h
34 #define TCSETSF2 _IOW('T',0x2D, struct termios2)
35 #define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
36 #define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */
37 +#define TIOCGDEV _IOR('T',0x32, unsigned int) /* Get real dev no below /dev/console */
39 #define FIONCLEX 0x5450 /* these numbers need to be adjusted. */
40 #define FIOCLEX 0x5451
41 --- a/arch/ia64/include/asm/ioctls.h
42 +++ b/arch/ia64/include/asm/ioctls.h
44 #define TCSETSF2 _IOW('T',0x2D, struct termios2)
45 #define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
46 #define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */
47 +#define TIOCGDEV _IOR('T',0x32, unsigned int) /* Get real dev no below /dev/console */
49 #define FIONCLEX 0x5450 /* these numbers need to be adjusted. */
50 #define FIOCLEX 0x5451
51 --- a/arch/powerpc/include/asm/ioctls.h
52 +++ b/arch/powerpc/include/asm/ioctls.h
54 #define TIOCGSID 0x5429 /* Return the session ID of FD */
55 #define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
56 #define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */
57 +#define TIOCGDEV _IOR('T',0x32, unsigned int) /* Get real dev no below /dev/console */
59 #define TIOCSERCONFIG 0x5453
60 #define TIOCSERGWILD 0x5454
61 --- a/arch/s390/include/asm/ioctls.h
62 +++ b/arch/s390/include/asm/ioctls.h
64 #define TCSETSF2 _IOW('T',0x2D, struct termios2)
65 #define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
66 #define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */
67 +#define TIOCGDEV _IOR('T',0x32, unsigned int) /* Get real dev no below /dev/console */
69 #define FIONCLEX 0x5450 /* these numbers need to be adjusted. */
70 #define FIOCLEX 0x5451
71 --- a/arch/sh/include/asm/ioctls.h
72 +++ b/arch/sh/include/asm/ioctls.h
74 #define TCSETSF2 _IOW('T', 45, struct termios2)
75 #define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
76 #define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */
77 +#define TIOCGDEV _IOR('T',0x32, unsigned int) /* Get real dev no below /dev/console */
79 #define TIOCSERCONFIG _IO('T', 83) /* 0x5453 */
80 #define TIOCSERGWILD _IOR('T', 84, int) /* 0x5454 */
81 --- a/arch/sparc/include/asm/ioctls.h
82 +++ b/arch/sparc/include/asm/ioctls.h
84 #define TCSETS2 _IOW('T', 13, struct termios2)
85 #define TCSETSW2 _IOW('T', 14, struct termios2)
86 #define TCSETSF2 _IOW('T', 15, struct termios2)
87 +#define TIOCGDEV _IOR('T',0x32, unsigned int) /* Get real dev no below /dev/console */
89 /* Note that all the ioctls that are not available in Linux have a
90 * double underscore on the front to: a) avoid some programs to
91 --- a/drivers/char/tty_io.c
92 +++ b/drivers/char/tty_io.c
93 @@ -3031,6 +3031,21 @@ long tty_ioctl(struct file *file, unsign
94 return tioclinux(tty, arg);
97 + * Without the real device to which /dev/console is connected,
98 + * blogd can not work.
99 + * blogd spawns a pty/tty pair,
100 + * set /dev/console to the tty of that pair (ioctl TIOCCONS),
101 + * then reads in all input from the current /dev/console,
102 + * buffer or write the readed data to /var/log/boot.msg
103 + * _and_ to the original real device.
107 + unsigned int ret = new_encode_dev(tty_devnum(real_tty));
108 + return put_user(ret, (unsigned int __user *)p);
114 case TIOCSBRK: /* Turn break on, unconditionally */
115 --- a/fs/compat_ioctl.c
116 +++ b/fs/compat_ioctl.c
117 @@ -1871,6 +1871,7 @@ COMPATIBLE_IOCTL(TCSETSW)
118 COMPATIBLE_IOCTL(TCSETSF)
119 COMPATIBLE_IOCTL(TIOCLINUX)
120 COMPATIBLE_IOCTL(TIOCSBRK)
121 +COMPATIBLE_IOCTL(TIOCGDEV)
122 COMPATIBLE_IOCTL(TIOCCBRK)
123 ULONG_IOCTL(TIOCMIWAIT)
124 COMPATIBLE_IOCTL(TIOCGICOUNT)
125 --- a/include/asm-m68k/ioctls.h
126 +++ b/include/asm-m68k/ioctls.h
128 #define TCSETSF2 _IOW('T',0x2D, struct termios2)
129 #define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
130 #define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */
131 +#define TIOCGDEV _IOR('T',0x32, unsigned int) /* Get real dev no below /dev/console */
133 #define FIONCLEX 0x5450 /* these numbers need to be adjusted. */
134 #define FIOCLEX 0x5451
135 --- a/include/asm-mips/ioctls.h
136 +++ b/include/asm-mips/ioctls.h
138 #define TCSETSF2 _IOW('T', 0x2D, struct termios2)
139 #define TIOCGPTN _IOR('T', 0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
140 #define TIOCSPTLCK _IOW('T', 0x31, int) /* Lock/unlock Pty */
141 +#define TIOCGDEV _IOR('T', 0x32, unsigned int) /* Get real dev no below /dev/console */
143 /* I hope the range from 0x5480 on is free ... */
144 #define TIOCSCTTY 0x5480 /* become controlling tty */
145 --- a/include/asm-x86/ioctls.h
146 +++ b/include/asm-x86/ioctls.h
148 #define TIOCGPTN _IOR('T', 0x30, unsigned int)
149 /* Get Pty Number (of pty-mux device) */
150 #define TIOCSPTLCK _IOW('T', 0x31, int) /* Lock/unlock Pty */
151 +#define TIOCGDEV _IOR('T', 0x32, unsigned int) /* Get real dev no below /dev/console */
153 #define FIONCLEX 0x5450
154 #define FIOCLEX 0x5451