Re: Change number of tty devices
From: Jason Cox
Date: Wed Apr 21 2004 - 22:16:38 EST
On Wed, 21 Apr 2004 21:14:38 +0100 (BST)
James Simmons <jsimmons@xxxxxxxxxxxxx> wrote:
> > Often, I have wondered what the need for 64 tty devices in /dev is.
> > I began tinkering with the code and am wondering why it's not user
> > configurable. I came up with a quick patch to add it as an option
> > under drivers/char/Kconfig. I also made a lower bound of 12. If this
> > is an idea worth pursuing, please let me know. If this idea has been
> > rejected before, I apologize. What do you think of this idea?
> The reason for 64 is that the major number is shared between the
> serial tty and VT tty drivers. The first 64 to Vts and the rest to
> serial devices. What is even more is that athere exist ioctls that
> return shorts which means only 16 VCs can be accounted for on a VT.
> When the kernel supports multi-desktop systems we will have to deal
> with the serial and VT issue. Most likely the serial tty drivers will
> be given a different major number. I personally believe that because
> of the 16 bit limit that there should be 16 VCs per VT terminal.
Ok, I made a new patch where the upper limit is set to 63. It is there
anything wrong with doing this per se?
diff -urN linux-2.6.5/drivers/char/Kconfig linux-2.6.5-work/drivers/char/Kconfig
--- linux-2.6.5/drivers/char/Kconfig 2004-04-03 21:36:15.000000000 -0600
+++ linux-2.6.5-work/drivers/char/Kconfig 2004-04-21 22:04:11.647195120 -0500
@@ -57,6 +57,18 @@
If unsure, say Y.
+ int "Maximum tty device number"
+ depends on VT
+ default 63
+ This is the highest numbered device created in /dev. You will actually have
+ NR_TTY_DEVICES+1 devices in /dev. The default is 63, which will result in
+ 64 /dev entries. The lowest number you can set is 11, anything below that,
+ and it will default to 11. 63 is also the upper limit so we don't overrun
+ the serial consoles.
depends on VT && !S390 && !UM
diff -urN linux-2.6.5/include/linux/tty.h linux-2.6.5-work/include/linux/tty.h
--- linux-2.6.5/include/linux/tty.h 2004-04-03 21:37:07.000000000 -0600
+++ linux-2.6.5-work/include/linux/tty.h 2004-04-21 22:06:18.000000000 -0500
@@ -10,8 +10,19 @@
#define MIN_NR_CONSOLES 1 /* must be at least 1 */
-#define MAX_NR_CONSOLES 63 /* serial lines start at 64 */
-#define MAX_NR_USER_CONSOLES 63 /* must be root to allocate above this */
+#if (CONFIG_NR_TTY_DEVICES < 11)
+/* Lower Limit */
+#define MAX_NR_CONSOLES 11
+#define MAX_NR_USER_CONSOLES 11
+#elseif (CONFIG_NR_TTY_DEVICES > 63)
+/* Upper Limit */
+#define MAX_NR_CONSOLES 63
+#define MAX_NR_USER_CONSOLES 63
+/* They chose a sensible number */
+#define MAX_NR_CONSOLES CONFIG_NR_TTY_DEVICES
+#define MAX_NR_USER_CONSOLES CONFIG_NR_TTY_DEVICES
/* Note: the ioctl VT_GETSTATE does not work for
consoles 16 and higher (since it returns a short) */
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/