summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2017-12-15 17:34:12 +0100
committerLennart Poettering <lennart@poettering.net>2017-12-15 20:52:28 +0100
commit3c3c6cb95d70a248d88cc49e43329784858ba7c1 (patch)
treeba1a42557d7cd604e03120d6954eff3585f1ce06 /src
parentdb33214b528af9d04d552444dc96e8ccc7f03ddd (diff)
downloadsystemd-3c3c6cb95d70a248d88cc49e43329784858ba7c1.tar.gz
systemd-3c3c6cb95d70a248d88cc49e43329784858ba7c1.tar.bz2
systemd-3c3c6cb95d70a248d88cc49e43329784858ba7c1.zip
main: move install_crash_handler() and mount_cgroup_controllers() invocations
Let's place them in initialize_runtime(), where they appear to fit best. Effectively this is just a move a little bit down, swapping places with log_execution_mode(), which should require neither call to be done first. Note that changes the conditionalization a bit for these calls, from (PID == 1) to (arg_system && arg_action == ACTION_RUN). At this point this is pretty much the same however, as we don't allow PID 1 without ACTION_RUN and without arg_system set, safety_checks() ensures that.
Diffstat (limited to 'src')
-rw-r--r--src/core/main.c54
1 files changed, 27 insertions, 27 deletions
diff --git a/src/core/main.c b/src/core/main.c
index 6d440cc13f..623cbc4231 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -1917,25 +1917,35 @@ static int initialize_runtime(
* - Some only apply when we first start up, but not when we reexecute
*/
- if (arg_system && !skip_setup) {
- status_welcome();
- hostname_setup();
- machine_id_setup(NULL, arg_machine_id, NULL);
- loopback_setup();
- bump_unix_max_dgram_qlen();
- test_usr();
- write_container_id();
- }
+ if (arg_system) {
+ /* Make sure we leave a core dump without panicing the kernel. */
+ install_crash_handler();
- if (arg_system && arg_watchdog_device) {
- r = watchdog_set_device(arg_watchdog_device);
- if (r < 0)
- log_warning_errno(r, "Failed to set watchdog device to %s, ignoring: %m",
- arg_watchdog_device);
- }
+ if (!skip_setup) {
+ r = mount_cgroup_controllers(arg_join_controllers);
+ if (r < 0) {
+ *ret_error_message = "Failed to mount cgroup hierarchies";
+ return r;
+ }
+
+ status_welcome();
+ hostname_setup();
+ machine_id_setup(NULL, arg_machine_id, NULL);
+ loopback_setup();
+ bump_unix_max_dgram_qlen();
+ test_usr();
+ write_container_id();
+ }
- if (arg_system && arg_runtime_watchdog > 0 && arg_runtime_watchdog != USEC_INFINITY)
- watchdog_set_timeout(&arg_runtime_watchdog);
+ if (arg_watchdog_device) {
+ r = watchdog_set_device(arg_watchdog_device);
+ if (r < 0)
+ log_warning_errno(r, "Failed to set watchdog device to %s, ignoring: %m", arg_watchdog_device);
+ }
+
+ if (arg_runtime_watchdog > 0 && arg_runtime_watchdog != USEC_INFINITY)
+ watchdog_set_timeout(&arg_runtime_watchdog);
+ }
if (arg_timer_slack_nsec != NSEC_INFINITY)
if (prctl(PR_SET_TIMERSLACK, arg_timer_slack_nsec) < 0)
@@ -2467,16 +2477,6 @@ int main(int argc, char *argv[]) {
log_open();
}
- /* Make sure we leave a core dump without panicing the
- * kernel. */
- if (getpid_cached() == 1) {
- install_crash_handler();
-
- r = mount_cgroup_controllers(arg_join_controllers);
- if (r < 0)
- goto finish;
- }
-
log_execution_mode(&first_boot);
if (arg_action == ACTION_RUN) {