X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fcore%2Fmain.c;h=064445d17e00f30887240c1b159af3d0fae262df;hb=d14ab08b29d5b0b3ead6e63ac8be472f273011f9;hp=4d4f6e8f4caf664f772406840213b6f73326c8e8;hpb=54b434b1b5055f934230fe04fad35b01642b8488;p=elogind.git diff --git a/src/core/main.c b/src/core/main.c index 4d4f6e8f4..064445d17 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 */ @@ -131,7 +131,7 @@ _noreturn_ static void crash(int sig) { pid = fork(); if (pid < 0) - log_error("Caught <%s>, cannot fork for core dump: %s", signal_to_string(sig), strerror(errno)); + log_error("Caught <%s>, cannot fork for core dump: %m", signal_to_string(sig)); else if (pid == 0) { struct rlimit rl = {}; @@ -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; @@ -435,6 +435,7 @@ static int parse_proc_cmdline_word(const char *word) { const char *filename, \ unsigned line, \ const char *section, \ + unsigned section_line, \ const char *lvalue, \ int ltype, \ const char *rvalue, \ @@ -461,11 +462,11 @@ 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, const char *section, + unsigned section_line, const char *lvalue, int ltype, const char *rvalue, @@ -538,6 +539,7 @@ static int config_parse_join_controllers(const char *unit, const char *filename, unsigned line, const char *section, + unsigned section_line, const char *lvalue, int ltype, const char *rvalue, @@ -1325,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... */ @@ -1485,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(); @@ -1528,7 +1532,7 @@ int main(int argc, char *argv[]) { if (arg_running_as == SYSTEMD_SYSTEM) bump_rlimit_nofile(&saved_rlimit_nofile); - r = manager_new(arg_running_as, !!serialization, &m); + r = manager_new(arg_running_as, &m); if (r < 0) { log_error("Failed to allocate manager object: %s", strerror(-r)); goto finish; @@ -1742,7 +1746,7 @@ finish: * initrd, but don't wait for them, so that we * can handle the SIGCHLD for them after * deserializing. */ - broadcast_signal(SIGTERM, false); + broadcast_signal(SIGTERM, false, true); /* And switch root */ r = switch_root(switch_root_dir);