Messages in this thread Patch in this message | | | From | (Miquel van Smoorenburg) | Subject | New ioctl: TIOCGDEV | Date | 21 Mar 1998 21:41:37 +0100 |
| |
This patch introduces a new ioctl, TIOCGDEV. It can be used to find out the _real_ device of the serial console.
I use this so I can first open /dev/console and a pty pair, then use TIOCCONS to redirect console output to the pty, and then I can copy the console output from the pty to both a logfile and the real console. This is useful for a boot-time daemon so all bootup messages can be captured and logged...
diff -ruN linux-2.1.90.orig/drivers/char/tty_io.c linux-2.1.90/drivers/char/tty_io.c --- linux-2.1.90.orig/drivers/char/tty_io.c Sat Mar 21 18:23:24 1998 +++ linux-2.1.90/drivers/char/tty_io.c Sat Mar 21 20:04:01 1998 @@ -1656,6 +1656,8 @@ return put_user(tty->ldisc.num, (int *) arg); case TIOCSETD: return tiocsetd(tty, (int *) arg); + case TIOCGDEV: + return put_user(tty->device, (kdev_t *) arg); #ifdef CONFIG_VT case TIOCLINUX: return tioclinux(tty, arg); diff -ruN linux-2.1.90.orig/include/asm-alpha/ioctls.h linux-2.1.90/include/asm-alpha/ioctls.h --- linux-2.1.90.orig/include/asm-alpha/ioctls.h Sat Feb 21 13:08:07 1998 +++ linux-2.1.90/include/asm-alpha/ioctls.h Sat Mar 21 20:01:43 1998 @@ -88,6 +88,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, kdev_t) #define TIOCSERCONFIG 0x5453 #define TIOCSERGWILD 0x5454 diff -ruN linux-2.1.90.orig/include/asm-arm/ioctls.h linux-2.1.90/include/asm-arm/ioctls.h --- linux-2.1.90.orig/include/asm-arm/ioctls.h Sat Feb 21 13:08:07 1998 +++ linux-2.1.90/include/asm-arm/ioctls.h Sat Mar 21 20:01:50 1998 @@ -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, kdev_t) #define FIONCLEX 0x5450 /* these numbers need to be adjusted. */ #define FIOCLEX 0x5451 diff -ruN linux-2.1.90.orig/include/asm-i386/ioctls.h linux-2.1.90/include/asm-i386/ioctls.h --- linux-2.1.90.orig/include/asm-i386/ioctls.h Sat Feb 21 13:08:08 1998 +++ linux-2.1.90/include/asm-i386/ioctls.h Sat Mar 21 20:01:53 1998 @@ -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, kdev_t) #define FIONCLEX 0x5450 /* these numbers need to be adjusted. */ #define FIOCLEX 0x5451 diff -ruN linux-2.1.90.orig/include/asm-m68k/ioctls.h linux-2.1.90/include/asm-m68k/ioctls.h --- linux-2.1.90.orig/include/asm-m68k/ioctls.h Sat Feb 21 13:08:09 1998 +++ linux-2.1.90/include/asm-m68k/ioctls.h Sat Mar 21 20:01:56 1998 @@ -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, kdev_t) #define FIONCLEX 0x5450 /* these numbers need to be adjusted. */ #define FIOCLEX 0x5451 diff -ruN linux-2.1.90.orig/include/asm-mips/ioctls.h linux-2.1.90/include/asm-mips/ioctls.h --- linux-2.1.90.orig/include/asm-mips/ioctls.h Sat Feb 21 13:08:09 1998 +++ linux-2.1.90/include/asm-mips/ioctls.h Sat Mar 21 20:01:59 1998 @@ -101,6 +101,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, kdev_t) #define TIOCSERCONFIG 0x5488 #define TIOCSERGWILD 0x5489 diff -ruN linux-2.1.90.orig/include/asm-ppc/ioctls.h linux-2.1.90/include/asm-ppc/ioctls.h --- linux-2.1.90.orig/include/asm-ppc/ioctls.h Sat Feb 21 13:08:09 1998 +++ linux-2.1.90/include/asm-ppc/ioctls.h Sat Mar 21 20:02:02 1998 @@ -88,6 +88,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, kdev_t) #define TIOCSERCONFIG 0x5453 #define TIOCSERGWILD 0x5454 diff -ruN linux-2.1.90.orig/include/asm-sparc/ioctls.h linux-2.1.90/include/asm-sparc/ioctls.h --- linux-2.1.90.orig/include/asm-sparc/ioctls.h Sat Feb 21 13:08:09 1998 +++ linux-2.1.90/include/asm-sparc/ioctls.h Sat Mar 21 20:02:26 1998 @@ -78,6 +78,7 @@ /* Get minor device of a pty master's FD -- Solaris equiv is ISPTM */ #define TIOCGPTN _IOR('t', 134, unsigned int) /* Get Pty Number */ #define TIOCSPTLCK _IOW('t', 135, int) /* Lock/unlock PTY */ +#define TIOCGDEV _IOR('t',136, kdev_t) /* Little f */ #define FIOCLEX _IO('f', 1) diff -ruN linux-2.1.90.orig/include/asm-sparc64/ioctls.h linux-2.1.90/include/asm-sparc64/ioctls.h --- linux-2.1.90.orig/include/asm-sparc64/ioctls.h Sat Feb 21 13:08:09 1998 +++ linux-2.1.90/include/asm-sparc64/ioctls.h Sat Mar 21 20:03:00 1998 @@ -79,6 +79,7 @@ /* Get minor device of a pty master's FD -- Solaris equiv is ISPTM */ #define TIOCGPTN _IOR('t', 134, unsigned int) /* Get Pty Number */ #define TIOCSPTLCK _IOW('t', 135, int) /* Lock/unlock PTY */ +#define TIOCGDEV _IOR('t', 136, kdev_t) /* Little f */ #define FIOCLEX _IO('f', 1)
-- Miquel van Smoorenburg | Our vision is to speed up time, miquels@cistron.nl | eventually eliminating it. - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu
| |