]>
Commit | Line | Data |
---|---|---|
2bbfcb0c ER |
1 | Subject: tiocgdev ioctl |
2 | Patch-mainline: never, lkml guys don't like it | |
3 | From: kraxel@suse.de | |
4 | ||
5 | add tty ioctl to figure physical device of the console. | |
6 | ||
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/m68k/include/asm/ioctls.h | 1 + | |
11 | arch/mips/include/asm/ioctls.h | 1 + | |
12 | arch/powerpc/include/asm/ioctls.h | 1 + | |
13 | arch/s390/include/asm/ioctls.h | 1 + | |
14 | arch/sh/include/asm/ioctls.h | 1 + | |
15 | arch/sparc/include/asm/ioctls.h | 1 + | |
16 | arch/x86/include/asm/ioctls.h | 1 + | |
17 | drivers/char/tty_io.c | 15 +++++++++++++++ | |
18 | fs/compat_ioctl.c | 1 + | |
19 | 12 files changed, 26 insertions(+) | |
20 | ||
21 | --- a/arch/alpha/include/asm/ioctls.h | |
22 | +++ b/arch/alpha/include/asm/ioctls.h | |
23 | @@ -91,6 +91,7 @@ | |
2bbfcb0c ER |
24 | #define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */ |
25 | #define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */ | |
26 | +#define TIOCGDEV _IOR('T',0x32, unsigned int) /* Get real dev no below /dev/console */ | |
e41d9317 | 27 | #define TIOCSIG _IOW('T',0x36, int) /* Generate signal on Pty slave */ |
2bbfcb0c ER |
28 | |
29 | #define TIOCSERCONFIG 0x5453 | |
30 | #define TIOCSERGWILD 0x5454 | |
31 | --- a/arch/arm/include/asm/ioctls.h | |
32 | +++ b/arch/arm/include/asm/ioctls.h | |
33 | @@ -52,6 +52,7 @@ | |
2bbfcb0c ER |
34 | #define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */ |
35 | #define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */ | |
36 | +#define TIOCGDEV _IOR('T',0x32, unsigned int) /* Get real dev no below /dev/console */ | |
e41d9317 | 37 | #define TIOCSIG _IOW('T',0x36, int) /* Generate signal on Pty slave */ |
2bbfcb0c ER |
38 | |
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 | |
43 | @@ -59,6 +59,7 @@ | |
2bbfcb0c ER |
44 | #define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */ |
45 | #define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */ | |
46 | +#define TIOCGDEV _IOR('T',0x32, unsigned int) /* Get real dev no below /dev/console */ | |
e41d9317 | 47 | #define TIOCSIG _IOW('T',0x36, int) /* Generate signal on Pty slave */ |
2bbfcb0c ER |
48 | |
49 | #define FIONCLEX 0x5450 /* these numbers need to be adjusted. */ | |
50 | #define FIOCLEX 0x5451 | |
51 | --- a/arch/m68k/include/asm/ioctls.h | |
52 | +++ b/arch/m68k/include/asm/ioctls.h | |
53 | @@ -52,6 +52,7 @@ | |
2bbfcb0c ER |
54 | #define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */ |
55 | #define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */ | |
56 | +#define TIOCGDEV _IOR('T',0x32, unsigned int) /* Get real dev no below /dev/console */ | |
e41d9317 | 57 | #define TIOCSIG _IOW('T',0x36, int) /* Generate signal on Pty slave */ |
2bbfcb0c ER |
58 | |
59 | #define FIONCLEX 0x5450 /* these numbers need to be adjusted. */ | |
60 | #define FIOCLEX 0x5451 | |
61 | --- a/arch/mips/include/asm/ioctls.h | |
62 | +++ b/arch/mips/include/asm/ioctls.h | |
63 | @@ -83,6 +83,7 @@ | |
2bbfcb0c ER |
64 | #define TIOCGPTN _IOR('T', 0x30, unsigned int) /* Get Pty Number (of pty-mux device) */ |
65 | #define TIOCSPTLCK _IOW('T', 0x31, int) /* Lock/unlock Pty */ | |
66 | +#define TIOCGDEV _IOR('T', 0x32, unsigned int) /* Get real dev no below /dev/console */ | |
e41d9317 | 67 | #define TIOCSIG _IOW('T', 0x36, int) /* Generate signal on Pty slave */ |
2bbfcb0c ER |
68 | |
69 | /* I hope the range from 0x5480 on is free ... */ | |
70 | #define TIOCSCTTY 0x5480 /* become controlling tty */ | |
71 | --- a/arch/powerpc/include/asm/ioctls.h | |
72 | +++ b/arch/powerpc/include/asm/ioctls.h | |
73 | @@ -93,6 +93,7 @@ | |
2bbfcb0c ER |
74 | #define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */ |
75 | #define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */ | |
76 | +#define TIOCGDEV _IOR('T',0x32, unsigned int) /* Get real dev no below /dev/console */ | |
e41d9317 | 77 | #define TIOCSIG _IOW('T',0x36, int) /* Generate signal on Pty slave */ |
2bbfcb0c ER |
78 | |
79 | #define TIOCSERCONFIG 0x5453 | |
80 | #define TIOCSERGWILD 0x5454 | |
81 | --- a/arch/s390/include/asm/ioctls.h | |
82 | +++ b/arch/s390/include/asm/ioctls.h | |
83 | @@ -60,6 +60,7 @@ | |
2bbfcb0c ER |
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 */ | |
86 | +#define TIOCGDEV _IOR('T',0x32, unsigned int) /* Get real dev no below /dev/console */ | |
e41d9317 | 87 | #define TIOCSIG _IOW('T',0x36, int) /* Generate signal on Pty slave */ |
2bbfcb0c ER |
88 | |
89 | #define FIONCLEX 0x5450 /* these numbers need to be adjusted. */ | |
90 | #define FIOCLEX 0x5451 | |
91 | --- a/arch/sh/include/asm/ioctls.h | |
92 | +++ b/arch/sh/include/asm/ioctls.h | |
93 | @@ -84,6 +84,7 @@ | |
2bbfcb0c ER |
94 | #define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */ |
95 | #define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */ | |
96 | +#define TIOCGDEV _IOR('T',0x32, unsigned int) /* Get real dev no below /dev/console */ | |
e41d9317 | 97 | #define TIOCSIG _IOW('T',0x36, int) /* Generate signal on Pty slave */ |
2bbfcb0c ER |
98 | |
99 | #define TIOCSERCONFIG _IO('T', 83) /* 0x5453 */ | |
100 | #define TIOCSERGWILD _IOR('T', 84, int) /* 0x5454 */ | |
101 | --- a/arch/sparc/include/asm/ioctls.h | |
102 | +++ b/arch/sparc/include/asm/ioctls.h | |
e41d9317 AM |
103 | @@ -80,6 +80,7 @@ |
104 | /* Get minor device of a pty master's FD -- Solaris equiv is ISPTM */ | |
105 | #define TIOCGPTN _IOR('t', 134, unsigned int) /* Get Pty Number */ | |
106 | #define TIOCSPTLCK _IOW('t', 135, int) /* Lock/unlock PTY */ | |
2bbfcb0c | 107 | +#define TIOCGDEV _IOR('T',0x32, unsigned int) /* Get real dev no below /dev/console */ |
e41d9317 | 108 | #define TIOCSIG _IOW('t', 136, int) /* Generate signal on Pty slave */ |
2bbfcb0c | 109 | |
e41d9317 | 110 | /* Little f */ |
10c31d41 ER |
111 | --- linux-2.6.34/include/asm-generic/ioctls.h~ 2010-05-17 00:17:36.000000000 +0300 |
112 | +++ linux-2.6.34/include/asm-generic/ioctls.h 2010-08-30 21:26:52.231452290 +0300 | |
113 | @@ -65,6 +65,7 @@ | |
114 | #define TIOCSRS485 0x542F | |
115 | #define TIOCGPTN _IOR('T', 0x30, unsigned int) /* Get Pty Number (of pty-mux device) */ | |
2bbfcb0c ER |
116 | #define TIOCSPTLCK _IOW('T', 0x31, int) /* Lock/unlock Pty */ |
117 | +#define TIOCGDEV _IOR('T', 0x32, unsigned int) /* Get real dev no below /dev/console */ | |
118 | #define TCGETX 0x5432 /* SYS5 TCGETX compatibility */ | |
119 | #define TCSETX 0x5433 | |
120 | #define TCSETXF 0x5434 | |
121 | --- a/drivers/char/tty_io.c | |
122 | +++ b/drivers/char/tty_io.c | |
123 | @@ -2507,6 +2507,21 @@ long tty_ioctl(struct file *file, unsign | |
124 | case TIOCSETD: | |
125 | return tiocsetd(tty, p); | |
126 | /* | |
127 | + * Without the real device to which /dev/console is connected, | |
128 | + * blogd can not work. | |
129 | + * blogd spawns a pty/tty pair, | |
130 | + * set /dev/console to the tty of that pair (ioctl TIOCCONS), | |
131 | + * then reads in all input from the current /dev/console, | |
132 | + * buffer or write the readed data to /var/log/boot.msg | |
133 | + * _and_ to the original real device. | |
134 | + */ | |
135 | + case TIOCGDEV: | |
136 | + { | |
137 | + unsigned int ret = new_encode_dev(tty_devnum(real_tty)); | |
138 | + return put_user(ret, (unsigned int __user *)p); | |
139 | + } | |
140 | + | |
141 | + /* | |
142 | * Break handling | |
143 | */ | |
144 | case TIOCSBRK: /* Turn break on, unconditionally */ | |
145 | --- a/fs/compat_ioctl.c | |
146 | +++ b/fs/compat_ioctl.c | |
147 | @@ -1866,6 +1866,7 @@ COMPATIBLE_IOCTL(TCSETSW) | |
148 | COMPATIBLE_IOCTL(TCSETSF) | |
149 | COMPATIBLE_IOCTL(TIOCLINUX) | |
150 | COMPATIBLE_IOCTL(TIOCSBRK) | |
151 | +COMPATIBLE_IOCTL(TIOCGDEV) | |
152 | COMPATIBLE_IOCTL(TIOCCBRK) | |
153 | ULONG_IOCTL(TIOCMIWAIT) | |
154 | COMPATIBLE_IOCTL(TIOCGICOUNT) |