]> git.pld-linux.org Git - packages/kernel.git/blob - kernel-TIOCGDEV.patch
- xen0/xenU todo entry (compile failure)
[packages/kernel.git] / kernel-TIOCGDEV.patch
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  drivers/char/tty_io.c        |   15 +++++++++++++++
8  include/asm-alpha/ioctls.h   |    1 +
9  include/asm-arm/ioctls.h     |    1 +
10  include/asm-i386/ioctls.h    |    1 +
11  include/asm-ia64/ioctls.h    |    1 +
12  include/asm-m68k/ioctls.h    |    1 +
13  include/asm-mips/ioctls.h    |    1 +
14  include/asm-powerpc/ioctls.h |    1 +
15  include/asm-s390/ioctls.h    |    1 +
16  include/asm-sh/ioctls.h      |    1 +
17  include/asm-sparc/ioctls.h   |    1 +
18  include/asm-sparc64/ioctls.h |    1 +
19  include/asm-x86_64/ioctls.h  |    1 +
20  include/linux/compat_ioctl.h |    1 +
21  14 files changed, 28 insertions(+)
22
23 --- linux-2.6.18.orig/drivers/char/tty_io.c
24 +++ linux-2.6.18/drivers/char/tty_io.c
25 @@ -3265,6 +3265,21 @@ int tty_ioctl(struct inode * inode, stru
26                 case TIOCMBIC:
27                 case TIOCMBIS:
28                         return tty_tiocmset(tty, file, cmd, p);
29 +               /*
30 +                * Without the real device to which /dev/console is connected,
31 +                * blogd can not work.
32 +                *      blogd spawns a pty/tty pair,
33 +                *      set /dev/console to the tty of that pair (ioctl TIOCCONS),
34 +                *      then reads in all input from the current /dev/console,
35 +                *      buffer or write the readed data to /var/log/boot.msg
36 +                *      _and_ to the original real device.
37 +                */
38 +               case TIOCGDEV:
39 +               {
40 +                       unsigned int ret = new_encode_dev(tty_devnum(real_tty));
41 +                       return put_user(ret, (unsigned int __user *)p);
42 +               }
43 +
44         }
45         if (tty->driver->ioctl) {
46                 retval = (tty->driver->ioctl)(tty, file, cmd, arg);
47 --- linux-2.6.18.orig/include/asm-alpha/ioctls.h
48 +++ linux-2.6.18/include/asm-alpha/ioctls.h
49 @@ -91,6 +91,7 @@
50  #define TIOCGSID       0x5429  /* Return the session ID of FD */
51  #define TIOCGPTN       _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
52  #define TIOCSPTLCK     _IOW('T',0x31, int)  /* Lock/unlock Pty */
53 +#define TIOCGDEV       _IOR('T',0x32, unsigned int) /* Get real dev no below /dev/console */
54  
55  #define TIOCSERCONFIG  0x5453
56  #define TIOCSERGWILD   0x5454
57 --- linux-2.6.18.orig/include/asm-arm/ioctls.h
58 +++ linux-2.6.18/include/asm-arm/ioctls.h
59 @@ -48,6 +48,7 @@
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 */
64  
65  #define FIONCLEX       0x5450  /* these numbers need to be adjusted. */
66  #define FIOCLEX                0x5451
67 --- linux-2.6.18.orig/include/asm-i386/ioctls.h
68 +++ linux-2.6.18/include/asm-i386/ioctls.h
69 @@ -49,6 +49,7 @@
70  #define TIOCGSID       0x5429  /* Return the session ID of FD */
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 */
74  
75  #define FIONCLEX       0x5450
76  #define FIOCLEX                0x5451
77 --- linux-2.6.18.orig/include/asm-ia64/ioctls.h
78 +++ linux-2.6.18/include/asm-ia64/ioctls.h
79 @@ -55,6 +55,7 @@
80  #define TIOCGSID       0x5429  /* Return the session ID of FD */
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 */
84  
85  #define FIONCLEX       0x5450  /* these numbers need to be adjusted. */
86  #define FIOCLEX                0x5451
87 --- linux-2.6.18.orig/include/asm-m68k/ioctls.h
88 +++ linux-2.6.18/include/asm-m68k/ioctls.h
89 @@ -48,6 +48,7 @@
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 */
94  
95  #define FIONCLEX       0x5450  /* these numbers need to be adjusted. */
96  #define FIOCLEX                0x5451
97 --- linux-2.6.18.orig/include/asm-mips/ioctls.h
98 +++ linux-2.6.18/include/asm-mips/ioctls.h
99 @@ -79,6 +79,7 @@
100  #define TIOCGSID       0x7416  /* 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 */
104  
105  /* I hope the range from 0x5480 on is free ... */
106  #define TIOCSCTTY      0x5480          /* become controlling tty */
107 --- linux-2.6.18.orig/include/asm-powerpc/ioctls.h
108 +++ linux-2.6.18/include/asm-powerpc/ioctls.h
109 @@ -91,6 +91,7 @@
110  #define TIOCGSID       0x5429  /* 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 */
114  
115  #define TIOCSERCONFIG  0x5453
116  #define TIOCSERGWILD   0x5454
117 --- linux-2.6.18.orig/include/asm-s390/ioctls.h
118 +++ linux-2.6.18/include/asm-s390/ioctls.h
119 @@ -56,6 +56,7 @@
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 */
124  
125  #define FIONCLEX       0x5450  /* these numbers need to be adjusted. */
126  #define FIOCLEX                0x5451
127 --- linux-2.6.18.orig/include/asm-sh/ioctls.h
128 +++ linux-2.6.18/include/asm-sh/ioctls.h
129 @@ -80,6 +80,7 @@
130  #define TIOCGSID       _IOR('T', 41, pid_t) /* 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 */
134  
135  #define TIOCSERCONFIG  _IO('T', 83) /* 0x5453 */
136  #define TIOCSERGWILD   _IOR('T', 84,  int) /* 0x5454 */
137 --- linux-2.6.18.orig/include/asm-sparc/ioctls.h
138 +++ linux-2.6.18/include/asm-sparc/ioctls.h
139 @@ -15,6 +15,7 @@
140  #define TCSETS         _IOW('T', 9, struct termios)
141  #define TCSETSW                _IOW('T', 10, struct termios)
142  #define TCSETSF                _IOW('T', 11, struct termios)
143 +#define TIOCGDEV       _IOR('T',0x32, unsigned int) /* Get real dev no below /dev/console */
144  
145  /* Note that all the ioctls that are not available in Linux have a 
146   * double underscore on the front to: a) avoid some programs to
147 --- linux-2.6.18.orig/include/asm-sparc64/ioctls.h
148 +++ linux-2.6.18/include/asm-sparc64/ioctls.h
149 @@ -16,6 +16,7 @@
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 */
154  
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 --- linux-2.6.18.orig/include/asm-x86_64/ioctls.h
158 +++ linux-2.6.18/include/asm-x86_64/ioctls.h
159 @@ -48,6 +48,7 @@
160  #define TIOCGSID       0x5429  /* Return the session ID of FD */
161  #define TIOCGPTN       _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
162  #define TIOCSPTLCK     _IOW('T',0x31, int)  /* Lock/unlock Pty */
163 +#define TIOCGDEV       _IOR('T',0x32, unsigned int) /* Get real dev no below /dev/console */
164  
165  #define FIONCLEX       0x5450  /* these numbers need to be adjusted. */
166  #define FIOCLEX                0x5451
167 --- linux-2.6.18.orig/include/linux/compat_ioctl.h
168 +++ linux-2.6.18/include/linux/compat_ioctl.h
169 @@ -21,6 +21,7 @@ COMPATIBLE_IOCTL(TCSETSW)
170  COMPATIBLE_IOCTL(TCSETSF)
171  COMPATIBLE_IOCTL(TIOCLINUX)
172  COMPATIBLE_IOCTL(TIOCSBRK)
173 +COMPATIBLE_IOCTL(TIOCGDEV)
174  COMPATIBLE_IOCTL(TIOCCBRK)
175  ULONG_IOCTL(TIOCMIWAIT)
176  COMPATIBLE_IOCTL(TIOCGICOUNT)
This page took 0.036836 seconds and 3 git commands to generate.