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 drivers/char/tty_io.c | 15 +++++++++++++++
8 fs/compat_ioctl.c | 1 +
9 include/asm-alpha/ioctls.h | 1 +
10 include/asm-arm/ioctls.h | 1 +
11 include/asm-i386/ioctls.h | 1 +
12 include/asm-ia64/ioctls.h | 1 +
13 include/asm-m68k/ioctls.h | 1 +
14 include/asm-mips/ioctls.h | 1 +
15 include/asm-powerpc/ioctls.h | 1 +
16 include/asm-s390/ioctls.h | 1 +
17 include/asm-sh/ioctls.h | 1 +
18 include/asm-sparc/ioctls.h | 1 +
19 include/asm-sparc64/ioctls.h | 1 +
20 include/asm-x86_64/ioctls.h | 1 +
21 14 files changed, 28 insertions(+)
23 --- a/drivers/char/tty_io.c 2007-07-08 19:32:17.000000000 -0400
24 +++ b/drivers/char/tty_io.c 2007-08-27 14:02:21.000000000 -0400
25 @@ -3354,6 +3354,21 @@ int tty_ioctl(struct inode * inode, stru
26 return tioclinux(tty, arg);
29 + * Without the real device to which /dev/console is connected,
30 + * blogd can not work.
31 + * blogd spawns a pty/tty pair,
32 + * set /dev/console to the tty of that pair (ioctl TIOCCONS),
33 + * then reads in all input from the current /dev/console,
34 + * buffer or write the readed data to /var/log/boot.msg
35 + * _and_ to the original real device.
39 + unsigned int ret = new_encode_dev(tty_devnum(real_tty));
40 + return put_user(ret, (unsigned int __user *)p);
46 case TIOCSBRK: /* Turn break on, unconditionally */
47 --- a/fs/compat_ioctl.c 2007-07-08 19:32:17.000000000 -0400
48 +++ b/fs/compat_ioctl.c 2007-08-27 14:01:21.000000000 -0400
49 @@ -2451,6 +2451,7 @@ COMPATIBLE_IOCTL(TCSETSW)
50 COMPATIBLE_IOCTL(TCSETSF)
51 COMPATIBLE_IOCTL(TIOCLINUX)
52 COMPATIBLE_IOCTL(TIOCSBRK)
53 +COMPATIBLE_IOCTL(TIOCGDEV)
54 COMPATIBLE_IOCTL(TIOCCBRK)
55 ULONG_IOCTL(TIOCMIWAIT)
56 COMPATIBLE_IOCTL(TIOCGICOUNT)
57 --- a/include/asm-alpha/ioctls.h 2007-07-08 19:32:17.000000000 -0400
58 +++ b/include/asm-alpha/ioctls.h 2007-08-27 14:01:21.000000000 -0400
60 #define TIOCGSID 0x5429 /* Return the session ID of FD */
61 #define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
62 #define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */
63 +#define TIOCGDEV _IOR('T',0x32, unsigned int) /* Get real dev no below /dev/console */
65 #define TIOCSERCONFIG 0x5453
66 #define TIOCSERGWILD 0x5454
67 --- a/include/asm-arm/ioctls.h 2007-07-08 19:32:17.000000000 -0400
68 +++ b/include/asm-arm/ioctls.h 2007-08-27 14:01:21.000000000 -0400
70 #define TCSETSF2 _IOW('T',0x2D, struct termios2)
71 #define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
72 #define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */
73 +#define TIOCGDEV _IOR('T',0x32, unsigned int) /* Get real dev no below /dev/console */
75 #define FIONCLEX 0x5450 /* these numbers need to be adjusted. */
76 #define FIOCLEX 0x5451
77 --- a/include/asm-i386/ioctls.h 2007-07-08 19:32:17.000000000 -0400
78 +++ b/include/asm-i386/ioctls.h 2007-08-27 14:01:21.000000000 -0400
80 #define TCSETSF2 _IOW('T',0x2D, struct termios2)
81 #define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
82 #define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */
83 +#define TIOCGDEV _IOR('T',0x32, unsigned int) /* Get real dev no below /dev/console */
85 #define FIONCLEX 0x5450
86 #define FIOCLEX 0x5451
87 --- a/include/asm-ia64/ioctls.h 2007-07-08 19:32:17.000000000 -0400
88 +++ b/include/asm-ia64/ioctls.h 2007-08-27 14:01:21.000000000 -0400
90 #define TIOCGSID 0x5429 /* Return the session ID of FD */
91 #define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
92 #define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */
93 +#define TIOCGDEV _IOR('T',0x32, unsigned int) /* Get real dev no below /dev/console */
95 #define FIONCLEX 0x5450 /* these numbers need to be adjusted. */
96 #define FIOCLEX 0x5451
97 --- a/include/asm-m68k/ioctls.h 2007-07-08 19:32:17.000000000 -0400
98 +++ b/include/asm-m68k/ioctls.h 2007-08-27 14:01:21.000000000 -0400
100 #define TIOCGSID 0x5429 /* Return the session ID of FD */
101 #define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
102 #define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */
103 +#define TIOCGDEV _IOR('T',0x32, unsigned int) /* Get real dev no below /dev/console */
105 #define FIONCLEX 0x5450 /* these numbers need to be adjusted. */
106 #define FIOCLEX 0x5451
107 --- a/include/asm-mips/ioctls.h 2007-07-08 19:32:17.000000000 -0400
108 +++ b/include/asm-mips/ioctls.h 2007-08-27 14:01:21.000000000 -0400
110 #define TIOCGSID 0x7416 /* Return the session ID of FD */
111 #define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
112 #define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */
113 +#define TIOCGDEV _IOR('T',0x32, unsigned int) /* Get real dev no below /dev/console */
115 /* I hope the range from 0x5480 on is free ... */
116 #define TIOCSCTTY 0x5480 /* become controlling tty */
117 --- a/include/asm-powerpc/ioctls.h 2007-07-08 19:32:17.000000000 -0400
118 +++ b/include/asm-powerpc/ioctls.h 2007-08-27 14:01:21.000000000 -0400
120 #define TIOCGSID 0x5429 /* Return the session ID of FD */
121 #define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
122 #define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */
123 +#define TIOCGDEV _IOR('T',0x32, unsigned int) /* Get real dev no below /dev/console */
125 #define TIOCSERCONFIG 0x5453
126 #define TIOCSERGWILD 0x5454
127 --- a/include/asm-s390/ioctls.h 2007-07-08 19:32:17.000000000 -0400
128 +++ b/include/asm-s390/ioctls.h 2007-08-27 14:01:21.000000000 -0400
130 #define TIOCGSID 0x5429 /* Return the session ID of FD */
131 #define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
132 #define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */
133 +#define TIOCGDEV _IOR('T',0x32, unsigned int) /* Get real dev no below /dev/console */
135 #define FIONCLEX 0x5450 /* these numbers need to be adjusted. */
136 #define FIOCLEX 0x5451
137 --- a/include/asm-sh/ioctls.h 2007-07-08 19:32:17.000000000 -0400
138 +++ b/include/asm-sh/ioctls.h 2007-08-27 14:01:21.000000000 -0400
140 #define TIOCGSID _IOR('T', 41, pid_t) /* 0x5429 */ /* Return the session ID of FD */
141 #define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
142 #define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */
143 +#define TIOCGDEV _IOR('T',0x32, unsigned int) /* Get real dev no below /dev/console */
145 #define TIOCSERCONFIG _IO('T', 83) /* 0x5453 */
146 #define TIOCSERGWILD _IOR('T', 84, int) /* 0x5454 */
147 --- a/include/asm-sparc/ioctls.h 2007-07-08 19:32:17.000000000 -0400
148 +++ b/include/asm-sparc/ioctls.h 2007-08-27 14:01:21.000000000 -0400
150 #define TCSETS _IOW('T', 9, struct termios)
151 #define TCSETSW _IOW('T', 10, struct termios)
152 #define TCSETSF _IOW('T', 11, struct termios)
153 +#define TIOCGDEV _IOR('T',0x32, unsigned int) /* Get real dev no below /dev/console */
155 /* Note that all the ioctls that are not available in Linux have a
156 * double underscore on the front to: a) avoid some programs to
157 --- a/include/asm-sparc64/ioctls.h 2007-07-08 19:32:17.000000000 -0400
158 +++ b/include/asm-sparc64/ioctls.h 2007-08-27 14:01:21.000000000 -0400
160 #define TCSETS _IOW('T', 9, struct termios)
161 #define TCSETSW _IOW('T', 10, struct termios)
162 #define TCSETSF _IOW('T', 11, struct termios)
163 +#define TIOCGDEV _IOR('T',0x32, unsigned int) /* Get real dev no below /dev/console */
165 /* Note that all the ioctls that are not available in Linux have a
166 * double underscore on the front to: a) avoid some programs to
167 --- a/include/asm-x86_64/ioctls.h 2007-07-08 19:32:17.000000000 -0400
168 +++ b/include/asm-x86_64/ioctls.h 2007-08-27 14:01:21.000000000 -0400
170 #define TCSETSF2 _IOW('T',0x2D, struct termios2)
171 #define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
172 #define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */
173 +#define TIOCGDEV _IOR('T',0x32, unsigned int) /* Get real dev no below /dev/console */
175 #define FIONCLEX 0x5450 /* these numbers need to be adjusted. */
176 #define FIOCLEX 0x5451