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/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(+)
20 --- a/arch/alpha/include/asm/ioctls.h
21 +++ b/arch/alpha/include/asm/ioctls.h
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 */
26 #define TIOCSIG _IOW('T',0x36, int) /* Generate signal on Pty slave */
28 #define TIOCSERCONFIG 0x5453
29 #define TIOCSERGWILD 0x5454
30 --- a/arch/mips/include/asm/ioctls.h
31 +++ b/arch/mips/include/asm/ioctls.h
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 */
36 #define TIOCSIG _IOW('T', 0x36, int) /* Generate signal on Pty slave */
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
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 */
46 #define TIOCSIG _IOW('T',0x36, int) /* Generate signal on Pty slave */
48 #define TIOCSERCONFIG 0x5453
49 #define TIOCSERGWILD 0x5454
50 --- a/arch/sh/include/asm/ioctls.h
51 +++ b/arch/sh/include/asm/ioctls.h
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 */
56 #define TIOCSIG _IOW('T',0x36, int) /* Generate signal on Pty slave */
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
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 */
66 +#define TIOCGDEV _IOR('T',0x32, unsigned int) /* Get real dev no below /dev/console */
67 #define TIOCSIG _IOW('t', 136, int) /* Generate signal on Pty slave */
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
73 #define TIOCSRS485 0x542F
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 */
77 #define TCGETX 0x5432 /* SYS5 TCGETX compatibility */
79 #define TCSETXF 0x5434
80 --- a/drivers/tty/tty_io.c
81 +++ b/drivers/tty/tty_io.c
82 @@ -2507,6 +2507,21 @@ long tty_ioctl(struct file *file, unsign
84 return tiocsetd(tty, p);
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.
96 + unsigned int ret = new_encode_dev(tty_devnum(real_tty));
97 + return put_user(ret, (unsigned int __user *)p);
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)