main.c revision 5a85ca1cb622fda4a39c8a6f00dccea7f8a1e82a
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering This file is part of systemd.
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering Copyright 2010 Lennart Poettering
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering systemd is free software; you can redistribute it and/or modify it
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering under the terms of the GNU Lesser General Public License as published by
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering the Free Software Foundation; either version 2.1 of the License, or
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering (at your option) any later version.
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering systemd is distributed in the hope that it will be useful, but
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering WITHOUT ANY WARRANTY; without even the implied warranty of
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering Lesser General Public License for more details.
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering You should have received a copy of the GNU Lesser General Public License
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering along with systemd; If not, see <http://www.gnu.org/licenses/>.
801ad6a6a9cd8fbd58b9f9c27f20dbb3c87d47ddLennart Poetteringstatic SystemdRunningAs arg_running_as = _SYSTEMD_RUNNING_AS_INVALID;
801ad6a6a9cd8fbd58b9f9c27f20dbb3c87d47ddLennart Poetteringstatic bool arg_dump_core = true;
801ad6a6a9cd8fbd58b9f9c27f20dbb3c87d47ddLennart Poetteringstatic bool arg_crash_shell = false;
801ad6a6a9cd8fbd58b9f9c27f20dbb3c87d47ddLennart Poetteringstatic bool arg_confirm_spawn = false;
801ad6a6a9cd8fbd58b9f9c27f20dbb3c87d47ddLennart Poetteringstatic ShowStatus arg_show_status = _SHOW_STATUS_UNSET;
801ad6a6a9cd8fbd58b9f9c27f20dbb3c87d47ddLennart Poetteringstatic bool arg_switched_root = false;
801ad6a6a9cd8fbd58b9f9c27f20dbb3c87d47ddLennart Poetteringstatic char ***arg_join_controllers = NULL;
801ad6a6a9cd8fbd58b9f9c27f20dbb3c87d47ddLennart Poetteringstatic ExecOutput arg_default_std_output = EXEC_OUTPUT_JOURNAL;
801ad6a6a9cd8fbd58b9f9c27f20dbb3c87d47ddLennart Poetteringstatic ExecOutput arg_default_std_error = EXEC_OUTPUT_INHERIT;
801ad6a6a9cd8fbd58b9f9c27f20dbb3c87d47ddLennart Poetteringstatic usec_t arg_default_restart_usec = DEFAULT_RESTART_USEC;
801ad6a6a9cd8fbd58b9f9c27f20dbb3c87d47ddLennart Poetteringstatic usec_t arg_default_timeout_start_usec = DEFAULT_TIMEOUT_USEC;
801ad6a6a9cd8fbd58b9f9c27f20dbb3c87d47ddLennart Poetteringstatic usec_t arg_default_timeout_stop_usec = DEFAULT_TIMEOUT_USEC;
801ad6a6a9cd8fbd58b9f9c27f20dbb3c87d47ddLennart Poetteringstatic usec_t arg_default_start_limit_interval = DEFAULT_START_LIMIT_INTERVAL;
801ad6a6a9cd8fbd58b9f9c27f20dbb3c87d47ddLennart Poetteringstatic unsigned arg_default_start_limit_burst = DEFAULT_START_LIMIT_BURST;
801ad6a6a9cd8fbd58b9f9c27f20dbb3c87d47ddLennart Poetteringstatic usec_t arg_shutdown_watchdog = 10 * USEC_PER_MINUTE;
801ad6a6a9cd8fbd58b9f9c27f20dbb3c87d47ddLennart Poetteringstatic char **arg_default_environment = NULL;
801ad6a6a9cd8fbd58b9f9c27f20dbb3c87d47ddLennart Poetteringstatic struct rlimit *arg_default_rlimit[_RLIMIT_MAX] = {};
801ad6a6a9cd8fbd58b9f9c27f20dbb3c87d47ddLennart Poetteringstatic uint64_t arg_capability_bounding_set_drop = 0;
801ad6a6a9cd8fbd58b9f9c27f20dbb3c87d47ddLennart Poetteringstatic nsec_t arg_timer_slack_nsec = (nsec_t) -1;
801ad6a6a9cd8fbd58b9f9c27f20dbb3c87d47ddLennart Poetteringstatic usec_t arg_default_timer_accuracy_usec = 1 * USEC_PER_MINUTE;
faa133f3aa7a18f26563dc5d6b95898cb315c37aLennart Poetteringstatic bool arg_default_cpu_accounting = false;
faa133f3aa7a18f26563dc5d6b95898cb315c37aLennart Poetteringstatic bool arg_default_blockio_accounting = false;
faa133f3aa7a18f26563dc5d6b95898cb315c37aLennart Poetteringstatic bool arg_default_memory_accounting = false;
faa133f3aa7a18f26563dc5d6b95898cb315c37aLennart Poettering /* Pass this on immediately, if this is not PID 1 */
faa133f3aa7a18f26563dc5d6b95898cb315c37aLennart Poettering log_error("Caught <%s>, not dumping core.", signal_to_string(sig));
1b4f6e79ec51a57003896a0b605fba427b4a98d2Lennart Poettering /* We want to wait for the core process, hence let's enable SIGCHLD */
faa133f3aa7a18f26563dc5d6b95898cb315c37aLennart Poettering log_error("Caught <%s>, cannot fork for core dump: %m", signal_to_string(sig));
faa133f3aa7a18f26563dc5d6b95898cb315c37aLennart Poettering else if (pid == 0) {
faa133f3aa7a18f26563dc5d6b95898cb315c37aLennart Poettering /* Enable default signal handler for core dump */
faa133f3aa7a18f26563dc5d6b95898cb315c37aLennart Poettering /* Don't limit the core dump size */
faa133f3aa7a18f26563dc5d6b95898cb315c37aLennart Poettering /* Just to be sure... */
faa133f3aa7a18f26563dc5d6b95898cb315c37aLennart Poettering /* Raise the signal again */
28b9b7640603f88cb49f95609331fa5072715f15Lennart Poettering assert_not_reached("We shouldn't be here...");
28b9b7640603f88cb49f95609331fa5072715f15Lennart Poettering /* Order things nicely. */
faa133f3aa7a18f26563dc5d6b95898cb315c37aLennart Poettering log_error("Caught <%s>, waitpid() failed: %s", signal_to_string(sig), strerror(-r));
4d247a6cd3f69acbc5a09e8ac7e4fbb50eaa3228Lennart Poettering log_error("Caught <%s>, core dump failed.", signal_to_string(sig));
faa133f3aa7a18f26563dc5d6b95898cb315c37aLennart Poettering log_error("Caught <%s>, dumped core as pid "PID_FMT".", signal_to_string(sig), pid);
faa133f3aa7a18f26563dc5d6b95898cb315c37aLennart Poettering .sa_flags = SA_NOCLDSTOP|SA_NOCLDWAIT|SA_RESTART,
801ad6a6a9cd8fbd58b9f9c27f20dbb3c87d47ddLennart Poettering log_info("Executing crash shell in 10s...");
faa133f3aa7a18f26563dc5d6b95898cb315c37aLennart Poettering /* Let the kernel reap children for us */
faa133f3aa7a18f26563dc5d6b95898cb315c37aLennart Poettering assert_se(sigaction(SIGCHLD, &sa, NULL) == 0);
801ad6a6a9cd8fbd58b9f9c27f20dbb3c87d47ddLennart Poettering log_error("Failed to fork off crash shell: %m");
801ad6a6a9cd8fbd58b9f9c27f20dbb3c87d47ddLennart Poettering else if (pid == 0) {
faa133f3aa7a18f26563dc5d6b95898cb315c37aLennart Poettering log_info("Successfully spawned crash shell as pid "PID_FMT".", pid);
801ad6a6a9cd8fbd58b9f9c27f20dbb3c87d47ddLennart Poetteringstatic void install_crash_handler(void) {
801ad6a6a9cd8fbd58b9f9c27f20dbb3c87d47ddLennart Poettering sigaction_many(&sa, SIGNALS_CRASH_HANDLER, -1);
801ad6a6a9cd8fbd58b9f9c27f20dbb3c87d47ddLennart Poettering /* If we are init, we connect stdin/stdout/stderr to /dev/null
801ad6a6a9cd8fbd58b9f9c27f20dbb3c87d47ddLennart Poettering * and make sure we don't have a controlling tty. */
5d27351f8546530cf779847b0b04b0172c09f9d0Tom Gundersen tty_fd = open_terminal("/dev/console", O_WRONLY|O_NOCTTY|O_CLOEXEC);
5d27351f8546530cf779847b0b04b0172c09f9d0Tom Gundersen log_error("Failed to open /dev/console: %s", strerror(-tty_fd));
801ad6a6a9cd8fbd58b9f9c27f20dbb3c87d47ddLennart Poettering /* We don't want to force text mode.
801ad6a6a9cd8fbd58b9f9c27f20dbb3c87d47ddLennart Poettering * plymouth may be showing pictures already from initrd. */
801ad6a6a9cd8fbd58b9f9c27f20dbb3c87d47ddLennart Poettering log_error("Failed to reset /dev/console: %s", strerror(-r));
801ad6a6a9cd8fbd58b9f9c27f20dbb3c87d47ddLennart Poetteringstatic int set_default_unit(const char *u) {
547973dea7abd6c124ff6c79fe2bbe322a7314aeLennart Poetteringstatic int parse_proc_cmdline_item(const char *key, const char *value) {
547973dea7abd6c124ff6c79fe2bbe322a7314aeLennart Poettering static const char * const rlmap[] = {
322345fdb9865ef2477fba8e4bdde0e1183ef505Lennart Poettering if (streq(key, "systemd.unit") && value) {
faa133f3aa7a18f26563dc5d6b95898cb315c37aLennart Poettering } else if (streq(key, "rd.systemd.unit") && value) {
322345fdb9865ef2477fba8e4bdde0e1183ef505Lennart Poettering } else if (streq(key, "systemd.log_target") && value) {
322345fdb9865ef2477fba8e4bdde0e1183ef505Lennart Poettering if (log_set_target_from_string(value) < 0)
322345fdb9865ef2477fba8e4bdde0e1183ef505Lennart Poettering log_warning("Failed to parse log target %s. Ignoring.", value);
322345fdb9865ef2477fba8e4bdde0e1183ef505Lennart Poettering } else if (streq(key, "systemd.log_level") && value) {
322345fdb9865ef2477fba8e4bdde0e1183ef505Lennart Poettering if (log_set_max_level_from_string(value) < 0)
322345fdb9865ef2477fba8e4bdde0e1183ef505Lennart Poettering log_warning("Failed to parse log level %s. Ignoring.", value);
322345fdb9865ef2477fba8e4bdde0e1183ef505Lennart Poettering } else if (streq(key, "systemd.log_color") && value) {
322345fdb9865ef2477fba8e4bdde0e1183ef505Lennart Poettering if (log_show_color_from_string(value) < 0)
d5099efc47d4e6ac60816b5381a5f607ab03f06eMichal Schmidt log_warning("Failed to parse log color setting %s. Ignoring.", value);
d5099efc47d4e6ac60816b5381a5f607ab03f06eMichal Schmidt } else if (streq(key, "systemd.log_location") && value) {
d5099efc47d4e6ac60816b5381a5f607ab03f06eMichal Schmidt if (log_show_location_from_string(value) < 0)
2d4c5cbc0ed3ccb09dc086a040088b454c22c644Lennart Poettering log_warning("Failed to parse log location setting %s. Ignoring.", value);
2d4c5cbc0ed3ccb09dc086a040088b454c22c644Lennart Poettering } else if (streq(key, "systemd.dump_core") && value) {
2d4c5cbc0ed3ccb09dc086a040088b454c22c644Lennart Poettering log_warning("Failed to parse dump core switch %s. Ignoring.", value);
2d4c5cbc0ed3ccb09dc086a040088b454c22c644Lennart Poettering } else if (streq(key, "systemd.crash_shell") && value) {
2d4c5cbc0ed3ccb09dc086a040088b454c22c644Lennart Poettering log_warning("Failed to parse crash shell switch %s. Ignoring.", value);
2d4c5cbc0ed3ccb09dc086a040088b454c22c644Lennart Poettering } else if (streq(key, "systemd.crash_chvt") && value) {
2d4c5cbc0ed3ccb09dc086a040088b454c22c644Lennart Poettering log_warning("Failed to parse crash chvt switch %s. Ignoring.", value);
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering } else if (streq(key, "systemd.confirm_spawn") && value) {
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering log_warning("Failed to parse confirm spawn switch %s. Ignoring.", value);
faa133f3aa7a18f26563dc5d6b95898cb315c37aLennart Poettering } else if (streq(key, "systemd.show_status") && value) {
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering r = parse_show_status(value, &arg_show_status);
8bf52d3d17d364438191077d0750b8b80b5dc53aLennart Poettering log_warning("Failed to parse show status switch %s. Ignoring.", value);
8bf52d3d17d364438191077d0750b8b80b5dc53aLennart Poettering } else if (streq(key, "systemd.default_standard_output") && value) {
8bf52d3d17d364438191077d0750b8b80b5dc53aLennart Poettering log_warning("Failed to parse default standard output switch %s. Ignoring.", value);
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering } else if (streq(key, "systemd.default_standard_error") && value) {
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering log_warning("Failed to parse default standard error switch %s. Ignoring.", value);
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering } else if (streq(key, "systemd.setenv") && value) {
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering env = strv_env_set(arg_default_environment, value);
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering log_warning("Setting environment variable '%s' failed, ignoring: %s", value, strerror(ENOMEM));
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering log_warning("Environment variable name '%s' is not valid. Ignoring.", value);
faa133f3aa7a18f26563dc5d6b95898cb315c37aLennart Poettering } else if (!streq(key, "systemd.restore_state") &&
9de3e3294065e8697ff10130b53f274319cdcf6fZbigniew Jędrzejewski-Szmek !streq(key, "systemd.gpt_auto") &&
9c92ce6d67f88beb31dd6555d12ae3f632218a39Lennart Poettering (startswith(key, "systemd.") || startswith(key, "rd.systemd."))) {
9c92ce6d67f88beb31dd6555d12ae3f632218a39Lennart Poettering const char *c;
9c92ce6d67f88beb31dd6555d12ae3f632218a39Lennart Poettering /* Ignore systemd.journald.xyz and friends */
9de3e3294065e8697ff10130b53f274319cdcf6fZbigniew Jędrzejewski-Szmek if (c[strcspn(c, ".=")] != '.') {
9de3e3294065e8697ff10130b53f274319cdcf6fZbigniew Jędrzejewski-Szmek log_warning("Unknown kernel switch %s. Ignoring.", key);
9de3e3294065e8697ff10130b53f274319cdcf6fZbigniew Jędrzejewski-Szmek "systemd.unit=UNIT Default unit to start\n"
9c92ce6d67f88beb31dd6555d12ae3f632218a39Lennart Poettering "rd.systemd.unit=UNIT Default unit to start when run in initrd\n"
9de3e3294065e8697ff10130b53f274319cdcf6fZbigniew Jędrzejewski-Szmek "systemd.dump_core=0|1 Dump core on crash\n"
9c92ce6d67f88beb31dd6555d12ae3f632218a39Lennart Poettering "systemd.crash_shell=0|1 Run shell on crash\n"
2001c80560e3dae69e14fd994d3978c187af48b8Lennart Poettering "systemd.crash_chvt=N Change to VT #N on crash\n"
9de3e3294065e8697ff10130b53f274319cdcf6fZbigniew Jędrzejewski-Szmek "systemd.confirm_spawn=0|1 Confirm every process spawn\n"
9c92ce6d67f88beb31dd6555d12ae3f632218a39Lennart Poettering "systemd.show_status=0|1|auto Show status updates on the console during bootup\n"
9de3e3294065e8697ff10130b53f274319cdcf6fZbigniew Jędrzejewski-Szmek "systemd.log_target=console|kmsg|journal|journal-or-kmsg|syslog|syslog-or-kmsg|null\n"
7e8e0422aeb16f2a09a40546c61df753d10029b6Lennart Poettering " Log target\n"
7e8e0422aeb16f2a09a40546c61df753d10029b6Lennart Poettering "systemd.log_level=LEVEL Log level\n"
9de3e3294065e8697ff10130b53f274319cdcf6fZbigniew Jędrzejewski-Szmek "systemd.log_color=0|1 Highlight important log messages\n"
9c92ce6d67f88beb31dd6555d12ae3f632218a39Lennart Poettering "systemd.log_location=0|1 Include code location in log messages\n"
9de3e3294065e8697ff10130b53f274319cdcf6fZbigniew Jędrzejewski-Szmek "systemd.default_standard_output=null|tty|syslog|syslog+console|kmsg|kmsg+console|journal|journal+console\n"
946c70944ebdf428ffeb9991a7449edbd4011461Zbigniew Jędrzejewski-Szmek " Set default log output for services\n"
9de3e3294065e8697ff10130b53f274319cdcf6fZbigniew Jędrzejewski-Szmek "systemd.default_standard_error=null|tty|syslog|syslog+console|kmsg|kmsg+console|journal|journal+console\n"
9c92ce6d67f88beb31dd6555d12ae3f632218a39Lennart Poettering " Set default log error output for services\n"
abf126a355e2f2b62b6c51ab3bb37895d1e3eee7Tom Gundersen "systemd.setenv=ASSIGNMENT Set an environment variable for all spawned processes\n"
abf126a355e2f2b62b6c51ab3bb37895d1e3eee7Tom Gundersen "systemd.restore_state=0|1 Restore backlight/rfkill state at boot\n");
42cc2eebb01056beb7acd3ecfe8e533558237f84Lennart Poettering } else if (streq(key, "quiet") && !value) {
8db0d2f5c37e7e8f5bfce016cfdad7947a3ea939Zbigniew Jędrzejewski-Szmek } else if (streq(key, "debug") && !value) {
8db0d2f5c37e7e8f5bfce016cfdad7947a3ea939Zbigniew Jędrzejewski-Szmek log_set_target(LOG_TARGET_CONSOLE);
151226ab4bf276d60d51864330a99f886b923697Zbigniew Jędrzejewski-Szmek } else if (!in_initrd() && !value) {
151226ab4bf276d60d51864330a99f886b923697Zbigniew Jędrzejewski-Szmek /* SysV compatibility */
5d45a8808431987c370706d365fb0cc95cf03d52Tom Gundersen const char *filename, \
322345fdb9865ef2477fba8e4bdde0e1183ef505Lennart Poettering log_syntax(unit, LOG_ERR, filename, line, -r, \
623a4c97b9175f95c4b1c6fc34e36c56f1e4ddbfLennart PoetteringDEFINE_SETTER(config_parse_level2, log_set_max_level_from_string, "log level")
623a4c97b9175f95c4b1c6fc34e36c56f1e4ddbfLennart PoetteringDEFINE_SETTER(config_parse_target, log_set_target_from_string, "target")
623a4c97b9175f95c4b1c6fc34e36c56f1e4ddbfLennart PoetteringDEFINE_SETTER(config_parse_color, log_show_color_from_string, "color" )
623a4c97b9175f95c4b1c6fc34e36c56f1e4ddbfLennart PoetteringDEFINE_SETTER(config_parse_location, log_show_location_from_string, "location")
623a4c97b9175f95c4b1c6fc34e36c56f1e4ddbfLennart Poettering FOREACH_WORD_QUOTED(w, l, rvalue, state) {
78c6a153c47f8d597c827bdcaf8c4e42ac87f738Lennart Poettering if (!(t = strndup(w, l)))
78c6a153c47f8d597c827bdcaf8c4e42ac87f738Lennart Poettering log_syntax(unit, LOG_ERR, filename, line, -r,
78c6a153c47f8d597c827bdcaf8c4e42ac87f738Lennart Poettering "Failed to parse CPU affinity '%s'", rvalue);
78c6a153c47f8d597c827bdcaf8c4e42ac87f738Lennart Poettering CPU_SET_S(cpu, CPU_ALLOC_SIZE(ncpus), c);
78c6a153c47f8d597c827bdcaf8c4e42ac87f738Lennart Poettering if (sched_setaffinity(0, CPU_ALLOC_SIZE(ncpus), c) < 0)
78c6a153c47f8d597c827bdcaf8c4e42ac87f738Lennart Poettering log_warning_unit(unit, "Failed to set CPU affinity: %m");
9c92ce6d67f88beb31dd6555d12ae3f632218a39Lennart Poettering log_syntax(unit, LOG_ERR, filename, line, -k,
9c92ce6d67f88beb31dd6555d12ae3f632218a39Lennart Poettering "Failed to parse show status setting, ignoring: %s", rvalue);
2d4c5cbc0ed3ccb09dc086a040088b454c22c644Lennart Poetteringstatic void strv_free_free(char ***l) {
2001c80560e3dae69e14fd994d3978c187af48b8Lennart Poettering for (i = l; *i; i++)
322345fdb9865ef2477fba8e4bdde0e1183ef505Lennart Poetteringstatic void free_join_controllers(void) {
7e8e0422aeb16f2a09a40546c61df753d10029b6Lennart Poetteringstatic int config_parse_join_controllers(const char *unit,
0dae31d468b1a0e22d98921f7b0dbd92fd217167Zbigniew Jędrzejewski-Szmek FOREACH_WORD_QUOTED(w, length, rvalue, state) {
151226ab4bf276d60d51864330a99f886b923697Zbigniew Jędrzejewski-Szmek for (a = arg_join_controllers; *a; a++) {
50f1e641a93cacfc693b0c3d300bee5df0c8c460Tom Gundersen if (strv_extend_strv(&l, *a) < 0) {
0dae31d468b1a0e22d98921f7b0dbd92fd217167Zbigniew Jędrzejewski-Szmek strv_free_free(arg_join_controllers);
0dae31d468b1a0e22d98921f7b0dbd92fd217167Zbigniew Jędrzejewski-Szmekstatic int parse_config_file(void) {
0dae31d468b1a0e22d98921f7b0dbd92fd217167Zbigniew Jędrzejewski-Szmek const ConfigTableItem items[] = {
0dae31d468b1a0e22d98921f7b0dbd92fd217167Zbigniew Jędrzejewski-Szmek { "Manager", "LogLevel", config_parse_level2, 0, NULL },
0dae31d468b1a0e22d98921f7b0dbd92fd217167Zbigniew Jędrzejewski-Szmek { "Manager", "LogTarget", config_parse_target, 0, NULL },
0dae31d468b1a0e22d98921f7b0dbd92fd217167Zbigniew Jędrzejewski-Szmek { "Manager", "LogColor", config_parse_color, 0, NULL },
0dae31d468b1a0e22d98921f7b0dbd92fd217167Zbigniew Jędrzejewski-Szmek { "Manager", "LogLocation", config_parse_location, 0, NULL },
0dae31d468b1a0e22d98921f7b0dbd92fd217167Zbigniew Jędrzejewski-Szmek { "Manager", "DumpCore", config_parse_bool, 0, &arg_dump_core },
0dae31d468b1a0e22d98921f7b0dbd92fd217167Zbigniew Jędrzejewski-Szmek { "Manager", "CrashShell", config_parse_bool, 0, &arg_crash_shell },
0dae31d468b1a0e22d98921f7b0dbd92fd217167Zbigniew Jędrzejewski-Szmek { "Manager", "ShowStatus", config_parse_show_status, 0, &arg_show_status },
0dae31d468b1a0e22d98921f7b0dbd92fd217167Zbigniew Jędrzejewski-Szmek { "Manager", "CrashChVT", config_parse_int, 0, &arg_crash_chvt },
0dae31d468b1a0e22d98921f7b0dbd92fd217167Zbigniew Jędrzejewski-Szmek { "Manager", "CPUAffinity", config_parse_cpu_affinity2, 0, NULL },
0dae31d468b1a0e22d98921f7b0dbd92fd217167Zbigniew Jędrzejewski-Szmek { "Manager", "JoinControllers", config_parse_join_controllers, 0, &arg_join_controllers },
0dae31d468b1a0e22d98921f7b0dbd92fd217167Zbigniew Jędrzejewski-Szmek { "Manager", "RuntimeWatchdogSec", config_parse_sec, 0, &arg_runtime_watchdog },
0dae31d468b1a0e22d98921f7b0dbd92fd217167Zbigniew Jędrzejewski-Szmek { "Manager", "ShutdownWatchdogSec", config_parse_sec, 0, &arg_shutdown_watchdog },
0dae31d468b1a0e22d98921f7b0dbd92fd217167Zbigniew Jędrzejewski-Szmek { "Manager", "CapabilityBoundingSet", config_parse_bounding_set, 0, &arg_capability_bounding_set_drop },
0dae31d468b1a0e22d98921f7b0dbd92fd217167Zbigniew Jędrzejewski-Szmek { "Manager", "SystemCallArchitectures", config_parse_syscall_archs, 0, &arg_syscall_archs },
7c6423e19136a7b7b6ef3fe06b94822e582dda27Tom Gundersen { "Manager", "TimerSlackNSec", config_parse_nsec, 0, &arg_timer_slack_nsec },
7c6423e19136a7b7b6ef3fe06b94822e582dda27Tom Gundersen { "Manager", "DefaultTimerAccuracySec", config_parse_sec, 0, &arg_default_timer_accuracy_usec },
7c6423e19136a7b7b6ef3fe06b94822e582dda27Tom Gundersen { "Manager", "DefaultStandardOutput", config_parse_output, 0, &arg_default_std_output },
7c6423e19136a7b7b6ef3fe06b94822e582dda27Tom Gundersen { "Manager", "DefaultStandardError", config_parse_output, 0, &arg_default_std_error },
7c6423e19136a7b7b6ef3fe06b94822e582dda27Tom Gundersen { "Manager", "DefaultTimeoutStartSec", config_parse_sec, 0, &arg_default_timeout_start_usec },
7c6423e19136a7b7b6ef3fe06b94822e582dda27Tom Gundersen { "Manager", "DefaultTimeoutStopSec", config_parse_sec, 0, &arg_default_timeout_stop_usec },
7c6423e19136a7b7b6ef3fe06b94822e582dda27Tom Gundersen { "Manager", "DefaultRestartSec", config_parse_sec, 0, &arg_default_restart_usec },
7c6423e19136a7b7b6ef3fe06b94822e582dda27Tom Gundersen { "Manager", "DefaultStartLimitInterval", config_parse_sec, 0, &arg_default_start_limit_interval },
7c6423e19136a7b7b6ef3fe06b94822e582dda27Tom Gundersen { "Manager", "DefaultStartLimitBurst", config_parse_unsigned, 0, &arg_default_start_limit_burst },
7c6423e19136a7b7b6ef3fe06b94822e582dda27Tom Gundersen { "Manager", "DefaultEnvironment", config_parse_environ, 0, &arg_default_environment },
7c6423e19136a7b7b6ef3fe06b94822e582dda27Tom Gundersen { "Manager", "DefaultLimitCPU", config_parse_limit, 0, &arg_default_rlimit[RLIMIT_CPU] },
7c6423e19136a7b7b6ef3fe06b94822e582dda27Tom Gundersen { "Manager", "DefaultLimitFSIZE", config_parse_limit, 0, &arg_default_rlimit[RLIMIT_FSIZE] },
7c6423e19136a7b7b6ef3fe06b94822e582dda27Tom Gundersen { "Manager", "DefaultLimitDATA", config_parse_limit, 0, &arg_default_rlimit[RLIMIT_DATA] },
7c6423e19136a7b7b6ef3fe06b94822e582dda27Tom Gundersen { "Manager", "DefaultLimitSTACK", config_parse_limit, 0, &arg_default_rlimit[RLIMIT_STACK] },
50f1e641a93cacfc693b0c3d300bee5df0c8c460Tom Gundersen { "Manager", "DefaultLimitCORE", config_parse_limit, 0, &arg_default_rlimit[RLIMIT_CORE] },
50f1e641a93cacfc693b0c3d300bee5df0c8c460Tom Gundersen { "Manager", "DefaultLimitRSS", config_parse_limit, 0, &arg_default_rlimit[RLIMIT_RSS] },
50f1e641a93cacfc693b0c3d300bee5df0c8c460Tom Gundersen { "Manager", "DefaultLimitNOFILE", config_parse_limit, 0, &arg_default_rlimit[RLIMIT_NOFILE] },
cb57dd41595adddb08095298bb1ed258c8ea4877Tom Gundersen { "Manager", "DefaultLimitAS", config_parse_limit, 0, &arg_default_rlimit[RLIMIT_AS] },
50f1e641a93cacfc693b0c3d300bee5df0c8c460Tom Gundersen { "Manager", "DefaultLimitNPROC", config_parse_limit, 0, &arg_default_rlimit[RLIMIT_NPROC] },
50f1e641a93cacfc693b0c3d300bee5df0c8c460Tom Gundersen { "Manager", "DefaultLimitMEMLOCK", config_parse_limit, 0, &arg_default_rlimit[RLIMIT_MEMLOCK] },
50f1e641a93cacfc693b0c3d300bee5df0c8c460Tom Gundersen { "Manager", "DefaultLimitLOCKS", config_parse_limit, 0, &arg_default_rlimit[RLIMIT_LOCKS] },
cb57dd41595adddb08095298bb1ed258c8ea4877Tom Gundersen { "Manager", "DefaultLimitSIGPENDING", config_parse_limit, 0, &arg_default_rlimit[RLIMIT_SIGPENDING] },
50f1e641a93cacfc693b0c3d300bee5df0c8c460Tom Gundersen { "Manager", "DefaultLimitMSGQUEUE", config_parse_limit, 0, &arg_default_rlimit[RLIMIT_MSGQUEUE] },
2c1fb4f71206bf970d493294208c5d7597194856Lennart Poettering { "Manager", "DefaultLimitNICE", config_parse_limit, 0, &arg_default_rlimit[RLIMIT_NICE] },
50f1e641a93cacfc693b0c3d300bee5df0c8c460Tom Gundersen { "Manager", "DefaultLimitRTPRIO", config_parse_limit, 0, &arg_default_rlimit[RLIMIT_RTPRIO] },
50f1e641a93cacfc693b0c3d300bee5df0c8c460Tom Gundersen { "Manager", "DefaultLimitRTTIME", config_parse_limit, 0, &arg_default_rlimit[RLIMIT_RTTIME] },
50f1e641a93cacfc693b0c3d300bee5df0c8c460Tom Gundersen { "Manager", "DefaultCPUAccounting", config_parse_bool, 0, &arg_default_cpu_accounting },
50f1e641a93cacfc693b0c3d300bee5df0c8c460Tom Gundersen { "Manager", "DefaultBlockIOAccounting", config_parse_bool, 0, &arg_default_blockio_accounting },
50f1e641a93cacfc693b0c3d300bee5df0c8c460Tom Gundersen { "Manager", "DefaultMemoryAccounting", config_parse_bool, 0, &arg_default_memory_accounting },
50f1e641a93cacfc693b0c3d300bee5df0c8c460Tom Gundersen fn = arg_running_as == SYSTEMD_SYSTEM ? PKGSYSCONFDIR "/system.conf" : PKGSYSCONFDIR "/user.conf";
50f1e641a93cacfc693b0c3d300bee5df0c8c460Tom Gundersen log_warning("Failed to open configuration file '%s': %m", fn);
2001c80560e3dae69e14fd994d3978c187af48b8Lennart Poettering r = config_parse(NULL, fn, f, "Manager\0", config_item_table_lookup, (void*) items, false, false, NULL);
2001c80560e3dae69e14fd994d3978c187af48b8Lennart Poettering log_warning("Failed to parse configuration file: %s", strerror(-r));
2001c80560e3dae69e14fd994d3978c187af48b8Lennart Poetteringstatic int parse_argv(int argc, char *argv[]) {
2001c80560e3dae69e14fd994d3978c187af48b8Lennart Poettering { "log-level", required_argument, NULL, ARG_LOG_LEVEL },
2001c80560e3dae69e14fd994d3978c187af48b8Lennart Poettering { "log-target", required_argument, NULL, ARG_LOG_TARGET },
2001c80560e3dae69e14fd994d3978c187af48b8Lennart Poettering { "log-color", optional_argument, NULL, ARG_LOG_COLOR },
2001c80560e3dae69e14fd994d3978c187af48b8Lennart Poettering { "log-location", optional_argument, NULL, ARG_LOG_LOCATION },
2001c80560e3dae69e14fd994d3978c187af48b8Lennart Poettering { "unit", required_argument, NULL, ARG_UNIT },
2001c80560e3dae69e14fd994d3978c187af48b8Lennart Poettering { "system", no_argument, NULL, ARG_SYSTEM },
8db0d2f5c37e7e8f5bfce016cfdad7947a3ea939Zbigniew Jędrzejewski-Szmek { "test", no_argument, NULL, ARG_TEST },
2d4c5cbc0ed3ccb09dc086a040088b454c22c644Lennart Poettering { "version", no_argument, NULL, ARG_VERSION },
322345fdb9865ef2477fba8e4bdde0e1183ef505Lennart Poettering { "dump-configuration-items", no_argument, NULL, ARG_DUMP_CONFIGURATION_ITEMS },
2d4c5cbc0ed3ccb09dc086a040088b454c22c644Lennart Poettering { "dump-core", optional_argument, NULL, ARG_DUMP_CORE },
322345fdb9865ef2477fba8e4bdde0e1183ef505Lennart Poettering { "crash-shell", optional_argument, NULL, ARG_CRASH_SHELL },
7b50eb2efa122200e39646c19a29abab302f7d24Lennart Poettering { "confirm-spawn", optional_argument, NULL, ARG_CONFIRM_SPAWN },
7b50eb2efa122200e39646c19a29abab302f7d24Lennart Poettering { "show-status", optional_argument, NULL, ARG_SHOW_STATUS },
7b50eb2efa122200e39646c19a29abab302f7d24Lennart Poettering { "deserialize", required_argument, NULL, ARG_DESERIALIZE },
2d4c5cbc0ed3ccb09dc086a040088b454c22c644Lennart Poettering { "switched-root", no_argument, NULL, ARG_SWITCHED_ROOT },
2d4c5cbc0ed3ccb09dc086a040088b454c22c644Lennart Poettering { "default-standard-output", required_argument, NULL, ARG_DEFAULT_STD_OUTPUT, },
7b50eb2efa122200e39646c19a29abab302f7d24Lennart Poettering { "default-standard-error", required_argument, NULL, ARG_DEFAULT_STD_ERROR, },
7b50eb2efa122200e39646c19a29abab302f7d24Lennart Poettering while ((c = getopt_long(argc, argv, "hDbsz:", options, NULL)) >= 0)
2d4c5cbc0ed3ccb09dc086a040088b454c22c644Lennart Poettering r = log_set_max_level_from_string(optarg);
2d4c5cbc0ed3ccb09dc086a040088b454c22c644Lennart Poettering log_error("Failed to parse log level %s.", optarg);
7b50eb2efa122200e39646c19a29abab302f7d24Lennart Poettering log_error("Failed to parse log target %s.", optarg);
2e276efc7b0398a3086629a52970bdd4ab7252f9Zbigniew Jędrzejewski-Szmek r = log_show_color_from_string(optarg);
7b50eb2efa122200e39646c19a29abab302f7d24Lennart Poettering log_error("Failed to parse log color setting %s.", optarg);
2d4c5cbc0ed3ccb09dc086a040088b454c22c644Lennart Poettering r = log_show_location_from_string(optarg);
7b50eb2efa122200e39646c19a29abab302f7d24Lennart Poettering log_error("Failed to parse log location setting %s.", optarg);
8db0d2f5c37e7e8f5bfce016cfdad7947a3ea939Zbigniew Jędrzejewski-Szmek r = exec_output_from_string(optarg);
7b50eb2efa122200e39646c19a29abab302f7d24Lennart Poettering log_error("Failed to parse default standard output setting %s.", optarg);
2d4c5cbc0ed3ccb09dc086a040088b454c22c644Lennart Poettering log_error("Failed to parse default standard error output setting %s.", optarg);
946c70944ebdf428ffeb9991a7449edbd4011461Zbigniew Jędrzejewski-Szmek log_error("Failed to set default unit %s: %s", optarg, strerror(-r));
8db0d2f5c37e7e8f5bfce016cfdad7947a3ea939Zbigniew Jędrzejewski-Szmek arg_running_as = SYSTEMD_SYSTEM;
0dae31d468b1a0e22d98921f7b0dbd92fd217167Zbigniew Jędrzejewski-Szmek case ARG_DUMP_CONFIGURATION_ITEMS:
0dae31d468b1a0e22d98921f7b0dbd92fd217167Zbigniew Jędrzejewski-Szmek arg_action = ACTION_DUMP_CONFIGURATION_ITEMS;
abf126a355e2f2b62b6c51ab3bb37895d1e3eee7Tom Gundersen log_error("Failed to parse dump core boolean %s.", optarg);
abf126a355e2f2b62b6c51ab3bb37895d1e3eee7Tom Gundersen log_error("Failed to parse crash shell boolean %s.", optarg);
42cc2eebb01056beb7acd3ecfe8e533558237f84Lennart Poettering log_error("Failed to parse confirm spawn boolean %s.", optarg);
ff3d6560bead6879a2fed1bf99bfe8273b3723f1Zbigniew Jędrzejewski-Szmek r = parse_show_status(optarg, &arg_show_status);
ff3d6560bead6879a2fed1bf99bfe8273b3723f1Zbigniew Jędrzejewski-Szmek log_error("Failed to parse show status boolean %s.", optarg);
8db0d2f5c37e7e8f5bfce016cfdad7947a3ea939Zbigniew Jędrzejewski-Szmek if (r < 0 || fd < 0) {
7b50eb2efa122200e39646c19a29abab302f7d24Lennart Poettering log_error("Failed to parse deserialize option %s.", optarg);
8db0d2f5c37e7e8f5bfce016cfdad7947a3ea939Zbigniew Jędrzejewski-Szmek return r < 0 ? r : -EINVAL;
151226ab4bf276d60d51864330a99f886b923697Zbigniew Jędrzejewski-Szmek log_error("Failed to open serialization fd: %m");
7c6423e19136a7b7b6ef3fe06b94822e582dda27Tom Gundersen /* Just to eat away the sysvinit kernel
151226ab4bf276d60d51864330a99f886b923697Zbigniew Jędrzejewski-Szmek * cmdline args without getopt() error
151226ab4bf276d60d51864330a99f886b923697Zbigniew Jędrzejewski-Szmek * messages that we'll parse in
151226ab4bf276d60d51864330a99f886b923697Zbigniew Jędrzejewski-Szmek * parse_proc_cmdline_word() or ignore. */
151226ab4bf276d60d51864330a99f886b923697Zbigniew Jędrzejewski-Szmek log_error("Unknown option code %c", c);
50f1e641a93cacfc693b0c3d300bee5df0c8c460Tom Gundersen /* Hmm, when we aren't run as init system
50f1e641a93cacfc693b0c3d300bee5df0c8c460Tom Gundersen * let's complain about excess arguments */
5d45a8808431987c370706d365fb0cc95cf03d52Tom Gundersen /* All /proc/cmdline arguments the kernel didn't
5d45a8808431987c370706d365fb0cc95cf03d52Tom Gundersen * understand it passed to us. We're not really
7b50eb2efa122200e39646c19a29abab302f7d24Lennart Poettering * interested in that usually since /proc/cmdline is
5d45a8808431987c370706d365fb0cc95cf03d52Tom Gundersen * more interesting and complete. With one exception:
5d45a8808431987c370706d365fb0cc95cf03d52Tom Gundersen * if we are run in a container /proc/cmdline is not
5d45a8808431987c370706d365fb0cc95cf03d52Tom Gundersen * relevant for the container, hence we rely on argv[]
5d45a8808431987c370706d365fb0cc95cf03d52Tom Gundersen * instead. */
7b50eb2efa122200e39646c19a29abab302f7d24Lennart Poettering log_error("Failed on cmdline argument %s: %s", *a, strerror(-r));
8db0d2f5c37e7e8f5bfce016cfdad7947a3ea939Zbigniew Jędrzejewski-Szmekstatic int help(void) {
7b50eb2efa122200e39646c19a29abab302f7d24Lennart Poettering "Starts up and maintains the system or user services.\n\n"
2d4c5cbc0ed3ccb09dc086a040088b454c22c644Lennart Poettering " -h --help Show this help\n"
8db0d2f5c37e7e8f5bfce016cfdad7947a3ea939Zbigniew Jędrzejewski-Szmek " --test Determine startup sequence, dump it and exit\n"
2d4c5cbc0ed3ccb09dc086a040088b454c22c644Lennart Poettering " --dump-configuration-items Dump understood unit configuration items\n"
7b50eb2efa122200e39646c19a29abab302f7d24Lennart Poettering " --unit=UNIT Set default unit\n"
7b50eb2efa122200e39646c19a29abab302f7d24Lennart Poettering " --system Run a system instance, even if PID != 1\n"
2d4c5cbc0ed3ccb09dc086a040088b454c22c644Lennart Poettering " --user Run a user instance\n"
322345fdb9865ef2477fba8e4bdde0e1183ef505Lennart Poettering " --dump-core[=0|1] Dump core on crash\n"
a8812dd7f161a3e459c1730ac92ff2bbc9986ff1Lennart Poettering " --crash-shell[=0|1] Run shell on crash\n"
a8812dd7f161a3e459c1730ac92ff2bbc9986ff1Lennart Poettering " --confirm-spawn[=0|1] Ask for confirmation when spawning processes\n"
a8812dd7f161a3e459c1730ac92ff2bbc9986ff1Lennart Poettering " --show-status[=0|1] Show status updates on the console during bootup\n"
a8812dd7f161a3e459c1730ac92ff2bbc9986ff1Lennart Poettering " --log-target=TARGET Set log target (console, journal, syslog, kmsg, journal-or-kmsg, syslog-or-kmsg, null)\n"
a8812dd7f161a3e459c1730ac92ff2bbc9986ff1Lennart Poettering " --log-level=LEVEL Set log level (debug, info, notice, warning, err, crit, alert, emerg)\n"
a8812dd7f161a3e459c1730ac92ff2bbc9986ff1Lennart Poettering " --log-color[=0|1] Highlight important log messages\n"
a8812dd7f161a3e459c1730ac92ff2bbc9986ff1Lennart Poettering " --log-location[=0|1] Include code location in log messages\n"
a8812dd7f161a3e459c1730ac92ff2bbc9986ff1Lennart Poettering " --default-standard-output= Set default standard output for services\n"
a8812dd7f161a3e459c1730ac92ff2bbc9986ff1Lennart Poettering " --default-standard-error= Set default standard error output for services\n",
a8812dd7f161a3e459c1730ac92ff2bbc9986ff1Lennart Poetteringstatic int version(void) {
a8812dd7f161a3e459c1730ac92ff2bbc9986ff1Lennart Poetteringstatic int prepare_reexecute(Manager *m, FILE **_f, FDSet **_fds, bool switching_root) {
a8812dd7f161a3e459c1730ac92ff2bbc9986ff1Lennart Poettering log_error("Failed to create serialization file: %s", strerror(-r));
a8812dd7f161a3e459c1730ac92ff2bbc9986ff1Lennart Poettering /* Make sure nothing is really destructed when we shut down */
a8812dd7f161a3e459c1730ac92ff2bbc9986ff1Lennart Poettering log_error("Failed to allocate fd set: %s", strerror(-r));
2001c80560e3dae69e14fd994d3978c187af48b8Lennart Poettering r = manager_serialize(m, f, fds, switching_root);
2001c80560e3dae69e14fd994d3978c187af48b8Lennart Poettering log_error("Failed to serialize state: %s", strerror(-r));
2001c80560e3dae69e14fd994d3978c187af48b8Lennart Poettering log_error("Failed to rewind serialization fd: %m");
4d247a6cd3f69acbc5a09e8ac7e4fbb50eaa3228Lennart Poettering log_error("Failed to disable O_CLOEXEC for serialization: %s", strerror(-r));
2001c80560e3dae69e14fd994d3978c187af48b8Lennart Poettering log_error("Failed to disable O_CLOEXEC for serialization fds: %s", strerror(-r));
8730bccfc59fe507bd3e0a3abcf411b497ac4f0eLennart Poetteringstatic int bump_rlimit_nofile(struct rlimit *saved_rlimit) {
8730bccfc59fe507bd3e0a3abcf411b497ac4f0eLennart Poettering /* Save the original RLIMIT_NOFILE so that we can reset it
8730bccfc59fe507bd3e0a3abcf411b497ac4f0eLennart Poettering * later when transitioning from the initrd to the main
8730bccfc59fe507bd3e0a3abcf411b497ac4f0eLennart Poettering * systemd or suchlike. */
8730bccfc59fe507bd3e0a3abcf411b497ac4f0eLennart Poettering if (getrlimit(RLIMIT_NOFILE, saved_rlimit) < 0) {
8730bccfc59fe507bd3e0a3abcf411b497ac4f0eLennart Poettering log_error("Reading RLIMIT_NOFILE failed: %m");
if (!rl)
return log_oom();
static void test_mtab(void) {
static const char ok[] =
if (r == -ENOENT)
"Please make sure to replace this file by a symlink to avoid incorrect or misleading mount(8) output.");
static void test_usr(void) {
log_warning("/usr appears to be on its own filesytem and is not already mounted. This is not a supported setup. "
"Consult http://freedesktop.org/wiki/Software/systemd/separate-usr-is-broken for more information.");
static int initialize_join_controllers(void) {
if (!arg_join_controllers)
return -ENOMEM;
return -ENOMEM;
#ifdef HAVE_SECCOMP
Iterator i;
void *id;
if (!seccomp)
return log_oom();
if (r == -EEXIST)
goto finish;
goto finish;
static int status_welcome(void) {
NULL);
if (r == -ENOENT) {
NULL);
if (r < 0 && r != -ENOENT)
static int write_container_id(void) {
if (isempty(c))
bool reexecute = false;
bool skip_setup = false;
bool loaded_policy = false;
bool arm_reboot_watchdog = false;
bool queue_default_job = false;
#ifdef HAVE_SYSV_COMPAT
skip_setup = true;
skip_setup = false;
umask(0);
log_open();
if (in_initrd())
if (!skip_setup) {
goto finish;
if (ima_setup() < 0)
goto finish;
goto finish;
goto finish;
if (!skip_setup) {
if (clock_is_localtime() > 0) {
int min;
} else if (!in_initrd()) {
log_open();
log_open();
goto finish;
r = initialize_join_controllers();
goto finish;
goto finish;
if (parse_config_file() < 0)
goto finish;
goto finish;
goto finish;
geteuid() == 0) {
goto finish;
sd_booted() <= 0) {
goto finish;
running_in_chroot() > 0) {
goto finish;
goto finish;
goto finish;
goto finish;
goto finish;
goto finish;
log_close();
goto finish;
if (arg_serialization)
setsid();
log_open();
goto finish;
if (virtualization)
if (in_initrd())
getuid(), t);
#ifdef HAVE_KMOD
kmod_setup();
test_mtab();
test_usr();
goto finish;
goto finish;
if (arg_syscall_archs) {
goto finish;
goto finish;
if (arg_serialization) {
if (queue_default_job) {
goto finish;
goto finish;
goto finish;
if (r == -EPERM) {
log_debug("Default target could not be isolated, starting instead: %s", bus_error_message(&error, r));
goto finish;
goto finish;
goto finish;
r = manager_loop(m);
goto finish;
switch (m->exit_code) {
case MANAGER_EXIT:
goto finish;
case MANAGER_RELOAD:
r = manager_reload(m);
case MANAGER_REEXECUTE:
goto finish;
reexecute = true;
goto finish;
case MANAGER_SWITCH_ROOT:
if (!switch_root_init)
goto finish;
reexecute = true;
goto finish;
case MANAGER_REBOOT:
case MANAGER_POWEROFF:
case MANAGER_HALT:
case MANAGER_KEXEC: {
goto finish;
manager_free(m);
m = NULL;
label_finish();
if (reexecute) {
const char **args;
unsigned i, args_size;
watchdog_close(true);
if (switch_root_dir) {
if (!switch_root_init) {
if (switch_root_dir)
if (switch_root_dir)
clearenv();
if (arg_serialization) {
if (fds) {
if (switch_root_init) {
if (arg_serialization) {
if (fds) {
#ifdef HAVE_VALGRIND_VALGRIND_H
if (shutdown_verb) {
switch (log_get_target()) {
case LOG_TARGET_KMSG:
case LOG_TARGET_CONSOLE:
if (log_get_show_color())
if (log_get_show_location())
watchdog_close(false);
watchdog_close(true);
freeze();
return retval;