core: move Version/Arch/Features/Taints/UnitPath from context to runtime

This commit is contained in:
Ivan Kruglov
2025-07-10 21:08:11 +02:00
parent 88444243b8
commit a5d8520f86
2 changed files with 20 additions and 20 deletions
+10 -10
View File
@@ -41,19 +41,9 @@ static int manager_environment_build_json(sd_json_variant **ret, const char *nam
static int manager_context_build_json(sd_json_variant **ret, const char *name, void *userdata) {
Manager *m = ASSERT_PTR(userdata);
_cleanup_strv_free_ char **taints = NULL;
taints = taint_strv();
if (!taints)
return -ENOMEM;
return sd_json_buildo(
ASSERT_PTR(ret),
SD_JSON_BUILD_PAIR_STRING("Version", GIT_VERSION),
SD_JSON_BUILD_PAIR_STRING("Architecture", architecture_to_string(uname_architecture())),
SD_JSON_BUILD_PAIR_STRING("Features", systemd_features),
JSON_BUILD_PAIR_STRV_NON_EMPTY("Taints", taints),
SD_JSON_BUILD_PAIR_STRV("UnitPath", m->lookup_paths.search_path),
JSON_BUILD_PAIR_STRV_NON_EMPTY("Environment", m->transient_environment),
SD_JSON_BUILD_PAIR_STRING("DefaultStandardOutput", exec_output_to_string(m->defaults.std_output)),
SD_JSON_BUILD_PAIR_STRING("DefaultStandardError", exec_output_to_string(m->defaults.std_error)),
@@ -110,9 +100,19 @@ static int log_level_build_runtime_json(sd_json_variant **ret, const char *name,
static int manager_runtime_build_json(sd_json_variant **ret, const char *name, void *userdata) {
Manager *m = ASSERT_PTR(userdata);
dual_timestamp watchdog_last_ping;
_cleanup_strv_free_ char **taints = NULL;
taints = taint_strv();
if (!taints)
return -ENOMEM;
return sd_json_buildo(
ASSERT_PTR(ret),
SD_JSON_BUILD_PAIR_STRING("Version", GIT_VERSION),
SD_JSON_BUILD_PAIR_STRING("Architecture", architecture_to_string(uname_architecture())),
SD_JSON_BUILD_PAIR_STRING("Features", systemd_features),
JSON_BUILD_PAIR_STRV_NON_EMPTY("Taints", taints),
SD_JSON_BUILD_PAIR_STRV("UnitPath", m->lookup_paths.search_path),
SD_JSON_BUILD_PAIR_STRING("Virtualization", virtualization_to_string(detect_virtualization())),
SD_JSON_BUILD_PAIR_STRING("ConfidentialVirtualization", confidential_virtualization_to_string(detect_confidential_virtualization())),
JSON_BUILD_PAIR_STRING_NON_EMPTY("ConfirmSpawn", manager_get_confirm_spawn(m)),
+10 -10
View File
@@ -20,16 +20,6 @@ static SD_VARLINK_DEFINE_STRUCT_TYPE(
static SD_VARLINK_DEFINE_STRUCT_TYPE(
ManagerContext,
SD_VARLINK_FIELD_COMMENT("The version string of the running systemd instance"),
SD_VARLINK_DEFINE_FIELD(Version, SD_VARLINK_STRING, 0),
SD_VARLINK_FIELD_COMMENT("A short ID string describing the architecture the systemd instance is running on"),
SD_VARLINK_DEFINE_FIELD(Architecture, SD_VARLINK_STRING, 0),
SD_VARLINK_FIELD_COMMENT("The features that have been enabled and disabled for this build"),
SD_VARLINK_DEFINE_FIELD(Features, SD_VARLINK_STRING, 0),
SD_VARLINK_FIELD_COMMENT("An array of strings describing the taints applied to the running system"),
SD_VARLINK_DEFINE_FIELD(Taints, SD_VARLINK_STRING, SD_VARLINK_ARRAY|SD_VARLINK_NULLABLE),
SD_VARLINK_FIELD_COMMENT("The unit search path"),
SD_VARLINK_DEFINE_FIELD(UnitPath, SD_VARLINK_STRING, SD_VARLINK_ARRAY),
SD_VARLINK_FIELD_COMMENT("https://www.freedesktop.org/software/systemd/man/latest/systemd-system.conf.html#ManagerEnvironment="),
SD_VARLINK_DEFINE_FIELD(Environment, SD_VARLINK_STRING, SD_VARLINK_ARRAY|SD_VARLINK_NULLABLE),
SD_VARLINK_FIELD_COMMENT("https://www.freedesktop.org/software/systemd/man/"PROJECT_VERSION_STR"/systemd-system.conf.html#DefaultStandardOutput="),
@@ -81,6 +71,16 @@ static SD_VARLINK_DEFINE_STRUCT_TYPE(
static SD_VARLINK_DEFINE_STRUCT_TYPE(
ManagerRuntime,
SD_VARLINK_FIELD_COMMENT("The version string of the running systemd instance"),
SD_VARLINK_DEFINE_FIELD(Version, SD_VARLINK_STRING, 0),
SD_VARLINK_FIELD_COMMENT("A short ID string describing the architecture the systemd instance is running on"),
SD_VARLINK_DEFINE_FIELD(Architecture, SD_VARLINK_STRING, 0),
SD_VARLINK_FIELD_COMMENT("The features that have been enabled and disabled for this build"),
SD_VARLINK_DEFINE_FIELD(Features, SD_VARLINK_STRING, 0),
SD_VARLINK_FIELD_COMMENT("An array of strings describing the taints applied to the running system"),
SD_VARLINK_DEFINE_FIELD(Taints, SD_VARLINK_STRING, SD_VARLINK_ARRAY|SD_VARLINK_NULLABLE),
SD_VARLINK_FIELD_COMMENT("The unit search path"),
SD_VARLINK_DEFINE_FIELD(UnitPath, SD_VARLINK_STRING, SD_VARLINK_ARRAY),
SD_VARLINK_FIELD_COMMENT("A short ID string describing the virtualization technology the system runs in"),
SD_VARLINK_DEFINE_FIELD(Virtualization, SD_VARLINK_STRING, 0),
SD_VARLINK_FIELD_COMMENT("A short ID string describing the confidential virtualization technology the system runs in"),