diff mbox series

[RFC] procd: Use /dev/console for serial console if exists

Message ID 20210425063356.1162225-1-gaurav.pathak@pantacor.com
State Changes Requested
Headers show
Series [RFC] procd: Use /dev/console for serial console if exists | expand

Commit Message

Gaurav Pathak April 25, 2021, 6:33 a.m. UTC
inittab.c: Use "/dev/console" character device (5,1) if it
is present, before trying "/sys/class/tty/console/active" in
case if console kernel command line is not provided during boot
and to allow container environment to use it as login PTY console.

Signed-off-by: Gaurav Pathak <gaurav.pathak@pantacor.com>
---
 inittab.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

Comments

Paul Spooren April 25, 2021, 10:14 a.m. UTC | #1
Apr 25, 2021 8:34:06 AM Gaurav Pathak <gaurav.pathak@pantacor.com>:

> inittab.c: Use "/dev/console" character device (5,1) if it
> is present, before trying "/sys/class/tty/console/active" in
> case if console kernel command line is not provided during boot
> and to allow container environment to use it as login PTY console.
>
> Signed-off-by: Gaurav Pathak <gaurav.pathak@pantacor.com>
> ---

LGTM

> inittab.c | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/inittab.c b/inittab.c
> index 2c2270c..716bcee 100644
> --- a/inittab.c
> +++ b/inittab.c
> @@ -190,7 +190,13 @@ static void askconsole(struct init_action *a)
>    */
>   tty = get_cmdline_val("console", line, sizeof(line));
>   if (tty == NULL) {
> -   tty = get_active_console(line, sizeof(line));
> +                if (dev_exist("/dev/console")) {
> +                        tty = "/dev/console";
> +                }
> +                else {
> +                        tty = get_active_console(line, sizeof(line));
> +                }
> +
>   }
>   if (tty != NULL) {
>     split = strchr(tty, ',');
> --
> 2.25.1
diff mbox series

Patch

diff --git a/inittab.c b/inittab.c
index 2c2270c..716bcee 100644
--- a/inittab.c
+++ b/inittab.c
@@ -190,7 +190,13 @@  static void askconsole(struct init_action *a)
 	 */
 	tty = get_cmdline_val("console", line, sizeof(line));
 	if (tty == NULL) {
-		tty = get_active_console(line, sizeof(line));
+                if (dev_exist("/dev/console")) {
+                        tty = "/dev/console";
+                }
+                else {
+                        tty = get_active_console(line, sizeof(line));
+                }
+
 	}
 	if (tty != NULL) {
 		split = strchr(tty, ',');