Merge pull request #12889 from keszybz/analyze-condition
Add systemd-analyze condition
This commit is contained in:
@@ -254,6 +254,7 @@ Unit.SuccessAction, config_parse_emergency_action, 0,
|
||||
Unit.FailureActionExitStatus, config_parse_exit_status, 0, offsetof(Unit, failure_action_exit_status)
|
||||
Unit.SuccessActionExitStatus, config_parse_exit_status, 0, offsetof(Unit, success_action_exit_status)
|
||||
Unit.RebootArgument, config_parse_unit_string_printf, 0, offsetof(Unit, reboot_arg)
|
||||
m4_dnl Also add any conditions to condition_definitions[] in src/analyze/analyze-condition.c.
|
||||
Unit.ConditionPathExists, config_parse_unit_condition_path, CONDITION_PATH_EXISTS, offsetof(Unit, conditions)
|
||||
Unit.ConditionPathExistsGlob, config_parse_unit_condition_path, CONDITION_PATH_EXISTS_GLOB, offsetof(Unit, conditions)
|
||||
Unit.ConditionPathIsDirectory, config_parse_unit_condition_path, CONDITION_PATH_IS_DIRECTORY, offsetof(Unit, conditions)
|
||||
|
||||
@@ -2587,13 +2587,13 @@ int config_parse_unit_condition_string(
|
||||
return 0;
|
||||
}
|
||||
|
||||
trigger = rvalue[0] == '|';
|
||||
trigger = *rvalue == '|';
|
||||
if (trigger)
|
||||
rvalue++;
|
||||
rvalue += 1 + strspn(rvalue + 1, WHITESPACE);
|
||||
|
||||
negate = rvalue[0] == '!';
|
||||
negate = *rvalue == '!';
|
||||
if (negate)
|
||||
rvalue++;
|
||||
rvalue += 1 + strspn(rvalue + 1, WHITESPACE);
|
||||
|
||||
r = unit_full_printf(u, rvalue, &s);
|
||||
if (r < 0) {
|
||||
|
||||
@@ -1378,6 +1378,9 @@ static void manager_enumerate_perpetual(Manager *m) {
|
||||
|
||||
assert(m);
|
||||
|
||||
if (m->test_run_flags == MANAGER_TEST_RUN_MINIMAL)
|
||||
return;
|
||||
|
||||
/* Let's ask every type to load all units from disk/kernel that it might know */
|
||||
for (c = 0; c < _UNIT_TYPE_MAX; c++) {
|
||||
if (!unit_type_supported(c)) {
|
||||
@@ -1395,6 +1398,9 @@ static void manager_enumerate(Manager *m) {
|
||||
|
||||
assert(m);
|
||||
|
||||
if (m->test_run_flags == MANAGER_TEST_RUN_MINIMAL)
|
||||
return;
|
||||
|
||||
/* Let's ask every type to load all units from disk/kernel that it might know */
|
||||
for (c = 0; c < _UNIT_TYPE_MAX; c++) {
|
||||
if (!unit_type_supported(c)) {
|
||||
|
||||
@@ -244,6 +244,10 @@ int unit_full_printf(Unit *u, const char *format, char **ret) {
|
||||
* before or after the relevant configuration setting. Hence: don't add them.
|
||||
*/
|
||||
|
||||
assert(u);
|
||||
assert(format);
|
||||
assert(ret);
|
||||
|
||||
const Specifier table[] = {
|
||||
{ 'n', specifier_string, u->id },
|
||||
{ 'N', specifier_prefix_and_instance, NULL },
|
||||
@@ -281,9 +285,5 @@ int unit_full_printf(Unit *u, const char *format, char **ret) {
|
||||
{}
|
||||
};
|
||||
|
||||
assert(u);
|
||||
assert(format);
|
||||
assert(ret);
|
||||
|
||||
return specifier_printf(format, table, u, ret);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user