X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fcore%2Fmain.c;h=d052c8debc79ce281530ee7ce151b563fa870c11;hb=ccd06097c79218f7d5ea4c21721bbcbc7c467dca;hp=6c3d9bfb189d071000d120e33e43338be01f1253;hpb=e3dd987cfc395848256fc6eae637ed0eaf5f1635;p=elogind.git diff --git a/src/core/main.c b/src/core/main.c index 6c3d9bfb1..d052c8deb 100644 --- a/src/core/main.c +++ b/src/core/main.c @@ -112,7 +112,7 @@ static FILE* serialization = NULL; static void nop_handler(int sig) { } -_noreturn_ static void crash(int sig) { +noreturn static void crash(int sig) { if (getpid() != 1) /* Pass this on immediately, if this is not PID 1 */ @@ -166,7 +166,7 @@ _noreturn_ static void crash(int sig) { else if (status.si_code != CLD_DUMPED) log_error("Caught <%s>, core dump failed.", signal_to_string(sig)); else - log_error("Caught <%s>, dumped core as pid %lu.", signal_to_string(sig), (unsigned long) pid); + log_error("Caught <%s>, dumped core as pid "PID_FMT".", signal_to_string(sig), pid); } } @@ -197,7 +197,7 @@ _noreturn_ static void crash(int sig) { _exit(1); } - log_info("Successfully spawned crash shell as pid %lu.", (unsigned long) pid); + log_info("Successfully spawned crash shell as pid "PID_FMT".", pid); } log_info("Freezing execution."); @@ -417,7 +417,7 @@ static int parse_proc_cmdline_word(const char *word) { * will block with every log message for for 60 seconds, * before they give up. */ log_set_max_level(LOG_DEBUG); - log_set_target(LOG_TARGET_KMSG); + log_set_target(detect_container(NULL) > 0 ? LOG_TARGET_CONSOLE : LOG_TARGET_KMSG); } else if (!in_initrd()) { unsigned i; @@ -462,7 +462,6 @@ DEFINE_SETTER(config_parse_target, log_set_target_from_string, "target") DEFINE_SETTER(config_parse_color, log_show_color_from_string, "color" ) DEFINE_SETTER(config_parse_location, log_show_location_from_string, "location") - static int config_parse_cpu_affinity2(const char *unit, const char *filename, unsigned line, @@ -1328,6 +1327,7 @@ int main(int argc, char *argv[]) { /* Running inside a container, as PID 1 */ arg_running_as = SYSTEMD_SYSTEM; log_set_target(LOG_TARGET_CONSOLE); + log_close_console(); /* force reopen of /dev/console */ log_open(); /* For the later on, see above... */ @@ -1488,7 +1488,8 @@ int main(int argc, char *argv[]) { status_welcome(); #ifdef HAVE_KMOD - kmod_setup(); + if (detect_container(NULL) <= 0) + kmod_setup(); #endif hostname_setup(); machine_id_setup(); @@ -1864,7 +1865,7 @@ finish: watchdog_close(false); /* Tell the binary how often to ping */ - snprintf(e, sizeof(e), "WATCHDOG_USEC=%llu", (unsigned long long) arg_shutdown_watchdog); + snprintf(e, sizeof(e), "WATCHDOG_USEC="USEC_FMT, arg_shutdown_watchdog); char_array_0(e); env_block = strv_append(environ, e);