diff -Nru linux-2.4.19-pre9-gentoo-last/arch/sparc64/kernel/ioctl32.c linux-2.4.19-pre9-gentoo/arch/sparc64/kernel/ioctl32.c
--- linux-2.4.19-pre9-gentoo-last/arch/sparc64/kernel/ioctl32.c	Fri May 31 20:24:11 2002
+++ linux-2.4.19-pre9-gentoo/arch/sparc64/kernel/ioctl32.c	Fri May 31 20:31:27 2002
@@ -3909,6 +3909,7 @@
 COMPATIBLE_IOCTL(TCSETSW)
 COMPATIBLE_IOCTL(TCSETSF)
 COMPATIBLE_IOCTL(TIOCLINUX)
+COMPATIBLE_IOCTL(TIOCGDEV)
 COMPATIBLE_IOCTL(TIOCSTART)
 COMPATIBLE_IOCTL(TIOCSTOP)
 /* Little t */
diff -Nru linux-2.4.19-pre9-gentoo-last/drivers/char/tty_io.c linux-2.4.19-pre9-gentoo/drivers/char/tty_io.c
--- linux-2.4.19-pre9-gentoo-last/drivers/char/tty_io.c	Fri May 31 20:23:44 2002
+++ linux-2.4.19-pre9-gentoo/drivers/char/tty_io.c	Fri May 31 20:31:27 2002
@@ -1765,7 +1765,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
 		 */
diff -Nru linux-2.4.19-pre9-gentoo-last/include/asm-alpha/ioctls.h linux-2.4.19-pre9-gentoo/include/asm-alpha/ioctls.h
--- linux-2.4.19-pre9-gentoo-last/include/asm-alpha/ioctls.h	Fri May 31 20:23:40 2002
+++ linux-2.4.19-pre9-gentoo/include/asm-alpha/ioctls.h	Fri May 31 20:31:27 2002
@@ -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 -Nru linux-2.4.19-pre9-gentoo-last/include/asm-arm/ioctls.h linux-2.4.19-pre9-gentoo/include/asm-arm/ioctls.h
--- linux-2.4.19-pre9-gentoo-last/include/asm-arm/ioctls.h	Fri May 31 20:23:41 2002
+++ linux-2.4.19-pre9-gentoo/include/asm-arm/ioctls.h	Fri May 31 20:31:27 2002
@@ -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 -Nru linux-2.4.19-pre9-gentoo-last/include/asm-i386/ioctls.h linux-2.4.19-pre9-gentoo/include/asm-i386/ioctls.h
--- linux-2.4.19-pre9-gentoo-last/include/asm-i386/ioctls.h	Fri May 31 20:23:40 2002
+++ linux-2.4.19-pre9-gentoo/include/asm-i386/ioctls.h	Fri May 31 20:31:27 2002
@@ -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 -Nru linux-2.4.19-pre9-gentoo-last/include/asm-ia64/ioctls.h linux-2.4.19-pre9-gentoo/include/asm-ia64/ioctls.h
--- linux-2.4.19-pre9-gentoo-last/include/asm-ia64/ioctls.h	Fri May 31 20:23:42 2002
+++ linux-2.4.19-pre9-gentoo/include/asm-ia64/ioctls.h	Fri May 31 20:31:27 2002
@@ -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 -Nru linux-2.4.19-pre9-gentoo-last/include/asm-m68k/ioctls.h linux-2.4.19-pre9-gentoo/include/asm-m68k/ioctls.h
--- linux-2.4.19-pre9-gentoo-last/include/asm-m68k/ioctls.h	Fri May 31 20:23:41 2002
+++ linux-2.4.19-pre9-gentoo/include/asm-m68k/ioctls.h	Fri May 31 20:31:27 2002
@@ -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 -Nru linux-2.4.19-pre9-gentoo-last/include/asm-mips/ioctls.h linux-2.4.19-pre9-gentoo/include/asm-mips/ioctls.h
--- linux-2.4.19-pre9-gentoo-last/include/asm-mips/ioctls.h	Fri May 31 20:23:40 2002
+++ linux-2.4.19-pre9-gentoo/include/asm-mips/ioctls.h	Fri May 31 20:31:27 2002
@@ -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 -Nru linux-2.4.19-pre9-gentoo-last/include/asm-mips64/ioctls.h linux-2.4.19-pre9-gentoo/include/asm-mips64/ioctls.h
--- linux-2.4.19-pre9-gentoo-last/include/asm-mips64/ioctls.h	Fri May 31 20:23:42 2002
+++ linux-2.4.19-pre9-gentoo/include/asm-mips64/ioctls.h	Fri May 31 20:31:27 2002
@@ -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 -Nru linux-2.4.19-pre9-gentoo-last/include/asm-ppc/ioctls.h linux-2.4.19-pre9-gentoo/include/asm-ppc/ioctls.h
--- linux-2.4.19-pre9-gentoo-last/include/asm-ppc/ioctls.h	Fri May 31 20:23:41 2002
+++ linux-2.4.19-pre9-gentoo/include/asm-ppc/ioctls.h	Fri May 31 20:31:27 2002
@@ -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 -Nru linux-2.4.19-pre9-gentoo-last/include/asm-s390/ioctls.h linux-2.4.19-pre9-gentoo/include/asm-s390/ioctls.h
--- linux-2.4.19-pre9-gentoo-last/include/asm-s390/ioctls.h	Fri May 31 20:23:42 2002
+++ linux-2.4.19-pre9-gentoo/include/asm-s390/ioctls.h	Fri May 31 20:31:27 2002
@@ -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 -Nru linux-2.4.19-pre9-gentoo-last/include/asm-sh/ioctls.h linux-2.4.19-pre9-gentoo/include/asm-sh/ioctls.h
--- linux-2.4.19-pre9-gentoo-last/include/asm-sh/ioctls.h	Fri May 31 20:23:42 2002
+++ linux-2.4.19-pre9-gentoo/include/asm-sh/ioctls.h	Fri May 31 20:31:27 2002
@@ -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 -Nru linux-2.4.19-pre9-gentoo-last/include/asm-sparc/ioctls.h linux-2.4.19-pre9-gentoo/include/asm-sparc/ioctls.h
--- linux-2.4.19-pre9-gentoo-last/include/asm-sparc/ioctls.h	Fri May 31 20:23:41 2002
+++ linux-2.4.19-pre9-gentoo/include/asm-sparc/ioctls.h	Fri May 31 20:31:27 2002
@@ -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 -Nru linux-2.4.19-pre9-gentoo-last/include/asm-sparc64/ioctls.h linux-2.4.19-pre9-gentoo/include/asm-sparc64/ioctls.h
--- linux-2.4.19-pre9-gentoo-last/include/asm-sparc64/ioctls.h	Fri May 31 20:23:41 2002
+++ linux-2.4.19-pre9-gentoo/include/asm-sparc64/ioctls.h	Fri May 31 20:31:27 2002
@@ -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
