]>
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 + | |
2bbfcb0c ER |
8 | arch/ia64/include/asm/ioctls.h | 1 + |
9 | arch/m68k/include/asm/ioctls.h | 1 + | |
10 | arch/mips/include/asm/ioctls.h | 1 + | |
11 | arch/powerpc/include/asm/ioctls.h | 1 + | |
12 | arch/s390/include/asm/ioctls.h | 1 + | |
13 | arch/sh/include/asm/ioctls.h | 1 + | |
14 | arch/sparc/include/asm/ioctls.h | 1 + | |
15 | arch/x86/include/asm/ioctls.h | 1 + | |
16 | drivers/char/tty_io.c | 15 +++++++++++++++ | |
17 | fs/compat_ioctl.c | 1 + | |
18 | 12 files changed, 26 insertions(+) | |
19 | ||
20 | --- a/arch/alpha/include/asm/ioctls.h | |
21 | +++ b/arch/alpha/include/asm/ioctls.h | |
22 | @@ -91,6 +91,7 @@ | |
2bbfcb0c ER |
23 | #define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */ |
24 | #define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */ | |
25 | +#define TIOCGDEV _IOR('T',0x32, unsigned int) /* Get real dev no below /dev/console */ | |
e41d9317 | 26 | #define TIOCSIG _IOW('T',0x36, int) /* Generate signal on Pty slave */ |
2bbfcb0c ER |
27 | |
28 | #define TIOCSERCONFIG 0x5453 | |
29 | #define TIOCSERGWILD 0x5454 | |
2bbfcb0c ER |
30 | --- a/arch/mips/include/asm/ioctls.h |
31 | +++ b/arch/mips/include/asm/ioctls.h | |
32 | @@ -83,6 +83,7 @@ | |
2bbfcb0c ER |
33 | #define TIOCGPTN _IOR('T', 0x30, unsigned int) /* Get Pty Number (of pty-mux device) */ |
34 | #define TIOCSPTLCK _IOW('T', 0x31, int) /* Lock/unlock Pty */ | |
35 | +#define TIOCGDEV _IOR('T', 0x32, unsigned int) /* Get real dev no below /dev/console */ | |
e41d9317 | 36 | #define TIOCSIG _IOW('T', 0x36, int) /* Generate signal on Pty slave */ |
2bbfcb0c ER |
37 | |
38 | /* I hope the range from 0x5480 on is free ... */ | |
39 | #define TIOCSCTTY 0x5480 /* become controlling tty */ | |
40 | --- a/arch/powerpc/include/asm/ioctls.h | |
41 | +++ b/arch/powerpc/include/asm/ioctls.h | |
42 | @@ -93,6 +93,7 @@ | |
2bbfcb0c ER |
43 | #define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */ |
44 | #define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */ | |
45 | +#define TIOCGDEV _IOR('T',0x32, unsigned int) /* Get real dev no below /dev/console */ | |
e41d9317 | 46 | #define TIOCSIG _IOW('T',0x36, int) /* Generate signal on Pty slave */ |
2bbfcb0c ER |
47 | |
48 | #define TIOCSERCONFIG 0x5453 | |
49 | #define TIOCSERGWILD 0x5454 | |
2bbfcb0c ER |
50 | --- a/arch/sh/include/asm/ioctls.h |
51 | +++ b/arch/sh/include/asm/ioctls.h | |
52 | @@ -84,6 +84,7 @@ | |
2bbfcb0c ER |
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 */ | |
55 | +#define TIOCGDEV _IOR('T',0x32, unsigned int) /* Get real dev no below /dev/console */ | |
e41d9317 | 56 | #define TIOCSIG _IOW('T',0x36, int) /* Generate signal on Pty slave */ |
2bbfcb0c ER |
57 | |
58 | #define TIOCSERCONFIG _IO('T', 83) /* 0x5453 */ | |
59 | #define TIOCSERGWILD _IOR('T', 84, int) /* 0x5454 */ | |
60 | --- a/arch/sparc/include/asm/ioctls.h | |
61 | +++ b/arch/sparc/include/asm/ioctls.h | |
e41d9317 AM |
62 | @@ -80,6 +80,7 @@ |
63 | /* Get minor device of a pty master's FD -- Solaris equiv is ISPTM */ | |
64 | #define TIOCGPTN _IOR('t', 134, unsigned int) /* Get Pty Number */ | |
65 | #define TIOCSPTLCK _IOW('t', 135, int) /* Lock/unlock PTY */ | |
2bbfcb0c | 66 | +#define TIOCGDEV _IOR('T',0x32, unsigned int) /* Get real dev no below /dev/console */ |
e41d9317 | 67 | #define TIOCSIG _IOW('t', 136, int) /* Generate signal on Pty slave */ |
2bbfcb0c | 68 | |
e41d9317 | 69 | /* Little f */ |
10c31d41 ER |
70 | --- linux-2.6.34/include/asm-generic/ioctls.h~ 2010-05-17 00:17:36.000000000 +0300 |
71 | +++ linux-2.6.34/include/asm-generic/ioctls.h 2010-08-30 21:26:52.231452290 +0300 | |
72 | @@ -65,6 +65,7 @@ | |
73 | #define TIOCSRS485 0x542F | |
74 | #define TIOCGPTN _IOR('T', 0x30, unsigned int) /* Get Pty Number (of pty-mux device) */ | |
2bbfcb0c ER |
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 */ | |
77 | #define TCGETX 0x5432 /* SYS5 TCGETX compatibility */ | |
78 | #define TCSETX 0x5433 | |
79 | #define TCSETXF 0x5434 | |
48ead238 AM |
80 | --- a/drivers/tty/tty_io.c |
81 | +++ b/drivers/tty/tty_io.c | |
2bbfcb0c ER |
82 | @@ -2507,6 +2507,21 @@ long tty_ioctl(struct file *file, unsign |
83 | case TIOCSETD: | |
84 | return tiocsetd(tty, p); | |
85 | /* | |
86 | + * Without the real device to which /dev/console is connected, | |
87 | + * blogd can not work. | |
88 | + * blogd spawns a pty/tty pair, | |
89 | + * set /dev/console to the tty of that pair (ioctl TIOCCONS), | |
90 | + * then reads in all input from the current /dev/console, | |
91 | + * buffer or write the readed data to /var/log/boot.msg | |
92 | + * _and_ to the original real device. | |
93 | + */ | |
94 | + case TIOCGDEV: | |
95 | + { | |
96 | + unsigned int ret = new_encode_dev(tty_devnum(real_tty)); | |
97 | + return put_user(ret, (unsigned int __user *)p); | |
98 | + } | |
99 | + | |
100 | + /* | |
101 | * Break handling | |
102 | */ | |
103 | case TIOCSBRK: /* Turn break on, unconditionally */ | |
104 | --- a/fs/compat_ioctl.c | |
105 | +++ b/fs/compat_ioctl.c | |
106 | @@ -1866,6 +1866,7 @@ COMPATIBLE_IOCTL(TCSETSW) | |
107 | COMPATIBLE_IOCTL(TCSETSF) | |
108 | COMPATIBLE_IOCTL(TIOCLINUX) | |
109 | COMPATIBLE_IOCTL(TIOCSBRK) | |
110 | +COMPATIBLE_IOCTL(TIOCGDEV) | |
111 | COMPATIBLE_IOCTL(TIOCCBRK) | |
112 | ULONG_IOCTL(TIOCMIWAIT) | |
113 | COMPATIBLE_IOCTL(TIOCGICOUNT) |