summaryrefslogtreecommitdiff
path: root/src/core/main.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-09-07 13:42:47 +0200
committerLennart Poettering <lennart@poettering.net>2015-09-07 13:42:47 +0200
commit75f86906c52735c98dc0aa7e24b773edb42ee814 (patch)
treed2d0701f8df51d5a09586073ebd387bb831743e7 /src/core/main.c
parent47f5a38cdf98a220d6a0d4eb11a710a0a42ae5c4 (diff)
basic: rework virtualization detection API
Introduce a proper enum, and don't pass around string ids anymore. This simplifies things quite a bit, and makes virtualization detection more similar to architecture detection.
Diffstat (limited to 'src/core/main.c')
-rw-r--r--src/core/main.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/core/main.c b/src/core/main.c
index 4cd2b08c38..fe8f1924bd 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -374,7 +374,7 @@ static int parse_proc_cmdline_item(const char *key, const char *value) {
/* Note that log_parse_environment() handles 'debug'
* too, and sets the log level to LOG_DEBUG. */
- if (detect_container(NULL) > 0)
+ if (detect_container() > 0)
log_set_target(LOG_TARGET_CONSOLE);
} else if (!in_initrd() && !value) {
@@ -1297,7 +1297,7 @@ int main(int argc, char *argv[]) {
if (getpid() == 1)
umask(0);
- if (getpid() == 1 && detect_container(NULL) <= 0) {
+ if (getpid() == 1 && detect_container() <= 0) {
/* Running outside of a container as PID 1 */
arg_running_as = MANAGER_SYSTEM;
@@ -1551,14 +1551,14 @@ int main(int argc, char *argv[]) {
}
if (arg_running_as == MANAGER_SYSTEM) {
- const char *virtualization = NULL;
+ int v;
log_info(PACKAGE_STRING " running in %ssystem mode. (" SYSTEMD_FEATURES ")",
arg_action == ACTION_TEST ? "test " : "" );
- detect_virtualization(&virtualization);
- if (virtualization)
- log_info("Detected virtualization %s.", virtualization);
+ v = detect_virtualization();
+ if (v > 0)
+ log_info("Detected virtualization %s.", virtualization_to_string(v));
write_container_id();
@@ -2046,7 +2046,7 @@ finish:
/* Avoid the creation of new processes forked by the
* kernel; at this point, we will not listen to the
* signals anyway */
- if (detect_container(NULL) <= 0)
+ if (detect_container() <= 0)
(void) cg_uninstall_release_agent(SYSTEMD_CGROUP_CONTROLLER);
execve(SYSTEMD_SHUTDOWN_BINARY_PATH, (char **) command_line, env_block);