public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Change number of tty devices
@ 2004-04-19 22:38 Jason Cox
  2004-04-20 12:38 ` [PATCH] " Jason Cox
  2004-04-21 20:14 ` James Simmons
  0 siblings, 2 replies; 10+ messages in thread
From: Jason Cox @ 2004-04-19 22:38 UTC (permalink / raw)
  To: linux-kernel

[-- Attachment #1: Type: text/plain, Size: 437 bytes --]

Hello all,

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?

Thanks You,
Jason Cox


[-- Attachment #2: config_tty_devices.patch --]
[-- Type: application/octet-stream, Size: 1143 bytes --]

diff -urN linux-2.6.5/drivers/char/Kconfig linux-2.6.6_rc1-love1/drivers/char/Kconfig
--- linux-2.6.5/drivers/char/Kconfig	2004-04-19 16:01:50.006624287 -0500
+++ linux-2.6.6_rc1-love1/drivers/char/Kconfig	2004-04-19 16:39:01.877138133 -0500
@@ -57,6 +57,10 @@
 
 	  If unsure, say Y.
 
+config NR_TTY_DEVICES
+	int "Number of tty devices"
+	default 63
+
 config HW_CONSOLE
 	bool
 	depends on VT && !S390 && !UM
diff -urN linux-2.6.5/include/linux/tty.h linux-2.6.6_rc1-love1/include/linux/tty.h
--- linux-2.6.5/include/linux/tty.h	2004-04-19 11:04:19.000000000 -0500
+++ linux-2.6.6_rc1-love1/include/linux/tty.h	2004-04-19 16:52:19.782915029 -0500
@@ -10,8 +10,13 @@
  * resizing).
  */
 #define MIN_NR_CONSOLES 1       /* must be at least 1 */
+#if (CONFIG_NR_TTY_DEVICES < 11)
 #define MAX_NR_CONSOLES	63	/* serial lines start at 64 */
 #define MAX_NR_USER_CONSOLES 63	/* must be root to allocate above this */
+#else
+#define MAX_NR_CONSOLES CONFIG_NR_TTY_DEVICES
+#define MAX_NR_USER_CONSOLES CONFIG_NR_TTY_DEVICES
+#endif
 		/* Note: the ioctl VT_GETSTATE does not work for
 		   consoles 16 and higher (since it returns a short) */
 

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH] Change number of tty devices
  2004-04-19 22:38 Change number of tty devices Jason Cox
@ 2004-04-20 12:38 ` Jason Cox
  2004-04-21 20:14 ` James Simmons
  1 sibling, 0 replies; 10+ messages in thread
From: Jason Cox @ 2004-04-20 12:38 UTC (permalink / raw)
  To: linux-kernel

On Mon, 19 Apr 2004 22:38:53 +0000
Jason Cox <steel300@gentoo.org> wrote:

> Hello all,
> 
> 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?
> 
> Thanks You,
> Jason Cox
> 
> 

I have come up with a saner patch which adds VT as a dependancy and a help option. Please review and tell me where I went wrong. This is diffed against 2.6.6-rc1-mm1.

Thanks again,
Jason Cox


diff -urN linux-2.6.5/drivers/char/Kconfig linux-2.6.6_rc1-love1/drivers/char/Kconfig
--- linux-2.6.5/drivers/char/Kconfig    2004-04-19 16:01:50.000000000 -0500
+++ linux-2.6.6_rc1-love1/drivers/char/Kconfig  2004-04-19 22:13:27.888080179 -0500
@@ -57,6 +57,16 @@

          If unsure, say Y.

+config NR_TTY_DEVICES
+       int "Maximum tty device number"
+       depends on VT
+       default 63
+       ---help---
+         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.
+
 config HW_CONSOLE
        bool
        depends on VT && !S390 && !UM
diff -urN linux-2.6.5/include/linux/tty.h linux-2.6.6_rc1-love1/include/linux/tty.h
--- linux-2.6.5/include/linux/tty.h     2004-04-19 11:04:19.000000000 -0500
+++ linux-2.6.6_rc1-love1/include/linux/tty.h   2004-04-19 22:05:48.824673446 -0500
@@ -10,8 +10,13 @@
  * resizing).
  */
 #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)
+#define MAX_NR_CONSOLES        11
+#define MAX_NR_USER_CONSOLES 11
+#else
+#define MAX_NR_CONSOLES CONFIG_NR_TTY_DEVICES
+#define MAX_NR_USER_CONSOLES CONFIG_NR_TTY_DEVICES
+#endif
                /* Note: the ioctl VT_GETSTATE does not work for
                   consoles 16 and higher (since it returns a short) */


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Change number of tty devices
  2004-04-19 22:38 Change number of tty devices Jason Cox
  2004-04-20 12:38 ` [PATCH] " Jason Cox
@ 2004-04-21 20:14 ` James Simmons
  2004-04-22  2:24   ` Jason Cox
  2004-04-22  3:15   ` Jason Cox
  1 sibling, 2 replies; 10+ messages in thread
From: James Simmons @ 2004-04-21 20:14 UTC (permalink / raw)
  To: Jason Cox; +Cc: linux-kernel


> 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. 



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Change number of tty devices
  2004-04-21 20:14 ` James Simmons
@ 2004-04-22  2:24   ` Jason Cox
  2004-04-22  8:33     ` Russell King
  2004-04-25  3:19     ` James Simmons
  2004-04-22  3:15   ` Jason Cox
  1 sibling, 2 replies; 10+ messages in thread
From: Jason Cox @ 2004-04-22  2:24 UTC (permalink / raw)
  To: James Simmons; +Cc: linux-kernel

On Wed, 21 Apr 2004 21:14:38 +0100 (BST)
James Simmons <jsimmons@infradead.org> 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. 

First off, thanks for the reply. Does lowering the number of tty devices
interfer with the creation of serial consoles? Can't they start at the
same major number without an issue?

> What is even more is that there exist ioctls that return shorts 
> which means only 16 VCs can be accounted for on a VT. 

So is my limit wrong? Should I up the lower limit to 16 to account for
this? 

> 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. 

Why isn't this done now?

> I personally believe that because
> of the 16 bit limit that there should be 16 VCs per VT terminal. 

That does make sense.

Just a side note: I have been running with 12 (0 - 11) tty devices
without issue. I haven't tried a serial console, but will shortly, just
to see if it interferes with serial console creation.

Thanks,
Jason Cox


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Change number of tty devices
  2004-04-21 20:14 ` James Simmons
  2004-04-22  2:24   ` Jason Cox
@ 2004-04-22  3:15   ` Jason Cox
  1 sibling, 0 replies; 10+ messages in thread
From: Jason Cox @ 2004-04-22  3:15 UTC (permalink / raw)
  To: linux-kernel

On Wed, 21 Apr 2004 21:14:38 +0100 (BST)
James Simmons <jsimmons@infradead.org> 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.
 
+config NR_TTY_DEVICES
+	int "Maximum tty device number"
+	depends on VT
+	default 63
+	---help---
+	  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.
+
+
 config HW_CONSOLE
 	bool
 	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 @@
  * resizing).
  */
 #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
+#else
+/* They chose a sensible number */
+#define MAX_NR_CONSOLES CONFIG_NR_TTY_DEVICES
+#define MAX_NR_USER_CONSOLES CONFIG_NR_TTY_DEVICES
+#endif
 		/* Note: the ioctl VT_GETSTATE does not work for
 		   consoles 16 and higher (since it returns a short) */



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Change number of tty devices
  2004-04-22  2:24   ` Jason Cox
@ 2004-04-22  8:33     ` Russell King
  2004-04-25  3:15       ` James Simmons
  2004-04-25  3:19     ` James Simmons
  1 sibling, 1 reply; 10+ messages in thread
From: Russell King @ 2004-04-22  8:33 UTC (permalink / raw)
  To: Jason Cox; +Cc: James Simmons, linux-kernel

On Thu, Apr 22, 2004 at 02:24:06AM +0000, Jason Cox wrote:
> > 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. 
> 
> Why isn't this done now?

It's a API change and requires a flag day "everyone update their
filesystem."  Especially in a stable kernel series.

-- 
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 PCMCIA      - http://pcmcia.arm.linux.org.uk/
                 2.6 Serial core

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Change number of tty devices
  2004-04-22  8:33     ` Russell King
@ 2004-04-25  3:15       ` James Simmons
  2004-04-25  4:01         ` Horst von Brand
  2004-04-25  7:33         ` Russell King
  0 siblings, 2 replies; 10+ messages in thread
From: James Simmons @ 2004-04-25  3:15 UTC (permalink / raw)
  To: Russell King; +Cc: Jason Cox, linux-kernel


> On Thu, Apr 22, 2004 at 02:24:06AM +0000, Jason Cox wrote:
> > > 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. 
> > 
> > Why isn't this done now?
> 
> It's a API change and requires a flag day "everyone update their
> filesystem."  Especially in a stable kernel series.

By the time 2.7.X comes around everyone should be using udev. That should 
settle any problems. 


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Change number of tty devices
  2004-04-22  2:24   ` Jason Cox
  2004-04-22  8:33     ` Russell King
@ 2004-04-25  3:19     ` James Simmons
  1 sibling, 0 replies; 10+ messages in thread
From: James Simmons @ 2004-04-25  3:19 UTC (permalink / raw)
  To: Jason Cox; +Cc: linux-kernel


> First off, thanks for the reply. Does lowering the number of tty devices
> interfer with the creation of serial consoles? Can't they start at the
> same major number without an issue?

No. It when we need more than 64 VCs.

> > What is even more is that there exist ioctls that return shorts 
> > which means only 16 VCs can be accounted for on a VT. 
> 
> So is my limit wrong? Should I up the lower limit to 16 to account for
> this? 

I would recommend it. 

> > 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. 
> 
> Why isn't this done now?

We are in a stable release.

> > I personally believe that because
> > of the 16 bit limit that there should be 16 VCs per VT terminal. 
> 
> That does make sense.
> 
> Just a side note: I have been running with 12 (0 - 11) tty devices
> without issue. I haven't tried a serial console, but will shortly, just
> to see if it interferes with serial console creation.

It should be no problem. I hate hard limits tho. I rather have a lean 
system that only allocates resources when we want them.



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Change number of tty devices
  2004-04-25  3:15       ` James Simmons
@ 2004-04-25  4:01         ` Horst von Brand
  2004-04-25  7:33         ` Russell King
  1 sibling, 0 replies; 10+ messages in thread
From: Horst von Brand @ 2004-04-25  4:01 UTC (permalink / raw)
  To: James Simmons; +Cc: Russell King, Jason Cox, linux-kernel

James Simmons <jsimmons@infradead.org> said:
> > On Thu, Apr 22, 2004 at 02:24:06AM +0000, Jason Cox wrote:
> > > > 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. 
> > > 
> > > Why isn't this done now?
> > 
> > It's a API change and requires a flag day "everyone update their
> > filesystem."  Especially in a stable kernel series.
> 
> By the time 2.7.X comes around everyone should be using udev. That should 
> settle any problems. 

Dream on. When 2.8.x/3.0.x finally starts shipping, users will scream their
heads off about this "new udev thingy" they are now supposed to use
-- 
Dr. Horst H. von Brand                   User #22616 counter.li.org
Departamento de Informatica                     Fono: +56 32 654431
Universidad Tecnica Federico Santa Maria              +56 32 654239
Casilla 110-V, Valparaiso, Chile                Fax:  +56 32 797513

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Change number of tty devices
  2004-04-25  3:15       ` James Simmons
  2004-04-25  4:01         ` Horst von Brand
@ 2004-04-25  7:33         ` Russell King
  1 sibling, 0 replies; 10+ messages in thread
From: Russell King @ 2004-04-25  7:33 UTC (permalink / raw)
  To: James Simmons; +Cc: Jason Cox, linux-kernel

On Sun, Apr 25, 2004 at 04:15:57AM +0100, James Simmons wrote:
> 
> > On Thu, Apr 22, 2004 at 02:24:06AM +0000, Jason Cox wrote:
> > > > 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. 
> > > 
> > > Why isn't this done now?
> > 
> > It's a API change and requires a flag day "everyone update their
> > filesystem."  Especially in a stable kernel series.
> 
> By the time 2.7.X comes around everyone should be using udev. That should 
> settle any problems. 

I have my doubts about that first statement.

-- 
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 PCMCIA      - http://pcmcia.arm.linux.org.uk/
                 2.6 Serial core

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2004-04-25  7:33 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-04-19 22:38 Change number of tty devices Jason Cox
2004-04-20 12:38 ` [PATCH] " Jason Cox
2004-04-21 20:14 ` James Simmons
2004-04-22  2:24   ` Jason Cox
2004-04-22  8:33     ` Russell King
2004-04-25  3:15       ` James Simmons
2004-04-25  4:01         ` Horst von Brand
2004-04-25  7:33         ` Russell King
2004-04-25  3:19     ` James Simmons
2004-04-22  3:15   ` Jason Cox

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox