init became noisy

Denis Vlasenko vda.linux at googlemail.com
Sat May 19 11:38:28 UTC 2007


Hi,

On Friday 18 May 2007 18:32, Ignacio García Pérez wrote:
> I recently moved to 1.5.0 and noticed that init is noisy when 
> FEATURE_INIT_SYSLOG is not enabled.
> 
> Now it shows "Starting whatever", and other messages like when one 
> controlled process dies and is restarted.

It will be nice if bug report will be a bit less vague.

There is no "Starting whatever" message in the init.c.
I see "starting" (with lower case s) only here:

        /* Log the process name and args */
        message(L_LOG, "starting pid %d, tty '%s': '%s'",
                          getpid(), a->terminal, cmdpath);

Okay, let's assume that this is the message which you see.
L_LOG is expected to send it to log only, but apparently it does not.

In message() body:

#if ENABLE_FEATURE_INIT_SYSLOG
...
#else
        msg[l++] = '\n';
        msg[l] = '\0';
        /* Take full control of the log tty, and never close it.
         * It's mine, all mine!  Muhahahaha! */
        if (log_fd < 0) {
                if (!log_console) {
                        log_fd = 2;
                } else {
                        log_fd = device_open(log_console, O_WRONLY | O_NONBLOCK | O_NOCTTY);
                        if (log_fd < 0) {
                                bb_error_msg("can't log to %s", log_console);
                                device = L_CONSOLE;
                        } else {
                                fcntl(log_fd, F_SETFD, FD_CLOEXEC);
                        }
                }
        }
        if (device & L_LOG) {
                full_write(log_fd, msg, l);
                if (log_fd == 2)
                        return; /* don't print dup messages */
        }
#endif

log_console is char* and points to "/dev/tty5". Do you have
that device? Do you see "can't log to /dev/tty5" message?

Alternatively, log_console is unset and all messages go to stderr
if your console turns out to be a serial line:

static void console_init(void)
{
...
        if (ioctl(0, TIOCGSERIAL, &sr) == 0) {
                /* Force the TERM setting to vt102 for serial console --
                 * if TERM is set to linux (the default) */
                if (!s || strcmp(s, "linux") == 0)
                        putenv((char*)"TERM=vt102");
#if !ENABLE_FEATURE_INIT_SYSLOG
                log_console = NULL;
#endif
        } else if (!s)
                putenv((char*)"TERM=linux");
}

Do you use serial console?


Huh, why do we care to set TERM at all? Is it init's job?
Our init still has some strange code :)
--
vda



More information about the busybox mailing list