00_tiocgdev
diff -up linux-2.4.26/arch/ppc64/kernel/ioctl32.c linux/arch/ppc64/kernel/ioctl32.c
--- linux-2.4.26/arch/ppc64/kernel/ioctl32.c	2004-04-21 13:44:35.000000000 +0200
+++ linux/arch/ppc64/kernel/ioctl32.c	2004-04-21 14:11:47.000000000 +0200
@@ -3780,6 +3780,7 @@ COMPATIBLE_IOCTL(TCSETSW),
 COMPATIBLE_IOCTL(TCSETSF),
 COMPATIBLE_IOCTL(TIOCLINUX),
 COMPATIBLE_IOCTL(TIOCSTART),
+COMPATIBLE_IOCTL(TIOCGDEV),
 /* Little t */
 COMPATIBLE_IOCTL(TIOCGETD),
 COMPATIBLE_IOCTL(TIOCSETD),
diff -up linux-2.4.26/arch/sparc64/kernel/ioctl32.c linux/arch/sparc64/kernel/ioctl32.c
--- linux-2.4.26/arch/sparc64/kernel/ioctl32.c	2004-04-21 14:11:32.000000000 +0200
+++ linux/arch/sparc64/kernel/ioctl32.c	2004-04-21 14:11:48.000000000 +0200
@@ -4389,6 +4389,7 @@ COMPATIBLE_IOCTL(TCSETSF)
 COMPATIBLE_IOCTL(TIOCLINUX)
 COMPATIBLE_IOCTL(TIOCSTART)
 COMPATIBLE_IOCTL(TIOCSTOP)
+COMPATIBLE_IOCTL(TIOCGDEV)
 /* Little t */
 COMPATIBLE_IOCTL(TIOCGETD)
 COMPATIBLE_IOCTL(TIOCSETD)
diff -up linux-2.4.26/drivers/char/tty_io.c linux/drivers/char/tty_io.c
--- linux-2.4.26/drivers/char/tty_io.c	2004-04-21 13:44:38.000000000 +0200
+++ linux/drivers/char/tty_io.c	2004-04-21 14:11:48.000000000 +0200
@@ -1818,6 +1818,18 @@ int tty_ioctl(struct inode * inode, stru
 		case TIOCTTYGSTRUCT:
 			return tiocttygstruct(tty, (struct tty_struct *) arg);
 
+			/*
+			 * Without the real device to which /dev/console is connected,
+			 * blogd can not work.
+			 *	blogd spawns a pty/tty pair,
+			 *	set /dev/console to the tty of that pair (ioctl TIOCCONS),
+			 *	then reads in all input from the current /dev/console,
+			 *	buffer or write the readed data to /var/log/boot.msg
+			 *	_and_ to the original real device.
+			 */
+		case TIOCGDEV:
+			return put_user (kdev_t_to_nr (real_tty->device), (unsigned int*) arg);
+
 		/*
 		 * Break handling
 		 */
diff -up linux-2.4.26/include/asm-alpha/ioctls.h linux/include/asm-alpha/ioctls.h
--- linux-2.4.26/include/asm-alpha/ioctls.h	2004-04-21 13:45:18.000000000 +0200
+++ linux/include/asm-alpha/ioctls.h	2004-04-21 14:11:48.000000000 +0200
@@ -94,6 +94,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 -up linux-2.4.26/include/asm-arm/ioctls.h linux/include/asm-arm/ioctls.h
--- linux-2.4.26/include/asm-arm/ioctls.h	2004-04-21 13:43:54.000000000 +0200
+++ linux/include/asm-arm/ioctls.h	2004-04-21 14:11:48.000000000 +0200
@@ -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 -up linux-2.4.26/include/asm-i386/ioctls.h linux/include/asm-i386/ioctls.h
--- linux-2.4.26/include/asm-i386/ioctls.h	2004-04-21 13:41:55.000000000 +0200
+++ linux/include/asm-i386/ioctls.h	2004-04-21 14:11:48.000000000 +0200
@@ -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 -up linux-2.4.26/include/asm-ia64/ioctls.h linux/include/asm-ia64/ioctls.h
--- linux-2.4.26/include/asm-ia64/ioctls.h	2004-04-21 13:42:02.000000000 +0200
+++ linux/include/asm-ia64/ioctls.h	2004-04-21 14:11:48.000000000 +0200
@@ -56,6 +56,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 -up linux-2.4.26/include/asm-m68k/ioctls.h linux/include/asm-m68k/ioctls.h
--- linux-2.4.26/include/asm-m68k/ioctls.h	2004-04-21 13:45:00.000000000 +0200
+++ linux/include/asm-m68k/ioctls.h	2004-04-21 14:11:48.000000000 +0200
@@ -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 -up linux-2.4.26/include/asm-mips/ioctls.h linux/include/asm-mips/ioctls.h
--- linux-2.4.26/include/asm-mips/ioctls.h	2004-04-21 13:45:54.000000000 +0200
+++ linux/include/asm-mips/ioctls.h	2004-04-21 14:11:48.000000000 +0200
@@ -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 -up linux-2.4.26/include/asm-mips64/ioctls.h linux/include/asm-mips64/ioctls.h
--- linux-2.4.26/include/asm-mips64/ioctls.h	2004-04-21 13:45:24.000000000 +0200
+++ linux/include/asm-mips64/ioctls.h	2004-04-21 14:11:48.000000000 +0200
@@ -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 -up linux-2.4.26/include/asm-ppc/ioctls.h linux/include/asm-ppc/ioctls.h
--- linux-2.4.26/include/asm-ppc/ioctls.h	2004-04-21 13:45:38.000000000 +0200
+++ linux/include/asm-ppc/ioctls.h	2004-04-21 14:11:48.000000000 +0200
@@ -89,6 +89,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 -up linux-2.4.26/include/asm-ppc64/ioctls.h linux/include/asm-ppc64/ioctls.h
--- linux-2.4.26/include/asm-ppc64/ioctls.h	2004-04-21 13:42:39.000000000 +0200
+++ linux/include/asm-ppc64/ioctls.h	2004-04-21 14:11:48.000000000 +0200
@@ -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 -up linux-2.4.26/include/asm-s390/ioctls.h linux/include/asm-s390/ioctls.h
--- linux-2.4.26/include/asm-s390/ioctls.h	2004-04-21 13:41:21.000000000 +0200
+++ linux/include/asm-s390/ioctls.h	2004-04-21 14:11:48.000000000 +0200
@@ -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 -up linux-2.4.26/include/asm-s390x/ioctls.h linux/include/asm-s390x/ioctls.h
--- linux-2.4.26/include/asm-s390x/ioctls.h	2004-04-21 13:43:06.000000000 +0200
+++ linux/include/asm-s390x/ioctls.h	2004-04-21 14:11:48.000000000 +0200
@@ -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 -up linux-2.4.26/include/asm-sh/ioctls.h linux/include/asm-sh/ioctls.h
--- linux-2.4.26/include/asm-sh/ioctls.h	2004-04-21 13:44:54.000000000 +0200
+++ linux/include/asm-sh/ioctls.h	2004-04-21 14:11:48.000000000 +0200
@@ -81,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 -up linux-2.4.26/include/asm-sparc/ioctls.h linux/include/asm-sparc/ioctls.h
--- linux-2.4.26/include/asm-sparc/ioctls.h	2004-04-21 13:43:52.000000000 +0200
+++ linux/include/asm-sparc/ioctls.h	2004-04-21 14:11:48.000000000 +0200
@@ -100,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 -up linux-2.4.26/include/asm-sparc64/ioctls.h linux/include/asm-sparc64/ioctls.h
--- linux-2.4.26/include/asm-sparc64/ioctls.h	2004-04-21 13:44:17.000000000 +0200
+++ linux/include/asm-sparc64/ioctls.h	2004-04-21 14:11:48.000000000 +0200
@@ -101,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 -up linux-2.4.26/include/asm-x86_64/ioctls.h linux/include/asm-x86_64/ioctls.h
--- linux-2.4.26/include/asm-x86_64/ioctls.h	2004-04-21 13:41:20.000000000 +0200
+++ linux/include/asm-x86_64/ioctls.h	2004-04-21 14:11:48.000000000 +0200
@@ -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

