chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
main: profile unit file loading
[elogind.git]
/
src
/
main.c
diff --git
a/src/main.c
b/src/main.c
index e10441c862d7766ea06890afd33113712ce6c1bc..25b6e87de395a53257ee50cf37c7c6b4ca0bb5ca 100644
(file)
--- a/
src/main.c
+++ b/
src/main.c
@@
-898,6
+898,9
@@
static int prepare_reexecute(Manager *m, FILE **_f, FDSet **_fds) {
assert(_f);
assert(_fds);
assert(_f);
assert(_fds);
+ /* Make sure nothing is really destructed when we shut down */
+ m->n_reloading ++;
+
if ((r = manager_open_serialization(m, &f)) < 0) {
log_error("Failed to create serialization file: %s", strerror(-r));
goto fail;
if ((r = manager_open_serialization(m, &f)) < 0) {
log_error("Failed to create serialization file: %s", strerror(-r));
goto fail;
@@
-988,7
+991,7
@@
static void test_usr(void) {
if (dir_is_empty("/usr") <= 0)
return;
if (dir_is_empty("/usr") <= 0)
return;
- log_warning("/usr appears to be on
a different file system than /. This is not supported anymore
. "
+ log_warning("/usr appears to be on
its own filesytem and is not already mounted. This is not a supported setup
. "
"Some things will probably break (sometimes even silently) in mysterious ways. "
"Consult http://freedesktop.org/wiki/Software/systemd/separate-usr-is-broken for more information.");
}
"Some things will probably break (sometimes even silently) in mysterious ways. "
"Consult http://freedesktop.org/wiki/Software/systemd/separate-usr-is-broken for more information.");
}
@@
-1010,6
+1013,8
@@
static void test_cgroups(void) {
int main(int argc, char *argv[]) {
Manager *m = NULL;
int r, retval = EXIT_FAILURE;
int main(int argc, char *argv[]) {
Manager *m = NULL;
int r, retval = EXIT_FAILURE;
+ usec_t before_startup, after_startup;
+ char timespan[FORMAT_TIMESPAN_MAX];
FDSet *fds = NULL;
bool reexecute = false;
const char *shutdown_verb = NULL;
FDSet *fds = NULL;
bool reexecute = false;
const char *shutdown_verb = NULL;
@@
-1043,6
+1048,7
@@
int main(int argc, char *argv[]) {
if (getpid() == 1) {
arg_running_as = MANAGER_SYSTEM;
log_set_target(detect_container(NULL) > 0 ? LOG_TARGET_CONSOLE : LOG_TARGET_SYSLOG_OR_KMSG);
if (getpid() == 1) {
arg_running_as = MANAGER_SYSTEM;
log_set_target(detect_container(NULL) > 0 ? LOG_TARGET_CONSOLE : LOG_TARGET_SYSLOG_OR_KMSG);
+ log_open();
/* This might actually not return, but cause a
* reexecution */
/* This might actually not return, but cause a
* reexecution */
@@
-1053,17
+1059,19
@@
int main(int argc, char *argv[]) {
goto finish;
if (hwclock_is_localtime() > 0) {
goto finish;
if (hwclock_is_localtime() > 0) {
- int min;
+ int
err,
min;
-
min = hwclock_apply_localtime_delta(
);
- if (
min
< 0)
- log_error("Failed to apply local time delta: %s", strerror(-
min
));
+
err = hwclock_apply_localtime_delta(&min
);
+ if (
err
< 0)
+ log_error("Failed to apply local time delta: %s", strerror(-
err
));
else
log_info("RTC configured in localtime, applying delta of %i minutes to system time.", min);
}
else
log_info("RTC configured in localtime, applying delta of %i minutes to system time.", min);
}
+
} else {
arg_running_as = MANAGER_USER;
} else {
arg_running_as = MANAGER_USER;
- log_set_target(LOG_TARGET_CONSOLE);
+ log_set_target(LOG_TARGET_AUTO);
+ log_open();
}
if (set_default_unit(SPECIAL_DEFAULT_TARGET) < 0)
}
if (set_default_unit(SPECIAL_DEFAULT_TARGET) < 0)
@@
-1119,6
+1127,9
@@
int main(int argc, char *argv[]) {
assert_se(arg_action == ACTION_RUN || arg_action == ACTION_TEST);
assert_se(arg_action == ACTION_RUN || arg_action == ACTION_TEST);
+ /* Close logging fds, in order not to confuse fdset below */
+ log_close();
+
/* Remember open file descriptors for later deserialization */
if (serialization) {
if ((r = fdset_new_fill(&fds)) < 0) {
/* Remember open file descriptors for later deserialization */
if (serialization) {
if ((r = fdset_new_fill(&fds)) < 0) {
@@
-1218,6
+1229,8
@@
int main(int argc, char *argv[]) {
if (arg_default_controllers)
manager_set_default_controllers(m, arg_default_controllers);
if (arg_default_controllers)
manager_set_default_controllers(m, arg_default_controllers);
+ before_startup = now(CLOCK_MONOTONIC);
+
if ((r = manager_startup(m, serialization, fds)) < 0)
log_error("Failed to fully start up daemon: %s", strerror(-r));
if ((r = manager_startup(m, serialization, fds)) < 0)
log_error("Failed to fully start up daemon: %s", strerror(-r));
@@
-1285,6
+1298,10
@@
int main(int argc, char *argv[]) {
}
}
}
}
+ after_startup = now(CLOCK_MONOTONIC);
+ log_debug("Loaded units and determined initial transaction in %s.",
+ format_timespan(timespan, sizeof(timespan), after_startup - before_startup));
+
for (;;) {
if ((r = manager_loop(m)) < 0) {
log_error("Failed to run mainloop: %s", strerror(-r));
for (;;) {
if ((r = manager_loop(m)) < 0) {
log_error("Failed to run mainloop: %s", strerror(-r));