]>
Commit | Line | Data |
---|---|---|
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/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(+) | |
20 | ||
21 | --- a/arch/alpha/include/asm/ioctls.h | |
22 | +++ b/arch/alpha/include/asm/ioctls.h | |
23 | @@ -91,6 +91,7 @@ | |
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 */ | |
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 @@ | |
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 */ | |
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 @@ | |
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 */ | |
48 | ||
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 | |
53 | @@ -91,6 +91,7 @@ | |
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 */ | |
58 | ||
59 | #define TIOCSERCONFIG 0x5453 | |
60 | #define TIOCSERGWILD 0x5454 | |
61 | --- a/arch/s390/include/asm/ioctls.h | |
62 | +++ b/arch/s390/include/asm/ioctls.h | |
63 | @@ -60,6 +60,7 @@ | |
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 */ | |
68 | ||
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 | |
73 | @@ -84,6 +84,7 @@ | |
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 */ | |
78 | ||
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 | |
83 | @@ -19,6 +19,7 @@ | |
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 */ | |
88 | ||
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); | |
95 | #endif | |
96 | /* | |
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. | |
104 | + */ | |
105 | + case TIOCGDEV: | |
106 | + { | |
107 | + unsigned int ret = new_encode_dev(tty_devnum(real_tty)); | |
108 | + return put_user(ret, (unsigned int __user *)p); | |
109 | + } | |
110 | + | |
111 | + /* | |
112 | * Break handling | |
113 | */ | |
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 | |
127 | @@ -52,6 +52,7 @@ | |
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 */ | |
132 | ||
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 | |
137 | @@ -83,6 +83,7 @@ | |
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 */ | |
142 | ||
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 | |
147 | @@ -54,6 +54,7 @@ | |
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 */ | |
152 | ||
153 | #define FIONCLEX 0x5450 | |
154 | #define FIOCLEX 0x5451 |