mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@suse.de>
To: linux-kernel@vger.kernel.org
Cc: Werner Fink <werner@suse.de>, Greg Kroah-Hartman <gregkh@suse.de>
Subject: [PATCH 35/36] TTY: Add tty ioctl to figure device node of the system console.
Date: Thu,  6 Jan 2011 14:23:24 -0800	[thread overview]
Message-ID: <1294352605-31906-35-git-send-email-gregkh@suse.de> (raw)
In-Reply-To: <20110106215404.GA30624@kroah.com>

From: Werner Fink <werner@suse.de>

This has been in the SuSE kernels for a very long time.

Signed-off-by: Werner Fink <werner@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
 arch/alpha/include/asm/ioctls.h   |    1 +
 arch/mips/include/asm/ioctls.h    |    1 +
 arch/parisc/include/asm/ioctls.h  |    1 +
 arch/powerpc/include/asm/ioctls.h |    1 +
 arch/sh/include/asm/ioctls.h      |    1 +
 arch/sparc/include/asm/ioctls.h   |    1 +
 arch/xtensa/include/asm/ioctls.h  |    1 +
 drivers/tty/tty_io.c              |    5 +++++
 fs/compat_ioctl.c                 |    1 +
 include/asm-generic/ioctls.h      |    1 +
 10 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/arch/alpha/include/asm/ioctls.h b/arch/alpha/include/asm/ioctls.h
index 59617c3..034b6cf 100644
--- a/arch/alpha/include/asm/ioctls.h
+++ b/arch/alpha/include/asm/ioctls.h
@@ -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 primary device node of /dev/console */
 #define TIOCSIG		_IOW('T',0x36, int)  /* Generate signal on Pty slave */
 
 #define TIOCSERCONFIG	0x5453
diff --git a/arch/mips/include/asm/ioctls.h b/arch/mips/include/asm/ioctls.h
index d87cb04..d967b89 100644
--- a/arch/mips/include/asm/ioctls.h
+++ b/arch/mips/include/asm/ioctls.h
@@ -83,6 +83,7 @@
 #define TCSETSF2	_IOW('T', 0x2D, struct termios2)
 #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 primary device node of /dev/console */
 #define TIOCSIG		_IOW('T', 0x36, int)  /* Generate signal on Pty slave */
 
 /* I hope the range from 0x5480 on is free ... */
diff --git a/arch/parisc/include/asm/ioctls.h b/arch/parisc/include/asm/ioctls.h
index 4e06144..6ba80d0 100644
--- a/arch/parisc/include/asm/ioctls.h
+++ b/arch/parisc/include/asm/ioctls.h
@@ -52,6 +52,7 @@
 #define TCSETSF2	_IOW('T',0x2D, struct termios2)
 #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, int)  /* Get primary device node of /dev/console */
 #define TIOCSIG		_IOW('T',0x36, int)  /* Generate signal on Pty slave */
 
 #define FIONCLEX	0x5450  /* these numbers need to be adjusted. */
diff --git a/arch/powerpc/include/asm/ioctls.h b/arch/powerpc/include/asm/ioctls.h
index 8519200..c7dc17c 100644
--- a/arch/powerpc/include/asm/ioctls.h
+++ b/arch/powerpc/include/asm/ioctls.h
@@ -94,6 +94,7 @@
 #define TIOCSRS485	0x542f
 #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 primary device node of /dev/console */
 #define TIOCSIG		_IOW('T',0x36, int)  /* Generate signal on Pty slave */
 
 #define TIOCSERCONFIG	0x5453
diff --git a/arch/sh/include/asm/ioctls.h b/arch/sh/include/asm/ioctls.h
index eb6c4c6..84e85a7 100644
--- a/arch/sh/include/asm/ioctls.h
+++ b/arch/sh/include/asm/ioctls.h
@@ -85,6 +85,7 @@
 #define TCSETSF2	_IOW('T', 45, struct termios2)
 #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 primary device node of /dev/console */
 #define TIOCSIG		_IOW('T',0x36, int)  /* Generate signal on Pty slave */
 
 #define TIOCSERCONFIG	_IO('T', 83) /* 0x5453 */
diff --git a/arch/sparc/include/asm/ioctls.h b/arch/sparc/include/asm/ioctls.h
index 53f4ee0..ed3807b 100644
--- a/arch/sparc/include/asm/ioctls.h
+++ b/arch/sparc/include/asm/ioctls.h
@@ -19,6 +19,7 @@
 #define TCSETS2		_IOW('T', 13, struct termios2)
 #define TCSETSW2	_IOW('T', 14, struct termios2)
 #define TCSETSF2	_IOW('T', 15, struct termios2)
+#define TIOCGDEV	_IOR('T',0x32, unsigned int) /* Get primary device node of /dev/console */
 
 /* Note that all the ioctls that are not available in Linux have a 
  * double underscore on the front to: a) avoid some programs to
diff --git a/arch/xtensa/include/asm/ioctls.h b/arch/xtensa/include/asm/ioctls.h
index ab18000..ccf1800 100644
--- a/arch/xtensa/include/asm/ioctls.h
+++ b/arch/xtensa/include/asm/ioctls.h
@@ -98,6 +98,7 @@
 #define TCSETSF2	_IOW('T', 45, struct termios2)
 #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 primary device node of /dev/console */
 #define TIOCSIG		_IOW('T',0x36, int)  /* Generate signal on Pty slave */
 
 #define TIOCSERCONFIG	_IO('T', 83)
diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c
index be5ab4a..d2333ab 100644
--- a/drivers/tty/tty_io.c
+++ b/drivers/tty/tty_io.c
@@ -2618,6 +2618,11 @@ long tty_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 		return put_user(tty->ldisc->ops->num, (int __user *)p);
 	case TIOCSETD:
 		return tiocsetd(tty, p);
+	case TIOCGDEV:
+	{
+		unsigned int ret = new_encode_dev(tty_devnum(real_tty));
+		return put_user(ret, (unsigned int __user *)p);
+	}
 	/*
 	 * Break handling
 	 */
diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c
index 410ed18..a1a8f0c 100644
--- a/fs/compat_ioctl.c
+++ b/fs/compat_ioctl.c
@@ -837,6 +837,7 @@ COMPATIBLE_IOCTL(TCSETSW)
 COMPATIBLE_IOCTL(TCSETSF)
 COMPATIBLE_IOCTL(TIOCLINUX)
 COMPATIBLE_IOCTL(TIOCSBRK)
+COMPATIBLE_IOCTL(TIOCGDEV)
 COMPATIBLE_IOCTL(TIOCCBRK)
 COMPATIBLE_IOCTL(TIOCGSID)
 COMPATIBLE_IOCTL(TIOCGICOUNT)
diff --git a/include/asm-generic/ioctls.h b/include/asm-generic/ioctls.h
index a321665..3f3f2d1 100644
--- a/include/asm-generic/ioctls.h
+++ b/include/asm-generic/ioctls.h
@@ -67,6 +67,7 @@
 #endif
 #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 primary device node of /dev/console */
 #define TCGETX		0x5432 /* SYS5 TCGETX compatibility */
 #define TCSETX		0x5433
 #define TCSETXF		0x5434
-- 
1.7.3.2


  parent reply	other threads:[~2011-01-06 22:24 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-06 21:54 [GIT PATCH] TTY/serial merge for .38 Greg KH
2011-01-06 22:00 ` Alan Cox
2011-01-06 22:24   ` Greg KH
2011-01-06 23:54     ` Kay Sievers
2011-01-07  3:40       ` Greg KH
2011-01-06 22:22 ` [PATCH 01/36] ifx6x60: SPI protocol driver for Infineon 6x60 modem Greg Kroah-Hartman
2011-01-06 22:22 ` [PATCH 02/36] serial: Add support for UART on VIA VT8500 and compatibles Greg Kroah-Hartman
2011-01-06 22:22 ` [PATCH 03/36] n_gsm: Fix support for legacy encoding Greg Kroah-Hartman
2011-01-06 22:22 ` [PATCH 04/36] n_gsm: clean up printks Greg Kroah-Hartman
2011-01-06 22:22 ` [PATCH 05/36] serial: add Documentation about RS485 serial communications Greg Kroah-Hartman
2011-01-06 22:22 ` [PATCH 06/36] serial: cpm_uat: reducing CPM serial latency Greg Kroah-Hartman
2011-01-06 22:22 ` [PATCH 07/36] serial: cpu_uart: Remove unused uart_cpm_port fields Greg Kroah-Hartman
2011-01-06 22:22 ` [PATCH 08/36] console: move for_each_console to linux/console.h Greg Kroah-Hartman
2011-01-06 22:22 ` [PATCH 09/36] TTY: include termios.h in tty_driver.h Greg Kroah-Hartman
2011-01-06 22:22 ` [PATCH 10/36] VIDEO: xen-fb, switch to for_each_console Greg Kroah-Hartman
2011-01-06 22:23 ` [PATCH 11/36] console: add /proc/consoles Greg Kroah-Hartman
2011-01-06 22:23 ` [PATCH 12/36] parisc: cleanup console handling Greg Kroah-Hartman
2011-01-06 22:23 ` [PATCH 13/36] serial: mpc52xx: make printout for type more generic Greg Kroah-Hartman
2011-01-06 22:23 ` [PATCH 14/36] serial: ifx6x60: The IFX requires SPI Greg Kroah-Hartman
2011-01-06 22:23 ` [PATCH 15/36] serial: ifx6x60: Fix missing include for msleep Greg Kroah-Hartman
2011-01-06 22:23 ` [PATCH 16/36] Serial: ce4100: Add PCI UART support for the ce4100 Greg Kroah-Hartman
2011-01-06 22:23 ` [PATCH 17/36] Serial: EG20T: add PCH_UART driver Greg Kroah-Hartman
2011-01-06 22:23 ` [PATCH 18/36] serial: ifx6x60: free IRQ on error Greg Kroah-Hartman
2011-01-06 22:23 ` [PATCH 19/36] serial: ifx6x60: fix memory leak Greg Kroah-Hartman
2011-01-06 22:23 ` [PATCH 20/36] RS485 documentation: add 16C950 UART description Greg Kroah-Hartman
2011-01-06 22:23 ` [PATCH 21/36] drivers: char: hvc: add arm JTAG DCC console support Greg Kroah-Hartman
2011-01-06 22:23 ` [PATCH 22/36] serial: fix pch_uart kconfig & build Greg Kroah-Hartman
2011-01-07  0:21   ` Tomoya MORINAGA
2011-01-07  0:31     ` Greg KH
2011-01-06 22:23 ` [PATCH 23/36] serial: omap-serial: Add support for kernel debugger Greg Kroah-Hartman
2011-01-06 22:23 ` [PATCH 24/36] 8250: use container_of() instead of casting Greg Kroah-Hartman
2011-01-06 22:23 ` [PATCH 25/36] 8250: add a UPIO_DWAPB32 for 32 bit accesses Greg Kroah-Hartman
2011-01-06 22:23 ` [PATCH 26/36] rocket: fix compiler warning on rocket_pci_ids Greg Kroah-Hartman
2011-01-06 22:23 ` [PATCH 27/36] specialix: fix compiler warning on specialix_pci_tbl Greg Kroah-Hartman
2011-01-06 22:23 ` [PATCH 28/36] ip2: fix compiler warning on ip2main_pci_tbl Greg Kroah-Hartman
2011-01-06 22:23 ` [PATCH 29/36] 8250: fix uninitialized FIFOs Greg Kroah-Hartman
2011-01-06 22:23 ` [PATCH 30/36] pch_uart : fix warnings for 64bit compile Greg Kroah-Hartman
2011-01-06 22:23 ` [PATCH 31/36] tty: fix typos/errors in tty_driver.h comments Greg Kroah-Hartman
2011-01-06 22:23 ` [PATCH 32/36] Serial: Avoid unbalanced IRQ wake disable during resume Greg Kroah-Hartman
2011-01-06 22:23 ` [PATCH 33/36] drivers: serial: apbuart: Handle OF failures gracefully Greg Kroah-Hartman
2011-01-06 22:23 ` [PATCH 34/36] tty: add 'active' sysfs attribute to tty0 and console device Greg Kroah-Hartman
2011-01-07  9:09   ` Jiri Slaby
2011-01-07 13:20     ` Kay Sievers
2011-01-07 15:12       ` Jiri Slaby
2011-01-06 22:23 ` Greg Kroah-Hartman [this message]
2011-01-06 22:23 ` [PATCH 36/36] serial: apbuart: Fixup apbuart_console_init() Greg Kroah-Hartman
2011-01-07 22:44 ` [GIT PATCH] TTY/serial merge for .38 Linus Torvalds
2011-01-07 23:41   ` Greg KH
2011-01-11 14:00     ` Daniel Hellstrom
2011-01-11 14:56       ` Thomas Gleixner
2011-01-11 15:08         ` Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1294352605-31906-35-git-send-email-gregkh@suse.de \
    --to=gregkh@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=werner@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome