2002-11-19 11:27:10

by Margit Schubert-While

[permalink] [raw]
Subject: Linux 2.4.19 patch for Suse compatibility

Hi,
Below is a patch to include an ioctl that Suse kernels use
at bootup. (Against vanilla 2.4.19)
Comments ? Can it be included in 2.4.20(-rc*) ?

Margit

diff -ur /tmp/linux-2.4.19/include/asm-alpha/ioctls.h
/usr/src/linux/include/asm-alpha/ioctls.h
--- /tmp/linux-2.4.19/include/asm-alpha/ioctls.h 2001-04-14
05:26:07.000000000 +0200
+++ /usr/src/linux/include/asm-alpha/ioctls.h 2002-11-14
10:06:16.000000000 +0100
@@ -91,6 +92,7 @@
#define TIOCGSID 0x5429 /* Return the session ID of FD */
#define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of
pty-mux device) */
#define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */
+#define TIOCGDEV _IOR('T',0x32, unsigned int) /* Get real dev no
below /dev/console */

#define TIOCSERCONFIG 0x5453
#define TIOCSERGWILD 0x5454
diff -ur /tmp/linux-2.4.19/include/asm-arm/ioctls.h
/usr/src/linux/include/asm-arm/ioctls.h
--- /tmp/linux-2.4.19/include/asm-arm/ioctls.h 2001-02-09
01:32:44.000000000 +0100
+++ /usr/src/linux/include/asm-arm/ioctls.h 2002-11-14
10:06:16.000000000 +0100
@@ -49,6 +49,7 @@
#define TIOCGSID 0x5429 /* Return the session ID of FD */
#define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of
pty-mux device) */
#define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */
+#define TIOCGDEV _IOR('T',0x32, unsigned int) /* Get real dev no
below /dev/console */

#define FIONCLEX 0x5450 /* these numbers need to be adjusted. */
#define FIOCLEX 0x5451
diff -ur /tmp/linux-2.4.19/include/asm-i386/ioctls.h
/usr/src/linux/include/asm-i386/ioctls.h
--- /tmp/linux-2.4.19/include/asm-i386/ioctls.h 2002-08-03
02:39:45.000000000 +0200
+++ /usr/src/linux/include/asm-i386/ioctls.h 2002-11-14
10:06:16.000000000 +0100
@@ -49,6 +49,7 @@
#define TIOCGSID 0x5429 /* Return the session ID of FD */
#define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of
pty-mux device) */
#define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */
+#define TIOCGDEV _IOR('T',0x32, unsigned int) /* Get real dev no
below /dev/console */

#define FIONCLEX 0x5450 /* these numbers need to be adjusted. */
#define FIOCLEX 0x5451
diff -ur /tmp/linux-2.4.19/include/asm-ia64/ioctls.h
/usr/src/linux/include/asm-ia64/ioctls.h
--- /tmp/linux-2.4.19/include/asm-ia64/ioctls.h 2000-02-07
03:42:40.000000000 +0100
+++ /usr/src/linux/include/asm-ia64/ioctls.h 2002-11-14
10:06:16.000000000 +0100
@@ -54,6 +54,7 @@
#define TIOCGSID 0x5429 /* Return the session ID of FD */
#define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of
pty-mux device) */
#define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */
+#define TIOCGDEV _IOR('T',0x32, unsigned int) /* Get real dev no
below /dev/console */

#define FIONCLEX 0x5450 /* these numbers need to be adjusted. */
#define FIOCLEX 0x5451
diff -ur /tmp/linux-2.4.19/include/asm-m68k/ioctls.h
/usr/src/linux/include/asm-m68k/ioctls.h
--- /tmp/linux-2.4.19/include/asm-m68k/ioctls.h 1998-02-13
01:25:04.000000000 +0100
+++ /usr/src/linux/include/asm-m68k/ioctls.h 2002-11-14
10:06:16.000000000 +0100
@@ -49,6 +49,7 @@
#define TIOCGSID 0x5429 /* Return the session ID of FD */
#define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of
pty-mux device) */
#define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */
+#define TIOCGDEV _IOR('T',0x32, unsigned int) /* Get real dev no
below /dev/console */

#define FIONCLEX 0x5450 /* these numbers need to be adjusted. */
#define FIOCLEX 0x5451
diff -ur /tmp/linux-2.4.19/include/asm-mips/ioctls.h
/usr/src/linux/include/asm-mips/ioctls.h
--- /tmp/linux-2.4.19/include/asm-mips/ioctls.h 2001-09-09
19:43:01.000000000 +0200
+++ /usr/src/linux/include/asm-mips/ioctls.h 2002-11-14
10:06:16.000000000 +0100
@@ -89,6 +89,7 @@
#define TIOCGSID 0x7416 /* Return the session ID of FD */
#define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of
pty-mux device) */
#define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */
+#define TIOCGDEV _IOR('T',0x32, unsigned int) /* Get real dev no
below /dev/console */

#define TIOCSERCONFIG 0x5488
#define TIOCSERGWILD 0x5489
diff -ur /tmp/linux-2.4.19/include/asm-mips64/ioctls.h
/usr/src/linux/include/asm-mips64/ioctls.h
--- /tmp/linux-2.4.19/include/asm-mips64/ioctls.h 2001-09-09
19:43:02.000000000 +0200
+++ /usr/src/linux/include/asm-mips64/ioctls.h 2002-11-14
10:06:16.000000000 +0100
@@ -89,6 +89,7 @@
#define TIOCGSID 0x7416 /* Return the session ID of FD */
#define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of
pty-mux device) */
#define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */
+#define TIOCGDEV _IOR('T',0x32, unsigned int) /* Get real dev no
below /dev/console */

#define TIOCSERCONFIG 0x5488
#define TIOCSERGWILD 0x5489
diff -ur /tmp/linux-2.4.19/include/asm-ppc/ioctls.h
/usr/src/linux/include/asm-ppc/ioctls.h
--- /tmp/linux-2.4.19/include/asm-ppc/ioctls.h 2001-05-22
00:02:06.000000000 +0200
+++ /usr/src/linux/include/asm-ppc/ioctls.h 2002-11-14
10:06:16.000000000 +0100
@@ -92,6 +92,7 @@
#define TIOCGSID 0x5429 /* Return the session ID of FD */
#define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of
pty-mux device) */
#define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */
+#define TIOCGDEV _IOR('T',0x32, unsigned int) /* Get real dev no
below /dev/console */

#define TIOCSERCONFIG 0x5453
#define TIOCSERGWILD 0x5454
diff -ur /tmp/linux-2.4.19/include/asm-ppc64/ioctls.h
/usr/src/linux/include/asm-ppc64/ioctls.h
--- /tmp/linux-2.4.19/include/asm-ppc64/ioctls.h 2002-08-03
02:39:45.000000000 +0200
+++ /usr/src/linux/include/asm-ppc64/ioctls.h 2002-11-14
10:06:16.000000000 +0100
@@ -96,6 +96,7 @@
#define TIOCGSID 0x5429 /* Return the session ID of FD */
#define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of
pty-mux device) */
#define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */
+#define TIOCGDEV _IOR('T',0x32, unsigned int) /* Get real dev no
below /dev/console */

#define TIOCSERCONFIG 0x5453
#define TIOCSERGWILD 0x5454
diff -ur /tmp/linux-2.4.19/include/asm-s390/ioctls.h
/usr/src/linux/include/asm-s390/ioctls.h
--- /tmp/linux-2.4.19/include/asm-s390/ioctls.h 2001-02-13
23:13:44.000000000 +0100
+++ /usr/src/linux/include/asm-s390/ioctls.h 2002-11-14
10:06:16.000000000 +0100
@@ -57,6 +57,7 @@
#define TIOCGSID 0x5429 /* Return the session ID of FD */
#define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of
pty-mux device) */
#define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */
+#define TIOCGDEV _IOR('T',0x32, unsigned int) /* Get real dev no
below /dev/console */

#define FIONCLEX 0x5450 /* these numbers need to be adjusted. */
#define FIOCLEX 0x5451
diff -ur /tmp/linux-2.4.19/include/asm-s390x/ioctls.h
/usr/src/linux/include/asm-s390x/ioctls.h
--- /tmp/linux-2.4.19/include/asm-s390x/ioctls.h 2001-02-13
23:13:44.000000000 +0100
+++ /usr/src/linux/include/asm-s390x/ioctls.h 2002-11-14
10:06:16.000000000 +0100
@@ -57,6 +57,7 @@
#define TIOCGSID 0x5429 /* Return the session ID of FD */
#define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of
pty-mux device) */
#define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */
+#define TIOCGDEV _IOR('T',0x32, unsigned int) /* Get real dev no
below /dev/console */

#define FIONCLEX 0x5450 /* these numbers need to be adjusted. */
#define FIOCLEX 0x5451
diff -ur /tmp/linux-2.4.19/include/asm-sh/ioctls.h
/usr/src/linux/include/asm-sh/ioctls.h
--- /tmp/linux-2.4.19/include/asm-sh/ioctls.h 1999-11-06
19:40:31.000000000 +0100
+++ /usr/src/linux/include/asm-sh/ioctls.h 2002-11-14
10:06:16.000000000 +0100
@@ -80,6 +81,7 @@
#define TIOCGSID _IOR('T', 41, pid_t) /* 0x5429 */ /* Return the
session ID of FD */
#define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of
pty-mux device) */
#define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */
+#define TIOCGDEV _IOR('T',0x32, unsigned int) /* Get real dev no
below /dev/console */

#define TIOCSERCONFIG _IO('T', 83) /* 0x5453 */
#define TIOCSERGWILD _IOR('T', 84, int) /* 0x5454 */
diff -ur /tmp/linux-2.4.19/include/asm-sparc/ioctls.h
/usr/src/linux/include/asm-sparc/ioctls.h
--- /tmp/linux-2.4.19/include/asm-sparc/ioctls.h 2002-08-03
02:39:45.000000000 +0200
+++ /usr/src/linux/include/asm-sparc/ioctls.h 2002-11-14
10:06:16.000000000 +0100
@@ -99,6 +100,7 @@
#define TIOCSSERIAL 0x541F
#define TCSBRKP 0x5425
#define TIOCTTYGSTRUCT 0x5426
+#define TIOCGDEV _IOR('T',0x32, unsigned int) /* Get real dev no
below /dev/console */
#define TIOCSERCONFIG 0x5453
#define TIOCSERGWILD 0x5454
#define TIOCSERSWILD 0x5455
diff -ur /tmp/linux-2.4.19/include/asm-sparc64/ioctls.h
/usr/src/linux/include/asm-sparc64/ioctls.h
--- /tmp/linux-2.4.19/include/asm-sparc64/ioctls.h 2002-08-03
02:39:45.000000000 +0200
+++ /usr/src/linux/include/asm-sparc64/ioctls.h 2002-11-14
10:06:16.000000000 +0100
@@ -100,6 +101,7 @@
#define TIOCSSERIAL 0x541F
#define TCSBRKP 0x5425
#define TIOCTTYGSTRUCT 0x5426
+#define TIOCGDEV _IOR('T',0x32, unsigned int) /* Get real dev no
below /dev/console */
#define TIOCSERCONFIG 0x5453
#define TIOCSERGWILD 0x5454
#define TIOCSERSWILD 0x5455
diff -u /tmp/linux-2.4.19/drivers/char/tty_io.c
/usr/src/linux/drivers/char/tty_io.c
--- /tmp/linux-2.4.19/drivers/char/tty_io.c 2002-08-03
02:39:43.000000000 +0200
+++ /usr/src/linux/drivers/char/tty_io.c 2002-11-14
10:06:34.000000000 +0100
@@ -1765,7 +1806,8 @@
#endif
case TIOCTTYGSTRUCT:
return tiocttygstruct(tty, (struct tty_struct *) arg);
-
+ case TIOCGDEV:
+ return put_user (kdev_t_to_nr (real_tty->device),
(unsigned int*) arg);
/*
* Break handling
*/


2002-11-19 12:20:07

by Alan

[permalink] [raw]
Subject: Re: Linux 2.4.19 patch for Suse compatibility

On Tue, 2002-11-19 at 11:34, Margit Schubert-While wrote:
> Hi,
> Below is a patch to include an ioctl that Suse kernels use
> at bootup. (Against vanilla 2.4.19)
> Comments ? Can it be included in 2.4.20(-rc*) ?

This was discussed on the kernel list about four to six weeks ago and
rejected then as well. See the previous discussion

2002-11-19 12:41:23

by Andi Kleen

[permalink] [raw]
Subject: Re: Linux 2.4.19 patch for Suse compatibility

Alan Cox <[email protected]> writes:

> On Tue, 2002-11-19 at 11:34, Margit Schubert-While wrote:
> > Hi,
> > Below is a patch to include an ioctl that Suse kernels use
> > at bootup. (Against vanilla 2.4.19)
> > Comments ? Can it be included in 2.4.20(-rc*) ?
>
> This was discussed on the kernel list about four to six weeks ago and
> rejected then as well. See the previous discussion

Actually I don't remember it being rejected, just the discussion dropped off and there was
no suggestion on how to solve the problem this ioctl solves in a better way.

The jury is still out on that one.

-Andi

2002-11-19 13:28:18

by Rik van Riel

[permalink] [raw]
Subject: Re: Linux 2.4.19 patch for Suse compatibility

On 19 Nov 2002, Andi Kleen wrote:
> Alan Cox <[email protected]> writes:

> > This was discussed on the kernel list about four to six weeks ago and
> > rejected then as well. See the previous discussion
>
> Actually I don't remember it being rejected, just the discussion dropped
> off and there was no suggestion on how to solve the problem this ioctl
> solves in a better way.

So, what problem does it try to solve ?

Rik
--
A: No.
Q: Should I include quotations after my reply?

http://www.surriel.com/ http://distro.conectiva.com/

2002-11-19 14:05:57

by Andi Kleen

[permalink] [raw]
Subject: Re: Linux 2.4.19 patch for Suse compatibility

On Tue, Nov 19, 2002 at 11:32:45AM -0200, Rik van Riel wrote:
> On 19 Nov 2002, Andi Kleen wrote:
> > Alan Cox <[email protected]> writes:
>
> > > This was discussed on the kernel list about four to six weeks ago and
> > > rejected then as well. See the previous discussion
> >
> > Actually I don't remember it being rejected, just the discussion dropped
> > off and there was no suggestion on how to solve the problem this ioctl
> > solves in a better way.
>
> So, what problem does it try to solve ?

The output of all the startup scripts is logged by a special daemon to
a log file (blogd). It does this by redirecting /dev/console.

For it to be able to still output something to the screen and later
resetting the console it needs to know the output device that
/dev/console maps to. The ioctl returns it.

There is actually a fallback path that tries to discover the underlying
device when the ioctl is not there, but it is far too ugly to describe
and also has some problems.

-Andi

2002-11-19 14:41:37

by Andrea Arcangeli

[permalink] [raw]
Subject: Re: Linux 2.4.19 patch for Suse compatibility

On Tue, Nov 19, 2002 at 11:32:45AM -0200, Rik van Riel wrote:
> On 19 Nov 2002, Andi Kleen wrote:
> > Alan Cox <[email protected]> writes:
>
> > > This was discussed on the kernel list about four to six weeks ago and
> > > rejected then as well. See the previous discussion
> >
> > Actually I don't remember it being rejected, just the discussion dropped
> > off and there was no suggestion on how to solve the problem this ioctl
> > solves in a better way.
>
> So, what problem does it try to solve ?

how can you find the real device behind /dev/console without such ioctl?
An userspace hack watching /proc/cmdline wouldn't be reliable.

Andrea