Re: [PATCH] Add possibility to set /dev/tty number

From: Austin S. Hemmelgarn
Date: Wed Jan 06 2016 - 08:40:36 EST


On 2016-01-04 10:34, Pierre Paul MINGOT wrote:
> Hello,
>
> In Linux there is no way to set the number of tty devices or console
> to create. By default the kernel create 64 /dev/tty devices. what is
> too much for embedded system with limited resources. As all these 64
> devices are not necessary or mandatory for the kernel proper working,
> I add a config option to set the desired tty. The lowest number you
> can set is 1 and the highest is 63, any value respectively below or
> above that, will cause a kconfig invalid entry pop-up.
>
> Please keep me update.
>
> Best Regards
>
OK, circling back since I never commented on the original patch. Greg covered most of the basics regarding formatting, so I won't comment on that.

>+config NR_TTY_DEVICES
>+ int "Maximum tty device number"
>+ depends on VT
>+ range 1 63
>+ default 1

The config item should default to the current value of 63, as it changes the userspace visible ABI otherwise. It should also probably depend on EXPERT, as this isn't something that should be arbitrarily changed by most people building the kernel.

> #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 */
>+/* serial lines start at 64 */
>+#define MAX_NR_CONSOLES CONFIG_NR_TTY_DEVICES
>+/* must be root to allocate above this */
>+#define MAX_NR_USER_CONSOLES CONFIG_NR_TTY_DEVICES

This shouldn't affect serial console numbering, as the minimum serial console minor number isn't defined relative to either of the values here.

Using #define to define things relative to Kconfig values in uapi headers doesn't work (at least, not just doing it with a simple #define, there might be some way to do it, but I have yet to see it), these would need to get parsed when the headers get installed, so this patch would result in MAX_NR_CONSOLES and MAX_NR_USER_CONSOLES being undefined in the userspace headers because userspace doesn't have direct access to any of the CONFIG values.
--
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/