tree-wide: normalize comment style

This commit is contained in:
Yu Watanabe
2025-12-15 08:50:13 +09:00
parent 8e20b9a79d
commit 93378148d4
431 changed files with 1894 additions and 1895 deletions
+3 -3
View File
@@ -262,7 +262,7 @@ static void automount_set_state(Automount *a, AutomountState state) {
if (state != old_state)
log_unit_debug(UNIT(a), "Changed %s -> %s", automount_state_to_string(old_state), automount_state_to_string(state));
unit_notify(UNIT(a), state_translation_table[old_state], state_translation_table[state], /* reload_success = */ true);
unit_notify(UNIT(a), state_translation_table[old_state], state_translation_table[state], /* reload_success= */ true);
}
static int automount_coldplug(Unit *u) {
@@ -781,7 +781,7 @@ static void automount_enter_running(Automount *a) {
goto fail;
}
r = manager_add_job(UNIT(a)->manager, JOB_START, trigger, JOB_REPLACE, &error, /* ret = */ NULL);
r = manager_add_job(UNIT(a)->manager, JOB_START, trigger, JOB_REPLACE, &error, /* ret= */ NULL);
if (r < 0) {
log_unit_warning(UNIT(a), "Failed to queue mount startup job: %s", bus_error_message(&error, r));
goto fail;
@@ -997,7 +997,7 @@ static int automount_dispatch_io(sd_event_source *s, int fd, uint32_t events, vo
goto fail;
}
r = manager_add_job(UNIT(a)->manager, JOB_STOP, trigger, JOB_REPLACE, &error, /* ret = */ NULL);
r = manager_add_job(UNIT(a)->manager, JOB_STOP, trigger, JOB_REPLACE, &error, /* ret= */ NULL);
if (r < 0) {
log_unit_warning(UNIT(a), "Failed to queue unmount job: %s", bus_error_message(&error, r));
goto fail;
+1 -1
View File
@@ -236,7 +236,7 @@ int bpf_devices_apply_policy(
if (r < 0)
return log_error_errno(r, "Extending device control BPF program failed: %m");
r = cg_get_path(cgroup_path, /* suffix = */ NULL, &controller_path);
r = cg_get_path(cgroup_path, /* suffix= */ NULL, &controller_path);
if (r < 0)
return log_error_errno(r, "Failed to determine cgroup path: %m");
+1 -1
View File
@@ -696,7 +696,7 @@ int bpf_firewall_install(Unit *u) {
return log_unit_debug_errno(u, SYNTHETIC_ERRNO(EOPNOTSUPP),
"bpf-firewall: BPF firewalling not supported, proceeding without.");
r = cg_get_path(crt->cgroup_path, /* suffix = */ NULL, &path);
r = cg_get_path(crt->cgroup_path, /* suffix= */ NULL, &path);
if (r < 0)
return log_unit_error_errno(u, r, "bpf-firewall: Failed to determine cgroup path: %m");
+1 -1
View File
@@ -151,7 +151,7 @@ int bpf_foreign_install(Unit *u) {
if (!crt)
return 0;
r = cg_get_path(crt->cgroup_path, /* suffix = */ NULL, &cgroup_path);
r = cg_get_path(crt->cgroup_path, /* suffix= */ NULL, &cgroup_path);
if (r < 0)
return log_unit_error_errno(u, r, "bpf-foreign: Failed to get cgroup path: %m");
+1 -1
View File
@@ -207,7 +207,7 @@ int bpf_restrict_fs_cleanup(Unit *u) {
assert(u->manager);
/* If we never successfully detected support, there is nothing to clean up. */
if (!bpf_restrict_fs_supported(/* initialize = */ false))
if (!bpf_restrict_fs_supported(/* initialize= */ false))
return 0;
if (!u->manager->restrict_fs)
+1 -1
View File
@@ -115,7 +115,7 @@ static int restrict_ifaces_install_impl(Unit *u) {
if (!crt)
return 0;
r = cg_get_path(crt->cgroup_path, /* suffix = */ NULL, &cgroup_path);
r = cg_get_path(crt->cgroup_path, /* suffix= */ NULL, &cgroup_path);
if (r < 0)
return log_unit_error_errno(u, r, "restrict-interfaces: Failed to get cgroup path: %m");
+2 -2
View File
@@ -128,7 +128,7 @@ int bpf_socket_bind_supported(void) {
if (dlopen_bpf_full(LOG_WARNING) < 0)
return false;
r = prepare_socket_bind_bpf(/*unit=*/NULL, /*allow_rules=*/NULL, /*deny_rules=*/NULL, &obj);
r = prepare_socket_bind_bpf(/* unit= */ NULL, /* allow_rules= */ NULL, /* deny_rules= */ NULL, &obj);
if (r < 0) {
log_debug_errno(r, "bpf-socket-bind: socket bind filtering is not supported: %m");
return false;
@@ -179,7 +179,7 @@ static int socket_bind_install_impl(Unit *u) {
if (!crt)
return 0;
r = cg_get_path(crt->cgroup_path, /* suffix = */ NULL, &cgroup_path);
r = cg_get_path(crt->cgroup_path, /* suffix= */ NULL, &cgroup_path);
if (r < 0)
return log_unit_error_errno(u, r, "bpf-socket-bind: Failed to get cgroup path: %m");
+11 -11
View File
@@ -1609,7 +1609,7 @@ static void cgroup_context_apply(
if (apply_mask & CGROUP_MASK_BPF_RESTRICT_NETWORK_INTERFACES)
cgroup_apply_restrict_network_interfaces(u);
unit_modify_nft_set(u, /* add = */ true);
unit_modify_nft_set(u, /* add= */ true);
}
static bool unit_get_needs_bpf_firewall(Unit *u) {
@@ -1931,7 +1931,7 @@ static int unit_set_cgroup_path(Unit *u, const char *path) {
if (crt && streq_ptr(crt->cgroup_path, path))
return 0;
unit_release_cgroup(u, /* drop_cgroup_runtime = */ true);
unit_release_cgroup(u, /* drop_cgroup_runtime= */ true);
crt = unit_setup_cgroup_runtime(u);
if (!crt)
@@ -2101,7 +2101,7 @@ static int unit_update_cgroup(
CGroupRuntime *crt = ASSERT_PTR(unit_get_cgroup_runtime(u));
uint64_t cgroup_id = 0;
r = cg_get_path(crt->cgroup_path, /* suffix = */ NULL, &cgroup_full_path);
r = cg_get_path(crt->cgroup_path, /* suffix= */ NULL, &cgroup_full_path);
if (r == 0) {
r = cg_path_get_cgroupid(cgroup_full_path, &cgroup_id);
if (r < 0)
@@ -2735,7 +2735,7 @@ static bool unit_maybe_release_cgroup(Unit *u) {
/* Do not free CGroupRuntime when called from unit_prune_cgroup. Various accounting data
* we should keep, especially CPU usage and *_peak ones which would be shown even after
* the unit stops. */
unit_release_cgroup(u, /* drop_cgroup_runtime = */ false);
unit_release_cgroup(u, /* drop_cgroup_runtime= */ false);
return true;
}
@@ -2793,13 +2793,13 @@ void unit_prune_cgroup(Unit *u) {
return;
/* Cache the last resource usage values before we destroy the cgroup */
(void) unit_get_cpu_usage(u, /* ret = */ NULL);
(void) unit_get_cpu_usage(u, /* ret= */ NULL);
for (CGroupMemoryAccountingMetric metric = 0; metric <= _CGROUP_MEMORY_ACCOUNTING_METRIC_CACHED_LAST; metric++)
(void) unit_get_memory_accounting(u, metric, /* ret = */ NULL);
(void) unit_get_memory_accounting(u, metric, /* ret= */ NULL);
/* All IO metrics are read at once from the underlying cgroup, so issue just a single call */
(void) unit_get_io_accounting(u, _CGROUP_IO_ACCOUNTING_METRIC_INVALID, /* ret = */ NULL);
(void) unit_get_io_accounting(u, _CGROUP_IO_ACCOUNTING_METRIC_INVALID, /* ret= */ NULL);
/* We do not cache IP metrics here because the firewall objects are not freed with cgroups */
@@ -2807,7 +2807,7 @@ void unit_prune_cgroup(Unit *u) {
(void) bpf_restrict_fs_cleanup(u); /* Remove cgroup from the global LSM BPF map */
#endif
unit_modify_nft_set(u, /* add = */ false);
unit_modify_nft_set(u, /* add= */ false);
is_root_slice = unit_has_name(u, SPECIAL_ROOT_SLICE);
@@ -3316,7 +3316,7 @@ int manager_setup_cgroup(Manager *m) {
/* 5. Make sure we are in the special "init.scope" unit in the root slice. */
const char *scope_path = strjoina(m->cgroup_root, "/" SPECIAL_INIT_SCOPE);
r = cg_create_and_attach(scope_path, /* pid = */ 0);
r = cg_create_and_attach(scope_path, /* pid= */ 0);
if (r >= 0) {
/* Also, move all other userspace processes remaining in the root cgroup into that scope. */
r = cg_migrate(m->cgroup_root, scope_path, 0);
@@ -4169,8 +4169,8 @@ CGroupRuntime* cgroup_runtime_new(void) {
.deserialized_cgroup_realized = -1,
};
unit_reset_cpu_accounting(/* unit = */ NULL, crt);
unit_reset_io_accounting(/* unit = */ NULL, crt);
unit_reset_cpu_accounting(/* unit= */ NULL, crt);
unit_reset_io_accounting(/* unit= */ NULL, crt);
cgroup_runtime_reset_memory_accounting_last(crt);
assert_se(cgroup_runtime_reset_ip_accounting(crt) >= 0);
+3 -3
View File
@@ -605,12 +605,12 @@ static int property_get_log_filter_patterns(
return r;
r = sd_bus_message_append_log_filter_patterns(reply, c->log_filter_allowed_patterns,
/* is_allowlist = */ true);
/* is_allowlist= */ true);
if (r < 0)
return r;
r = sd_bus_message_append_log_filter_patterns(reply, c->log_filter_denied_patterns,
/* is_allowlist = */ false);
/* is_allowlist= */ false);
if (r < 0)
return r;
@@ -2248,7 +2248,7 @@ int bus_exec_context_set_transient_property(
if (r < 0)
return r;
if (!isempty(h) && !hostname_is_valid(h, /* flags = */ 0))
if (!isempty(h) && !hostname_is_valid(h, /* flags= */ 0))
return sd_bus_error_setf(reterr_error, SD_BUS_ERROR_INVALID_ARGS, "Invalid hostname in %s setting: %s", name, h);
ProtectHostname t = protect_hostname_from_string(s);
+27 -27
View File
@@ -758,31 +758,31 @@ static int method_start_unit_generic(sd_bus_message *message, Manager *m, JobTyp
}
static int method_start_unit(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) {
return method_start_unit_generic(message, userdata, JOB_START, /* reload_if_possible = */ false, reterr_error);
return method_start_unit_generic(message, userdata, JOB_START, /* reload_if_possible= */ false, reterr_error);
}
static int method_stop_unit(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) {
return method_start_unit_generic(message, userdata, JOB_STOP, /* reload_if_possible = */ false, reterr_error);
return method_start_unit_generic(message, userdata, JOB_STOP, /* reload_if_possible= */ false, reterr_error);
}
static int method_reload_unit(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) {
return method_start_unit_generic(message, userdata, JOB_RELOAD, /* reload_if_possible = */ false, reterr_error);
return method_start_unit_generic(message, userdata, JOB_RELOAD, /* reload_if_possible= */ false, reterr_error);
}
static int method_restart_unit(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) {
return method_start_unit_generic(message, userdata, JOB_RESTART, /* reload_if_possible = */ false, reterr_error);
return method_start_unit_generic(message, userdata, JOB_RESTART, /* reload_if_possible= */ false, reterr_error);
}
static int method_try_restart_unit(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) {
return method_start_unit_generic(message, userdata, JOB_TRY_RESTART, /* reload_if_possible = */ false, reterr_error);
return method_start_unit_generic(message, userdata, JOB_TRY_RESTART, /* reload_if_possible= */ false, reterr_error);
}
static int method_reload_or_restart_unit(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) {
return method_start_unit_generic(message, userdata, JOB_RESTART, /* reload_if_possible = */ true, reterr_error);
return method_start_unit_generic(message, userdata, JOB_RESTART, /* reload_if_possible= */ true, reterr_error);
}
static int method_reload_or_try_restart_unit(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) {
return method_start_unit_generic(message, userdata, JOB_TRY_RESTART, /* reload_if_possible = */ true, reterr_error);
return method_start_unit_generic(message, userdata, JOB_TRY_RESTART, /* reload_if_possible= */ true, reterr_error);
}
typedef enum GenericUnitOperationFlags {
@@ -857,19 +857,19 @@ static int method_start_unit_replace(sd_bus_message *message, void *userdata, sd
if (!u->job || u->job->type != JOB_START)
return sd_bus_error_setf(reterr_error, BUS_ERROR_NO_SUCH_JOB, "No job queued for unit %s", old_name);
return method_start_unit_generic(message, m, JOB_START, /* reload_if_possible = */ false, reterr_error);
return method_start_unit_generic(message, m, JOB_START, /* reload_if_possible= */ false, reterr_error);
}
static int method_kill_unit(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) {
/* We don't bother with GENERIC_UNIT_LOAD or GENERIC_UNIT_VALIDATE_LOADED here, as it shouldn't
* matter whether a unit is loaded for killing any processes in the unit's cgroup. */
return method_generic_unit_operation(message, userdata, reterr_error, _UNIT_TYPE_INVALID, bus_unit_method_kill, /* flags = */ 0);
return method_generic_unit_operation(message, userdata, reterr_error, _UNIT_TYPE_INVALID, bus_unit_method_kill, /* flags= */ 0);
}
static int method_kill_unit_subgroup(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) {
/* We don't bother with GENERIC_UNIT_LOAD or GENERIC_UNIT_VALIDATE_LOADED here, as it shouldn't
* matter whether a unit is loaded for killing any processes in the unit's cgroup. */
return method_generic_unit_operation(message, userdata, reterr_error, _UNIT_TYPE_INVALID, bus_unit_method_kill_subgroup, /* flags = */ 0);
return method_generic_unit_operation(message, userdata, reterr_error, _UNIT_TYPE_INVALID, bus_unit_method_kill_subgroup, /* flags= */ 0);
}
static int method_clean_unit(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) {
@@ -891,7 +891,7 @@ static int method_thaw_unit(sd_bus_message *message, void *userdata, sd_bus_erro
static int method_reset_failed_unit(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) {
/* Don't load the unit (because unloaded units can't be in failed state), and don't insist on the
* unit to be loaded properly (since a failed unit might have its unit file disappeared) */
return method_generic_unit_operation(message, userdata, reterr_error, _UNIT_TYPE_INVALID, bus_unit_method_reset_failed, /* flags = */ 0);
return method_generic_unit_operation(message, userdata, reterr_error, _UNIT_TYPE_INVALID, bus_unit_method_reset_failed, /* flags= */ 0);
}
static int method_set_unit_properties(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) {
@@ -917,7 +917,7 @@ static int method_ref_unit(sd_bus_message *message, void *userdata, sd_bus_error
static int method_unref_unit(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) {
/* Dropping a ref OTOH should not require the unit to still be loaded. And since a reffed unit is a
* loaded unit there's no need to load the unit for unreffing it. */
return method_generic_unit_operation(message, userdata, reterr_error, _UNIT_TYPE_INVALID, bus_unit_method_unref, /* flags = */ 0);
return method_generic_unit_operation(message, userdata, reterr_error, _UNIT_TYPE_INVALID, bus_unit_method_unref, /* flags= */ 0);
}
static int reply_unit_info(sd_bus_message *reply, Unit *u) {
@@ -996,7 +996,7 @@ static int method_get_unit_processes(sd_bus_message *message, void *userdata, sd
/* Don't load a unit actively (since it won't have any processes if it's not loaded), but don't
* insist on the unit being loaded either (because even improperly loaded units might still have
* processes around). */
return method_generic_unit_operation(message, userdata, reterr_error, _UNIT_TYPE_INVALID, bus_unit_method_get_processes, /* flags = */ 0);
return method_generic_unit_operation(message, userdata, reterr_error, _UNIT_TYPE_INVALID, bus_unit_method_get_processes, /* flags= */ 0);
}
static int method_attach_processes_to_unit(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) {
@@ -1094,7 +1094,7 @@ static int transient_aux_units_from_message(
if (r < 0)
return r;
r = transient_unit_from_message(m, message, name, /* ret_unit = */ NULL, reterr_error);
r = transient_unit_from_message(m, message, name, /* ret_unit= */ NULL, reterr_error);
if (r < 0)
return r;
@@ -1457,11 +1457,11 @@ static int dump_impl(
* operations, and can cause PID1 to stall. So it seems similar enough in terms of security
* considerations and impact, and thus use the same access check for dumps which, given the
* large amount of data to fetch, can stall PID1 for quite some time. */
r = mac_selinux_access_check(message, "reload", /* error = */ NULL);
r = mac_selinux_access_check(message, "reload", /* error= */ NULL);
if (r < 0)
goto ratelimited;
r = bus_verify_bypass_dump_ratelimit_async(m, message, /* reterr_error = */ NULL);
r = bus_verify_bypass_dump_ratelimit_async(m, message, /* reterr_error= */ NULL);
if (r < 0)
goto ratelimited;
if (r == 0)
@@ -2180,7 +2180,7 @@ static int list_unit_files_by_patterns(sd_bus_message *message, void *userdata,
if (r < 0)
return r;
r = unit_file_get_list(m->runtime_scope, /* root_dir = */ NULL, states, patterns, &h);
r = unit_file_get_list(m->runtime_scope, /* root_dir= */ NULL, states, patterns, &h);
if (r < 0)
return r;
@@ -2446,19 +2446,19 @@ static int method_enable_unit_files_generic(
}
static int method_enable_unit_files_with_flags(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) {
return method_enable_unit_files_generic(message, userdata, unit_file_enable, /* carries_install_info = */ true, reterr_error);
return method_enable_unit_files_generic(message, userdata, unit_file_enable, /* carries_install_info= */ true, reterr_error);
}
static int method_enable_unit_files(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) {
return method_enable_unit_files_generic(message, userdata, unit_file_enable, /* carries_install_info = */ true, reterr_error);
return method_enable_unit_files_generic(message, userdata, unit_file_enable, /* carries_install_info= */ true, reterr_error);
}
static int method_reenable_unit_files(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) {
return method_enable_unit_files_generic(message, userdata, unit_file_reenable, /* carries_install_info = */ true, reterr_error);
return method_enable_unit_files_generic(message, userdata, unit_file_reenable, /* carries_install_info= */ true, reterr_error);
}
static int method_link_unit_files(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) {
return method_enable_unit_files_generic(message, userdata, unit_file_link, /* carries_install_info = */ false, reterr_error);
return method_enable_unit_files_generic(message, userdata, unit_file_link, /* carries_install_info= */ false, reterr_error);
}
static int unit_file_preset_without_mode(RuntimeScope scope, UnitFileFlags flags, const char *root_dir, char * const *files, InstallChange **changes, size_t *n_changes) {
@@ -2466,11 +2466,11 @@ static int unit_file_preset_without_mode(RuntimeScope scope, UnitFileFlags flags
}
static int method_preset_unit_files(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) {
return method_enable_unit_files_generic(message, userdata, unit_file_preset_without_mode, /* carries_install_info = */ true, reterr_error);
return method_enable_unit_files_generic(message, userdata, unit_file_preset_without_mode, /* carries_install_info= */ true, reterr_error);
}
static int method_mask_unit_files(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) {
return method_enable_unit_files_generic(message, userdata, unit_file_mask, /* carries_install_info = */ false, reterr_error);
return method_enable_unit_files_generic(message, userdata, unit_file_mask, /* carries_install_info= */ false, reterr_error);
}
static int method_preset_unit_files_with_mode(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) {
@@ -2573,19 +2573,19 @@ static int method_disable_unit_files_generic(
}
static int method_disable_unit_files_with_flags(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) {
return method_disable_unit_files_generic(message, userdata, unit_file_disable, /* carries_install_info = */ false, reterr_error);
return method_disable_unit_files_generic(message, userdata, unit_file_disable, /* carries_install_info= */ false, reterr_error);
}
static int method_disable_unit_files_with_flags_and_install_info(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) {
return method_disable_unit_files_generic(message, userdata, unit_file_disable, /* carries_install_info = */ true, reterr_error);
return method_disable_unit_files_generic(message, userdata, unit_file_disable, /* carries_install_info= */ true, reterr_error);
}
static int method_disable_unit_files(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) {
return method_disable_unit_files_generic(message, userdata, unit_file_disable, /* carries_install_info = */ false, reterr_error);
return method_disable_unit_files_generic(message, userdata, unit_file_disable, /* carries_install_info= */ false, reterr_error);
}
static int method_unmask_unit_files(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) {
return method_disable_unit_files_generic(message, userdata, unit_file_unmask, /* carries_install_info = */ false, reterr_error);
return method_disable_unit_files_generic(message, userdata, unit_file_unmask, /* carries_install_info= */ false, reterr_error);
}
static int method_revert_unit_files(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) {
+2 -2
View File
@@ -1392,7 +1392,7 @@ static int append_cgroup(sd_bus_message *reply, const char *p, Set *pids) {
* We'll see ENODEV when trying to enumerate processes and the cgroup is removed at the same
* time. Handle this gracefully. */
r = cg_read_pidref(f, &pidref, /* flags = */ 0);
r = cg_read_pidref(f, &pidref, /* flags= */ 0);
if (IN_SET(r, 0, -EOPNOTSUPP, -ENODEV))
break;
if (r < 0)
@@ -2005,7 +2005,7 @@ int bus_unit_queue_job_one(
return -ENOMEM;
}
r = manager_add_job_full(u->manager, type, u, mode, /* extra_flags = */ 0, affected, reterr_error, &j);
r = manager_add_job_full(u->manager, type, u, mode, /* extra_flags= */ 0, affected, reterr_error, &j);
if (r < 0)
return r;
+1 -1
View File
@@ -128,7 +128,7 @@ static int signal_activation_request(sd_bus_message *message, void *userdata, sd
goto failed;
}
r = manager_add_job(m, JOB_START, u, JOB_REPLACE, &error, /* ret = */ NULL);
r = manager_add_job(m, JOB_START, u, JOB_REPLACE, &error, /* ret= */ NULL);
if (r < 0)
goto failed;
+6 -6
View File
@@ -177,7 +177,7 @@ static void device_set_state(Device *d, DeviceState state) {
if (state != old_state)
log_unit_debug(UNIT(d), "Changed %s -> %s", device_state_to_string(old_state), device_state_to_string(state));
unit_notify(UNIT(d), state_translation_table[old_state], state_translation_table[state], /* reload_success = */ true);
unit_notify(UNIT(d), state_translation_table[old_state], state_translation_table[state], /* reload_success= */ true);
}
static void device_found_changed(Device *d, DeviceFound previous, DeviceFound now) {
@@ -800,7 +800,7 @@ static int device_setup_devlink_unit_one(Manager *m, const char *devlink, Set **
/* Note, even if the device is being processed by udevd, setup the unit on enumerate.
* See also the comments in device_catchup(). */
return device_setup_unit(m, dev, devlink, /* main = */ false, ready_units);
return device_setup_unit(m, dev, devlink, /* main= */ false, ready_units);
}
/* the devlink is already removed or not ready */
@@ -866,7 +866,7 @@ static int device_setup_extra_units(Manager *m, sd_device *dev, Set **ready_unit
* To achieve that, they set the path to SYSTEMD_ALIAS. Hence, we cannot refuse aliases start
* with /dev/, unfortunately. */
(void) device_setup_unit(m, dev, *alias, /* main = */ false, ready_units);
(void) device_setup_unit(m, dev, *alias, /* main= */ false, ready_units);
}
l = hashmap_get(m->devices_by_sysfs, syspath);
@@ -925,13 +925,13 @@ static int device_setup_units(Manager *m, sd_device *dev, Set **ret_ready_units,
/* Add the main unit named after the syspath. If this one fails, don't bother with the rest,
* as this one shall be the main device unit the others just follow. (Compare with how
* device_following() is implemented, see below, which looks for the sysfs device.) */
r = device_setup_unit(m, dev, syspath, /* main = */ true, &ready_units);
r = device_setup_unit(m, dev, syspath, /* main= */ true, &ready_units);
if (r < 0)
return r;
/* Add an additional unit for the device node */
if (sd_device_get_devname(dev, &devname) >= 0)
(void) device_setup_unit(m, dev, devname, /* main = */ false, &ready_units);
(void) device_setup_unit(m, dev, devname, /* main= */ false, &ready_units);
} else {
Unit *u;
@@ -1272,7 +1272,7 @@ void device_found_node(Manager *m, const char *node, DeviceFound found, DeviceFo
return;
}
(void) device_setup_unit(m, dev, node, /* main = */ false, NULL); /* 'dev' may be NULL. */
(void) device_setup_unit(m, dev, node, /* main= */ false, NULL); /* 'dev' may be NULL. */
}
/* Update the device unit's state, should it exist */
+8 -8
View File
@@ -536,7 +536,7 @@ static int load_credential_glob(
if (!j)
return -ENOMEM;
r = safe_glob(j, /* flags = */ 0, &paths);
r = safe_glob(j, /* flags= */ 0, &paths);
if (r == -ENOENT)
continue;
if (r < 0)
@@ -971,9 +971,9 @@ static int setup_credentials_plain_dir(
return log_debug_errno(dfd, "Failed to create workspace for credentials: %m");
workspace_rm = workspace;
(void) label_fix_full(dfd, /* inode_path = */ NULL, cred_dir, /* flags = */ 0);
(void) label_fix_full(dfd, /* inode_path= */ NULL, cred_dir, /* flags= */ 0);
r = acquire_credentials(context, cgroup_context, params, unit, dfd, uid, gid, /* ownership_ok = */ false);
r = acquire_credentials(context, cgroup_context, params, unit, dfd, uid, gid, /* ownership_ok= */ false);
if (r < 0)
return r;
@@ -989,7 +989,7 @@ static int setup_credentials_plain_dir(
/* rename() requires both the source and target to be writable, hence lock down write permission
* as last step. */
r = credentials_dir_finalize_permissions(dfd, uid, gid, /* ownership_ok = */ false);
r = credentials_dir_finalize_permissions(dfd, uid, gid, /* ownership_ok= */ false);
if (r < 0)
return log_debug_errno(r, "Failed to adjust ACLs of credentials dir: %m");
@@ -1016,7 +1016,7 @@ static int setup_credentials_internal(
if (!FLAGS_SET(params->flags, EXEC_SETUP_CREDENTIALS_FRESH)) {
/* We may reuse the previous credential dir */
r = dir_is_empty(cred_dir, /* ignore_hidden_or_backup = */ false);
r = dir_is_empty(cred_dir, /* ignore_hidden_or_backup= */ false);
if (r < 0)
return r;
if (r == 0) {
@@ -1042,13 +1042,13 @@ static int setup_credentials_internal(
if (dfd < 0)
return dfd;
(void) label_fix_full(dfd, /* inode_path = */ NULL, cred_dir, /* flags = */ 0);
(void) label_fix_full(dfd, /* inode_path= */ NULL, cred_dir, /* flags= */ 0);
r = acquire_credentials(context, cgroup_context, params, unit, dfd, uid, gid, /* ownership_ok = */ true);
r = acquire_credentials(context, cgroup_context, params, unit, dfd, uid, gid, /* ownership_ok= */ true);
if (r < 0)
return r;
r = credentials_dir_finalize_permissions(dfd, uid, gid, /* ownership_ok = */ true);
r = credentials_dir_finalize_permissions(dfd, uid, gid, /* ownership_ok= */ true);
if (r < 0)
return log_debug_errno(r, "Failed to adjust ACLs of credentials dir: %m");
+16 -16
View File
@@ -915,7 +915,7 @@ static int get_fixed_group(
assert(group_or_gid);
assert(ret_groupname);
r = get_group_creds(&group_or_gid, ret_gid, /* flags = */ 0);
r = get_group_creds(&group_or_gid, ret_gid, /* flags= */ 0);
if (r < 0)
return r;
@@ -993,7 +993,7 @@ static int get_supplementary_groups(
return -E2BIG;
const char *g = *i;
r = get_group_creds(&g, l_gids + k, /* flags = */ 0);
r = get_group_creds(&g, l_gids + k, /* flags= */ 0);
if (r < 0)
return r;
@@ -2114,7 +2114,7 @@ static int build_environment(
if (!username && !c->dynamic_user && p->runtime_scope == RUNTIME_SCOPE_SYSTEM) {
assert(!c->user);
r = get_fixed_user("root", /* prefer_nss = */ false, &username, NULL, NULL, &home, &shell);
r = get_fixed_user("root", /* prefer_nss= */ false, &username, NULL, NULL, &home, &shell);
if (r < 0) {
log_debug_errno(r, "Failed to determine credentials for user root: %s",
STRERROR_USER(r));
@@ -2347,28 +2347,28 @@ static int bpffs_helper(const ExecContext *c, int socket_fd) {
assert(c);
assert(socket_fd >= 0);
_cleanup_close_ int fs_fd = receive_one_fd(socket_fd, /* flags = */ 0);
_cleanup_close_ int fs_fd = receive_one_fd(socket_fd, /* flags= */ 0);
if (fs_fd < 0)
return log_debug_errno(fs_fd, "Failed to receive file descriptor from parent: %m");
char number[STRLEN("0x") + sizeof(c->bpf_delegate_commands) * 2 + 1];
xsprintf(number, "0x%"PRIx64, c->bpf_delegate_commands);
if (fsconfig(fs_fd, FSCONFIG_SET_STRING, "delegate_cmds", number, /* aux = */ 0) < 0)
if (fsconfig(fs_fd, FSCONFIG_SET_STRING, "delegate_cmds", number, /* aux= */ 0) < 0)
return log_debug_errno(errno, "Failed to FSCONFIG_SET_STRING: %m");
xsprintf(number, "0x%"PRIx64, c->bpf_delegate_maps);
if (fsconfig(fs_fd, FSCONFIG_SET_STRING, "delegate_maps", number, /* aux = */ 0) < 0)
if (fsconfig(fs_fd, FSCONFIG_SET_STRING, "delegate_maps", number, /* aux= */ 0) < 0)
return log_debug_errno(errno, "Failed to FSCONFIG_SET_STRING: %m");
xsprintf(number, "0x%"PRIx64, c->bpf_delegate_programs);
if (fsconfig(fs_fd, FSCONFIG_SET_STRING, "delegate_progs", number, /* aux = */ 0) < 0)
if (fsconfig(fs_fd, FSCONFIG_SET_STRING, "delegate_progs", number, /* aux= */ 0) < 0)
return log_debug_errno(errno, "Failed to FSCONFIG_SET_STRING: %m");
xsprintf(number, "0x%"PRIx64, c->bpf_delegate_attachments);
if (fsconfig(fs_fd, FSCONFIG_SET_STRING, "delegate_attachs", number, /* aux = */ 0) < 0)
if (fsconfig(fs_fd, FSCONFIG_SET_STRING, "delegate_attachs", number, /* aux= */ 0) < 0)
return log_debug_errno(errno, "Failed to FSCONFIG_SET_STRING: %m");
if (fsconfig(fs_fd, FSCONFIG_CMD_CREATE, /* key = */ NULL, /* value = */ NULL, /* aux = */ 0) < 0)
if (fsconfig(fs_fd, FSCONFIG_CMD_CREATE, /* key= */ NULL, /* value= */ NULL, /* aux= */ 0) < 0)
return log_debug_errno(errno, "Failed to create bpffs superblock: %m");
return 0;
@@ -2604,7 +2604,7 @@ static int can_mount_proc(void) {
if (n != 0) /* on success we should have read 0 bytes */
return -EIO;
r = wait_for_terminate_and_check("(sd-proc-check)", TAKE_PID(pid), 0 /* flags= */);
r = wait_for_terminate_and_check("(sd-proc-check)", TAKE_PID(pid), /* flags= */ 0);
if (r < 0)
return log_debug_errno(r, "Failed to wait for (sd-proc-check) child process to terminate: %m");
if (r != EXIT_SUCCESS) /* If something strange happened with the child, let's consider this fatal, too */
@@ -2647,8 +2647,8 @@ static int setup_private_pids(const ExecContext *c, ExecParameters *p) {
p->pidref_transport_fd,
pidref.fd,
&IOVEC_MAKE(&pidref.pid, sizeof(pidref.pid)),
/*iovlen=*/ 1,
/*flags=*/ 0);
/* iovlen= */ 1,
/* flags= */ 0);
/* Send error code to child process. */
(void) write(errno_pipe[1], &q, sizeof(q));
/* Exit here so we only go through the destructors in exec_invoke only once - in the child - as
@@ -2725,7 +2725,7 @@ static int set_exec_storage_quota(int fd, uint32_t proj_id, const QuotaLimit *ql
return -errno;
uint32_t xattr_flags = 0;
r = read_fs_xattr_fd(fd_parent, &xattr_flags, /* ret_projid = */ NULL);
r = read_fs_xattr_fd(fd_parent, &xattr_flags, /* ret_projid= */ NULL);
if (r < 0)
return r;
/* Refuse if parent has FS_XFLAG_PROJINHERIT since this will mean the total number of blocks will not
@@ -2815,7 +2815,7 @@ static int apply_exec_quotas(
/* Get the project ID of the current directory */
uint32_t proj_id;
r = read_fs_xattr_fd(fd, /* ret_xflags = */ NULL, &proj_id);
r = read_fs_xattr_fd(fd, /* ret_xflags= */ NULL, &proj_id);
if (ERRNO_IS_NEG_IOCTL_NOT_SUPPORTED(r)) {
log_debug_errno(r, "Not applying storage quotas. FS_IOC_FSGETXATTR not supported for %s: %m", target_dir);
return 0;
@@ -4988,7 +4988,7 @@ static int setup_term_environment(const ExecContext *context, char ***env) {
if (!key)
return -ENOMEM;
r = proc_cmdline_get_key(key, /* flags = */ 0, &cmdline);
r = proc_cmdline_get_key(key, /* flags= */ 0, &cmdline);
if (r > 0)
return strv_env_assign(env, "TERM", cmdline);
if (r < 0)
@@ -5292,7 +5292,7 @@ int exec_invoke(
* or PAM shall be invoked, let's consult NSS even for root, so that the user
* gets accurate $SHELL in session(-like) contexts. */
r = get_fixed_user(u,
/* prefer_nss = */ context->set_login_environment > 0 || context->pam_name,
/* prefer_nss= */ context->set_login_environment > 0 || context->pam_name,
&username, &uid, &gid, &pwent_home, &shell);
if (r < 0) {
*exit_status = EXIT_USER;
+1 -1
View File
@@ -3701,7 +3701,7 @@ static int exec_context_deserialize(ExecContext *c, FILE *f) {
_cleanup_free_ void *d = NULL;
size_t size;
r = unbase64mem_full(data, SIZE_MAX, /* secure = */ true, &d, &size);
r = unbase64mem_full(data, SIZE_MAX, /* secure= */ true, &d, &size);
if (r < 0)
return r;
+2 -2
View File
@@ -918,7 +918,7 @@ static int exec_context_load_environment(const Unit *unit, const ExecContext *c,
}
/* Filename supports globbing, take all matching files */
r = safe_glob(fn, /* flags = */ 0, &paths);
r = safe_glob(fn, /* flags= */ 0, &paths);
if (r < 0) {
if (ignore)
continue;
@@ -2260,7 +2260,7 @@ int exec_command_append(ExecCommand *c, const char *path, ...) {
if (!l)
return -ENOMEM;
r = strv_extend_strv_consume(&c->argv, l, /* filter_duplicates = */ false);
r = strv_extend_strv_consume(&c->argv, l, /* filter_duplicates= */ false);
if (r < 0)
return r;
+1 -1
View File
@@ -532,7 +532,7 @@ static int parse_smbios_strings(ImportCredentialsContext *c, const char *data, s
/* Optionally base64 decode the data, if requested, to allow binary credentials */
if (unbase64) {
r = unbase64mem_full(eq + 1, nul - (eq + 1), /* secure = */ false, &buf, &buflen);
r = unbase64mem_full(eq + 1, nul - (eq + 1), /* secure= */ false, &buf, &buflen);
if (r < 0) {
log_warning_errno(r, "Failed to base64 decode credential '%s', ignoring: %m", cn);
continue;
+6 -6
View File
@@ -406,13 +406,13 @@ void job_dump(Job *j, FILE *f, const char *prefix) {
* be merged with C either.
*/
static const JobType job_merging_table[] = {
/* What \ With * JOB_START JOB_VERIFY_ACTIVE JOB_STOP JOB_RELOAD */
/* What \ With * JOB_START JOB_VERIFY_ACTIVE JOB_STOP JOB_RELOAD */
/*********************************************************************************/
/*JOB_START */
/*JOB_VERIFY_ACTIVE */ JOB_START,
/*JOB_STOP */ -1, -1,
/*JOB_RELOAD */ JOB_RELOAD_OR_START, JOB_RELOAD, -1,
/*JOB_RESTART */ JOB_RESTART, JOB_RESTART, -1, JOB_RESTART,
/* JOB_START */
/* JOB_VERIFY_ACTIVE */ JOB_START,
/* JOB_STOP */ -1, -1,
/* JOB_RELOAD */ JOB_RELOAD_OR_START, JOB_RELOAD, -1,
/* JOB_RESTART */ JOB_RESTART, JOB_RESTART, -1, JOB_RESTART,
};
JobType job_type_lookup_merge(JobType a, JobType b) {
+2 -2
View File
@@ -126,11 +126,11 @@ int unit_load_dropin(Unit *u) {
return r;
/* Load .conf dropins */
r = unit_find_dropin_paths(u, /* use_unit_path_cache = */ true, &l);
r = unit_find_dropin_paths(u, /* use_unit_path_cache= */ true, &l);
if (r <= 0)
return 0;
r = strv_extend_strv_consume(&u->dropin_paths, TAKE_PTR(l), /* filter_duplicates = */ true);
r = strv_extend_strv_consume(&u->dropin_paths, TAKE_PTR(l), /* filter_duplicates= */ true);
if (r < 0)
return log_oom();
+6 -6
View File
@@ -1015,7 +1015,7 @@ int config_parse_exec(
/* Check explicitly for an unquoted semicolon as command separator token. */
if (p[0] == ';' && (!p[1] || strchr(WHITESPACE, p[1]))) {
p++;
p = skip_leading_chars(p, /* bad = */ NULL);
p = skip_leading_chars(p, /* bad= */ NULL);
semicolon = true;
break;
}
@@ -1024,7 +1024,7 @@ int config_parse_exec(
* extract_first_word() would return the same for all of those. */
if (p[0] == '\\' && p[1] == ';' && (!p[2] || strchr(WHITESPACE, p[2]))) {
p += 2;
p = skip_leading_chars(p, /* bad = */ NULL);
p = skip_leading_chars(p, /* bad= */ NULL);
if (strv_extend(&args, ";") < 0)
return log_oom();
@@ -2817,7 +2817,7 @@ int config_parse_pass_environ(
return log_oom();
}
r = strv_extend_strv_consume(passenv, TAKE_PTR(n), /* filter_duplicates = */ true);
r = strv_extend_strv_consume(passenv, TAKE_PTR(n), /* filter_duplicates= */ true);
if (r < 0)
return log_oom();
@@ -2886,7 +2886,7 @@ int config_parse_unset_environ(
return log_oom();
}
r = strv_extend_strv_consume(unsetenv, TAKE_PTR(n), /* filter_duplicates = */ true);
r = strv_extend_strv_consume(unsetenv, TAKE_PTR(n), /* filter_duplicates= */ true);
if (r < 0)
return log_oom();
@@ -4678,7 +4678,7 @@ int config_parse_set_credential(
size_t size;
if (encrypted) {
r = unbase64mem_full(p, SIZE_MAX, /* secure = */ true, &d, &size);
r = unbase64mem_full(p, SIZE_MAX, /* secure= */ true, &d, &size);
if (r == -ENOMEM)
return log_oom();
if (r < 0) {
@@ -6631,7 +6631,7 @@ int config_parse_protect_hostname(
return 0;
}
if (!hostname_is_valid(h, /* flags = */ 0))
if (!hostname_is_valid(h, /* flags= */ 0))
return log_syntax(unit, LOG_WARNING, filename, line, 0,
"Invalid hostname is specified to %s=, ignoring: %s", lvalue, h);
+10 -10
View File
@@ -841,7 +841,7 @@ static int parse_config_file(void) {
(const char* const*) files,
(const char* const*) dirs,
"user.conf.d",
/* root = */ NULL,
/* root= */ NULL,
"Manager\0",
config_item_table_lookup, items,
CONFIG_PARSE_WARN,
@@ -1427,7 +1427,7 @@ static int os_release_status(void) {
}
}
if (support_end && os_release_support_ended(support_end, /* quiet = */ false, /* ret_eol = */ NULL) > 0)
if (support_end && os_release_support_ended(support_end, /* quiet= */ false, /* ret_eol= */ NULL) > 0)
/* pretty_name may include the version already, so we'll print the version only if we
* have it and we're not using pretty_name. */
status_printf(ANSI_HIGHLIGHT_RED " !! " ANSI_NORMAL, 0,
@@ -1998,19 +1998,19 @@ static int do_reexecute(
/* If we're supposed to switch root, preemptively check the existence of a usable init.
* Otherwise the system might end up in a completely undebuggable state afterwards. */
if (switch_root_init) {
r = chase_and_access(switch_root_init, switch_root_dir, CHASE_PREFIX_ROOT, X_OK, /* ret_path = */ NULL);
r = chase_and_access(switch_root_init, switch_root_dir, CHASE_PREFIX_ROOT, X_OK, /* ret_path= */ NULL);
if (r < 0)
log_warning_errno(r, "Failed to chase configured init %s/%s: %m",
switch_root_dir, switch_root_init);
} else {
r = chase_and_access(SYSTEMD_BINARY_PATH, switch_root_dir, CHASE_PREFIX_ROOT, X_OK, /* ret_path = */ NULL);
r = chase_and_access(SYSTEMD_BINARY_PATH, switch_root_dir, CHASE_PREFIX_ROOT, X_OK, /* ret_path= */ NULL);
if (r < 0)
log_debug_errno(r, "Failed to chase our own binary %s/%s: %m",
switch_root_dir, SYSTEMD_BINARY_PATH);
}
if (r < 0) {
r = chase_and_access("/sbin/init", switch_root_dir, CHASE_PREFIX_ROOT, X_OK, /* ret_path = */ NULL);
r = chase_and_access("/sbin/init", switch_root_dir, CHASE_PREFIX_ROOT, X_OK, /* ret_path= */ NULL);
if (r < 0) {
*ret_error_message = "Switch root target contains no usable init";
return log_error_errno(r, "Failed to chase %s/sbin/init", switch_root_dir);
@@ -2355,7 +2355,7 @@ static void log_execution_mode(bool *ret_first_boot) {
/* Let's check whether we are in first boot. First, check if an override was
* specified on the kernel command line. If yes, we honour that. */
r = proc_cmdline_get_bool("systemd.condition_first_boot", /* flags = */ 0, &first_boot);
r = proc_cmdline_get_bool("systemd.condition_first_boot", /* flags= */ 0, &first_boot);
if (r < 0)
log_debug_errno(r, "Failed to parse systemd.condition_first_boot= kernel command line argument, ignoring: %m");
@@ -2447,7 +2447,7 @@ static int initialize_runtime(
if (!skip_setup) {
/* Check that /usr/ is either on the same file system as / or mounted already. */
if (dir_is_empty("/usr", /* ignore_hidden_or_backup = */ true) > 0) {
if (dir_is_empty("/usr", /* ignore_hidden_or_backup= */ true) > 0) {
*ret_error_message = "Refusing to run in unsupported environment where /usr/ is not populated";
return -ENOEXEC;
}
@@ -2458,11 +2458,11 @@ static int initialize_runtime(
(void) import_credentials();
(void) os_release_status();
(void) machine_id_setup(/* root = */ NULL, arg_machine_id,
(void) machine_id_setup(/* root= */ NULL, arg_machine_id,
(first_boot ? MACHINE_ID_SETUP_FORCE_TRANSIENT : 0) |
(arg_machine_id_from_firmware ? MACHINE_ID_SETUP_FORCE_FIRMWARE : 0),
/* ret = */ NULL);
(void) hostname_setup(/* really = */ true);
/* ret= */ NULL);
(void) hostname_setup(/* really= */ true);
(void) loopback_setup();
bump_unix_max_dgram_qlen();
+9 -9
View File
@@ -1005,7 +1005,7 @@ int manager_new(RuntimeScope runtime_scope, ManagerTestRunFlags test_run_flags,
return r;
#if HAVE_LIBBPF
if (MANAGER_IS_SYSTEM(m) && bpf_restrict_fs_supported(/* initialize = */ true)) {
if (MANAGER_IS_SYSTEM(m) && bpf_restrict_fs_supported(/* initialize= */ true)) {
r = bpf_restrict_fs_setup(m);
if (r < 0)
log_warning_errno(r, "Failed to setup LSM BPF, ignoring: %m");
@@ -1510,7 +1510,7 @@ static unsigned manager_dispatch_stop_when_unneeded_queue(Manager *m) {
}
/* Ok, nobody needs us anymore. Sniff. Then let's commit suicide */
r = manager_add_job(u->manager, JOB_STOP, u, JOB_FAIL, &error, /* ret = */ NULL);
r = manager_add_job(u->manager, JOB_STOP, u, JOB_FAIL, &error, /* ret= */ NULL);
if (r < 0)
log_unit_warning_errno(u, r, "Failed to enqueue stop job, ignoring: %s", bus_error_message(&error, r));
}
@@ -1551,7 +1551,7 @@ static unsigned manager_dispatch_start_when_upheld_queue(Manager *m) {
continue;
}
r = manager_add_job(u->manager, JOB_START, u, JOB_FAIL, &error, /* ret = */ NULL);
r = manager_add_job(u->manager, JOB_START, u, JOB_FAIL, &error, /* ret= */ NULL);
if (r < 0)
log_unit_warning_errno(u, r, "Failed to enqueue start job, ignoring: %s", bus_error_message(&error, r));
}
@@ -1592,7 +1592,7 @@ static unsigned manager_dispatch_stop_when_bound_queue(Manager *m) {
continue;
}
r = manager_add_job(u->manager, JOB_STOP, u, JOB_REPLACE, &error, /* ret = */ NULL);
r = manager_add_job(u->manager, JOB_STOP, u, JOB_REPLACE, &error, /* ret= */ NULL);
if (r < 0)
log_unit_warning_errno(u, r, "Failed to enqueue stop job, ignoring: %s", bus_error_message(&error, r));
}
@@ -1944,9 +1944,9 @@ static void manager_preset_all(Manager *m) {
CLEANUP_ARRAY(changes, n_changes, install_changes_free);
log_info("Applying preset policy.");
r = unit_file_preset_all(RUNTIME_SCOPE_SYSTEM, /* file_flags = */ 0,
/* root_dir = */ NULL, mode, &changes, &n_changes);
install_changes_dump(r, "preset", changes, n_changes, /* quiet = */ false);
r = unit_file_preset_all(RUNTIME_SCOPE_SYSTEM, /* file_flags= */ 0,
/* root_dir= */ NULL, mode, &changes, &n_changes);
install_changes_dump(r, "preset", changes, n_changes, /* quiet= */ false);
if (r < 0)
log_full_errno(r == -EEXIST ? LOG_NOTICE : LOG_WARNING, r,
"Failed to populate /etc with preset unit settings, ignoring: %m");
@@ -2232,7 +2232,7 @@ int manager_add_job_by_name(Manager *m, JobType type, const char *name, JobMode
return r;
assert(unit);
return manager_add_job_full(m, type, unit, mode, /* extra_flags = */ 0, affected_jobs, e, ret);
return manager_add_job_full(m, type, unit, mode, /* extra_flags= */ 0, affected_jobs, e, ret);
}
int manager_add_job_by_name_and_warn(Manager *m, JobType type, const char *name, JobMode mode, Set *affected_jobs, Job **ret) {
@@ -3924,7 +3924,7 @@ void manager_send_reloading(Manager *m) {
assert(m);
/* Let whoever invoked us know that we are now reloading */
(void) notify_reloading_full(/* status = */ NULL);
(void) notify_reloading_full(/* status= */ NULL);
/* And ensure that we'll send READY=1 again as soon as we are ready again */
m->ready_sent = false;
+26 -26
View File
@@ -665,7 +665,7 @@ static int mount_load(Unit *u) {
bool from_kernel = m->from_proc_self_mountinfo || u->perpetual;
r = unit_load_fragment_and_dropin(u, /* fragment_required = */ !from_kernel);
r = unit_load_fragment_and_dropin(u, /* fragment_required= */ !from_kernel);
/* Add in some extras. Note we do this in all cases (even if we failed to load the unit) when announced by the
* kernel, because we need some things to be set up no matter what when the kernel establishes a mount and thus
@@ -764,7 +764,7 @@ static void mount_catchup(Unit *u) {
break;
case MOUNT_MOUNTED:
assert(!pidref_is_set(&m->control_pid));
mount_enter_dead(m, MOUNT_SUCCESS, /* flush_result = */ false);
mount_enter_dead(m, MOUNT_SUCCESS, /* flush_result= */ false);
break;
default:
;
@@ -897,13 +897,13 @@ static void mount_enter_dead(Mount *m, MountResult f, bool flush_result) {
m->result = f;
unit_log_result(UNIT(m), m->result == MOUNT_SUCCESS, mount_result_to_string(m->result));
unit_warn_leftover_processes(UNIT(m), /* start = */ false);
unit_warn_leftover_processes(UNIT(m), /* start= */ false);
mount_set_state(m, m->result != MOUNT_SUCCESS ? MOUNT_FAILED : MOUNT_DEAD);
m->exec_runtime = exec_runtime_destroy(m->exec_runtime);
unit_destroy_runtime_data(UNIT(m), &m->exec_context, /* destroy_runtime_dir = */ true);
unit_destroy_runtime_data(UNIT(m), &m->exec_context, /* destroy_runtime_dir= */ true);
unit_unref_uid_gid(UNIT(m), true);
@@ -924,7 +924,7 @@ static void mount_enter_mounted(Mount *m, MountResult f) {
*
* Note that this effectively means fresh creds are used during remount, but that's mostly what
* users would expect anyways. */
unit_destroy_runtime_data(UNIT(m), &m->exec_context, /* destroy_runtime_dir = */ false);
unit_destroy_runtime_data(UNIT(m), &m->exec_context, /* destroy_runtime_dir= */ false);
mount_set_state(m, MOUNT_MOUNTED);
}
@@ -992,12 +992,12 @@ static void mount_enter_signal(Mount *m, MountState state, MountResult f) {
else if (state == MOUNT_UNMOUNTING_SIGTERM && m->kill_context.send_sigkill)
mount_enter_signal(m, MOUNT_UNMOUNTING_SIGKILL, MOUNT_SUCCESS);
else
mount_enter_dead_or_mounted(m, MOUNT_SUCCESS, /* flush_result = */ false);
mount_enter_dead_or_mounted(m, MOUNT_SUCCESS, /* flush_result= */ false);
return;
fail:
mount_enter_dead_or_mounted(m, MOUNT_FAILURE_RESOURCES, /* flush_result = */ false);
mount_enter_dead_or_mounted(m, MOUNT_FAILURE_RESOURCES, /* flush_result= */ false);
}
static int mount_set_umount_command(Mount *m, ExecCommand *c) {
@@ -1058,7 +1058,7 @@ static void mount_enter_unmounting(Mount *m) {
return;
fail:
mount_enter_dead_or_mounted(m, MOUNT_FAILURE_RESOURCES, /* flush_result = */ false);
mount_enter_dead_or_mounted(m, MOUNT_FAILURE_RESOURCES, /* flush_result= */ false);
}
static int mount_apply_graceful_options(Mount *m, const MountParameters *p, char **opts) {
@@ -1188,7 +1188,7 @@ static void mount_enter_mounting(Mount *m) {
bool source_is_dir = true;
if (mount_is_bind(p)) {
r = is_dir(p->what, /* follow = */ true);
r = is_dir(p->what, /* follow= */ true);
if (r < 0 && r != -ENOENT)
log_unit_info_errno(UNIT(m), r, "Failed to determine type of bind mount source '%s', ignoring: %m", p->what);
else if (r == 0)
@@ -1248,12 +1248,12 @@ static void mount_enter_mounting(Mount *m) {
}
mount_unwatch_control_pid(m);
unit_warn_leftover_processes(UNIT(m), /* start = */ true);
unit_warn_leftover_processes(UNIT(m), /* start= */ true);
m->control_command_id = MOUNT_EXEC_MOUNT;
m->control_command = m->exec_command + MOUNT_EXEC_MOUNT;
r = mount_set_mount_command(m, m->control_command, p, /* remount = */ false);
r = mount_set_mount_command(m, m->control_command, p, /* remount= */ false);
if (r < 0) {
log_unit_error_errno(UNIT(m), r, "Failed to prepare mount command line: %m");
goto fail;
@@ -1269,7 +1269,7 @@ static void mount_enter_mounting(Mount *m) {
return;
fail:
mount_enter_dead_or_mounted(m, MOUNT_FAILURE_RESOURCES, /* flush_result = */ false);
mount_enter_dead_or_mounted(m, MOUNT_FAILURE_RESOURCES, /* flush_result= */ false);
}
static void mount_set_reload_result(Mount *m, MountResult result) {
@@ -1300,7 +1300,7 @@ static void mount_enter_remounting(Mount *m) {
m->control_command_id = MOUNT_EXEC_REMOUNT;
m->control_command = m->exec_command + MOUNT_EXEC_REMOUNT;
r = mount_set_mount_command(m, m->control_command, p, /* remount = */ true);
r = mount_set_mount_command(m, m->control_command, p, /* remount= */ true);
if (r < 0) {
log_unit_error_errno(UNIT(m), r, "Failed to prepare remount command line: %m");
goto fail;
@@ -1317,7 +1317,7 @@ static void mount_enter_remounting(Mount *m) {
fail:
mount_set_reload_result(m, MOUNT_FAILURE_RESOURCES);
mount_enter_dead_or_mounted(m, MOUNT_SUCCESS, /* flush_result = */ false);
mount_enter_dead_or_mounted(m, MOUNT_SUCCESS, /* flush_result= */ false);
}
static void mount_cycle_clear(Mount *m) {
@@ -1582,7 +1582,7 @@ static void mount_sigchld_event(Unit *u, pid_t pid, int code, int status) {
log_unit_warning(UNIT(m), "Mount process finished, but there is no mount.");
f = MOUNT_FAILURE_PROTOCOL;
}
mount_enter_dead(m, f, /* flush_result = */ false);
mount_enter_dead(m, f, /* flush_result= */ false);
break;
case MOUNT_MOUNTING_DONE:
@@ -1592,7 +1592,7 @@ static void mount_sigchld_event(Unit *u, pid_t pid, int code, int status) {
case MOUNT_REMOUNTING:
case MOUNT_REMOUNTING_SIGTERM:
case MOUNT_REMOUNTING_SIGKILL:
mount_enter_dead_or_mounted(m, MOUNT_SUCCESS, /* flush_result = */ false);
mount_enter_dead_or_mounted(m, MOUNT_SUCCESS, /* flush_result= */ false);
break;
case MOUNT_UNMOUNTING:
@@ -1613,27 +1613,27 @@ static void mount_sigchld_event(Unit *u, pid_t pid, int code, int status) {
/* Hmm, umount process spawned by us failed, but the mount disappeared anyway?
* Maybe someone else is trying to unmount at the same time. */
log_unit_notice(u, "Mount disappeared even though umount process failed, continuing.");
mount_enter_dead(m, MOUNT_SUCCESS, /* flush_result = */ true);
mount_enter_dead(m, MOUNT_SUCCESS, /* flush_result= */ true);
} else
/* At this point, either the unmount succeeded or unexpected error occurred. We usually
* remember the first error in 'result', but here let's update that forcibly, since
* there could previous failed attempts yet we only care about the most recent
* attempt. IOW, if we eventually managed to unmount the stuff, don't enter failed
* end state. */
mount_enter_dead_or_mounted(m, f, /* flush_result = */ true);
mount_enter_dead_or_mounted(m, f, /* flush_result= */ true);
break;
case MOUNT_UNMOUNTING_SIGTERM:
case MOUNT_UNMOUNTING_SIGKILL:
mount_enter_dead_or_mounted(m, f, /* flush_result = */ false);
mount_enter_dead_or_mounted(m, f, /* flush_result= */ false);
break;
case MOUNT_CLEANING:
if (m->clean_result == MOUNT_SUCCESS)
m->clean_result = f;
mount_enter_dead(m, MOUNT_SUCCESS, /* flush_result = */ false);
mount_enter_dead(m, MOUNT_SUCCESS, /* flush_result= */ false);
break;
default:
@@ -1671,7 +1671,7 @@ static int mount_dispatch_timer(sd_event_source *source, usec_t usec, void *user
mount_enter_signal(m, MOUNT_REMOUNTING_SIGKILL, MOUNT_SUCCESS);
} else {
log_unit_warning(UNIT(m), "Remounting timed out. Skipping SIGKILL. Ignoring.");
mount_enter_dead_or_mounted(m, MOUNT_SUCCESS, /* flush_result = */ false);
mount_enter_dead_or_mounted(m, MOUNT_SUCCESS, /* flush_result= */ false);
}
break;
@@ -1679,7 +1679,7 @@ static int mount_dispatch_timer(sd_event_source *source, usec_t usec, void *user
mount_set_reload_result(m, MOUNT_FAILURE_TIMEOUT);
log_unit_warning(UNIT(m), "Mount process still around after SIGKILL. Ignoring.");
mount_enter_dead_or_mounted(m, MOUNT_SUCCESS, /* flush_result = */ false);
mount_enter_dead_or_mounted(m, MOUNT_SUCCESS, /* flush_result= */ false);
break;
case MOUNT_UNMOUNTING:
@@ -1693,13 +1693,13 @@ static int mount_dispatch_timer(sd_event_source *source, usec_t usec, void *user
mount_enter_signal(m, MOUNT_UNMOUNTING_SIGKILL, MOUNT_FAILURE_TIMEOUT);
} else {
log_unit_warning(UNIT(m), "Mount process timed out. Skipping SIGKILL. Ignoring.");
mount_enter_dead_or_mounted(m, MOUNT_FAILURE_TIMEOUT, /* flush_result = */ false);
mount_enter_dead_or_mounted(m, MOUNT_FAILURE_TIMEOUT, /* flush_result= */ false);
}
break;
case MOUNT_UNMOUNTING_SIGKILL:
log_unit_warning(UNIT(m), "Mount process still around after SIGKILL. Ignoring.");
mount_enter_dead_or_mounted(m, MOUNT_FAILURE_TIMEOUT, /* flush_result = */ false);
mount_enter_dead_or_mounted(m, MOUNT_FAILURE_TIMEOUT, /* flush_result= */ false);
break;
case MOUNT_CLEANING:
@@ -2238,7 +2238,7 @@ static int mount_process_proc_self_mountinfo(Manager *m) {
* Also explicitly override the result (see the comment in mount_sigchld_event()),
* but more aggressively here since the state change is extrinsic. */
mount_cycle_clear(mount);
mount_enter_dead(mount, MOUNT_SUCCESS, /* flush_result = */ true);
mount_enter_dead(mount, MOUNT_SUCCESS, /* flush_result= */ true);
break;
case MOUNT_MOUNTING_DONE:
@@ -2395,7 +2395,7 @@ static int mount_test_startable(Unit *u) {
r = unit_test_start_limit(u);
if (r < 0) {
mount_enter_dead(m, MOUNT_FAILURE_START_LIMIT_HIT, /* flush_result = */ false);
mount_enter_dead(m, MOUNT_FAILURE_START_LIMIT_HIT, /* flush_result= */ false);
return r;
}
+15 -15
View File
@@ -1474,7 +1474,7 @@ static int mount_private_apivfs(
/* We lack permissions to mount a new instance, and it is not already mounted. But we can
* access the host's, so as a final fallback bind-mount it to the destination, as most likely
* we are inside a user manager in an unprivileged user namespace. */
r = mount_nofollow_verbose(LOG_DEBUG, bind_source, entry_path, /* fstype = */ NULL, MS_BIND|MS_REC, /* options = */ NULL);
r = mount_nofollow_verbose(LOG_DEBUG, bind_source, entry_path, /* fstype= */ NULL, MS_BIND|MS_REC, /* options= */ NULL);
if (r < 0)
return r;
@@ -1484,12 +1484,12 @@ static int mount_private_apivfs(
return r;
/* OK. We have a new mount instance. Let's clear an existing mount and its submounts. */
r = umount_recursive(entry_path, /* flags = */ 0);
r = umount_recursive(entry_path, /* flags= */ 0);
if (r < 0)
log_debug_errno(r, "Failed to unmount directories below '%s', ignoring: %m", entry_path);
/* Then, move the new mount instance. */
r = mount_nofollow_verbose(LOG_DEBUG, temporary_mount, entry_path, /* fstype = */ NULL, MS_MOVE, /* options = */ NULL);
r = mount_nofollow_verbose(LOG_DEBUG, temporary_mount, entry_path, /* fstype= */ NULL, MS_MOVE, /* options= */ NULL);
if (r < 0)
return r;
@@ -1502,13 +1502,13 @@ static int mount_private_apivfs(
static int mount_private_sysfs(const MountEntry *m, const NamespaceParameters *p) {
assert(m);
assert(p);
return mount_private_apivfs("sysfs", mount_entry_path(m), "/sys", /* opts = */ NULL, p->runtime_scope);
return mount_private_apivfs("sysfs", mount_entry_path(m), "/sys", /* opts= */ NULL, p->runtime_scope);
}
static int mount_private_cgroup2fs(const MountEntry *m, const NamespaceParameters *p) {
assert(m);
assert(p);
return mount_private_apivfs("cgroup2", mount_entry_path(m), "/sys/fs/cgroup", /* opts = */ NULL, p->runtime_scope);
return mount_private_apivfs("cgroup2", mount_entry_path(m), "/sys/fs/cgroup", /* opts= */ NULL, p->runtime_scope);
}
static int mount_procfs(const MountEntry *m, const NamespaceParameters *p) {
@@ -1743,11 +1743,11 @@ static int mount_bpffs(const MountEntry *m, PidRef *pidref, int socket_fd, int e
if (fs_fd < 0)
return log_debug_errno(errno, "Failed to fsopen: %m");
r = send_one_fd(socket_fd, fs_fd, /* flags = */ 0);
r = send_one_fd(socket_fd, fs_fd, /* flags= */ 0);
if (r < 0)
return log_debug_errno(r, "Failed to send bpffs fd to child: %m");
r = pidref_wait_for_terminate_and_check("(sd-bpffs)", pidref, /* flags = */ 0);
r = pidref_wait_for_terminate_and_check("(sd-bpffs)", pidref, /* flags= */ 0);
if (r < 0)
return r;
@@ -1763,7 +1763,7 @@ static int mount_bpffs(const MountEntry *m, PidRef *pidref, int socket_fd, int e
pidref_done(pidref);
_cleanup_close_ int mnt_fd = fsmount(fs_fd, /* flags = */ 0, /* mount_attrs = */ 0);
_cleanup_close_ int mnt_fd = fsmount(fs_fd, /* flags= */ 0, /* mount_attrs= */ 0);
if (mnt_fd < 0)
return log_debug_errno(errno, "Failed to fsmount bpffs: %m");
@@ -1886,7 +1886,7 @@ static int apply_one_mount(
case MOUNT_READ_WRITE_IMPLICIT:
case MOUNT_EXEC:
case MOUNT_NOEXEC:
r = path_is_mount_point_full(mount_entry_path(m), root_directory, /* flags = */ 0);
r = path_is_mount_point_full(mount_entry_path(m), root_directory, /* flags= */ 0);
if (r == -ENOENT && m->ignore)
return 0;
if (r < 0)
@@ -1952,7 +1952,7 @@ static int apply_one_mount(
host_os_release_id_like,
host_os_release_version_id,
host_os_release_level,
/* host_extension_scope = */ NULL, /* Leave empty, we need to accept both system and portable */
/* host_extension_scope= */ NULL, /* Leave empty, we need to accept both system and portable */
extension_release,
class);
if (r < 0)
@@ -2751,7 +2751,7 @@ int setup_namespace(const NamespaceParameters *p, char **reterr_path) {
if (r < 0)
return r;
r = append_private_bpf(&ml, p->private_bpf, p->protect_kernel_tunables, /* ignore_protect = */ false, p);
r = append_private_bpf(&ml, p->private_bpf, p->protect_kernel_tunables, /* ignore_protect= */ false, p);
if (r < 0)
return r;
@@ -2995,7 +2995,7 @@ int setup_namespace(const NamespaceParameters *p, char **reterr_path) {
} else if (p->root_directory) {
/* A root directory is specified. Turn its directory into bind mount, if it isn't one yet. */
r = path_is_mount_point_full(root, /* root = */ NULL, AT_SYMLINK_FOLLOW);
r = path_is_mount_point_full(root, /* root= */ NULL, AT_SYMLINK_FOLLOW);
if (r < 0)
return log_debug_errno(r, "Failed to detect that %s is a mount point or not: %m", root);
if (r == 0) {
@@ -3021,7 +3021,7 @@ int setup_namespace(const NamespaceParameters *p, char **reterr_path) {
return r;
/* MS_MOVE does not work on MS_SHARED so the remount MS_SHARED will be done later */
r = mount_switch_root(root, /* mount_propagation_flag = */ 0);
r = mount_switch_root(root, /* mount_propagation_flag= */ 0);
if (r == -EINVAL && p->root_directory) {
/* If we are using root_directory and we don't have privileges (ie: user manager in a user
* namespace) and the root_directory is already a mount point in the parent namespace,
@@ -3031,7 +3031,7 @@ int setup_namespace(const NamespaceParameters *p, char **reterr_path) {
r = mount_nofollow_verbose(LOG_DEBUG, root, root, NULL, MS_BIND|MS_REC, NULL);
if (r < 0)
return r;
r = mount_switch_root(root, /* mount_propagation_flag = */ 0);
r = mount_switch_root(root, /* mount_propagation_flag= */ 0);
}
if (r < 0)
return log_debug_errno(r, "Failed to mount root with MS_MOVE: %m");
@@ -4063,7 +4063,7 @@ int bpf_delegate_from_string(const char *s, uint64_t *ret, uint64_t (*parser)(co
for (;;) {
_cleanup_free_ char *word = NULL;
r = extract_first_word(&s, &word, ",", /* flags = */ 0);
r = extract_first_word(&s, &word, ",", /* flags= */ 0);
if (r < 0)
return log_warning_errno(r, "Failed to parse delegate options \"%s\": %m", s);
if (r == 0)
+4 -4
View File
@@ -478,7 +478,7 @@ static void path_set_state(Path *p, PathState state) {
if (state != old_state)
log_unit_debug(UNIT(p), "Changed %s -> %s", path_state_to_string(old_state), path_state_to_string(state));
unit_notify(UNIT(p), state_translation_table[old_state], state_translation_table[state], /* reload_success = */ true);
unit_notify(UNIT(p), state_translation_table[old_state], state_translation_table[state], /* reload_success= */ true);
}
static void path_enter_waiting(Path *p, bool initial, bool from_trigger_notify);
@@ -816,7 +816,7 @@ static int path_trigger_notify_on_defer(sd_event_source *s, void *userdata) {
return 0;
}
path_trigger_notify_impl(UNIT(p), trigger, /* on_defer = */ true);
path_trigger_notify_impl(UNIT(p), trigger, /* on_defer= */ true);
return 0;
}
@@ -857,7 +857,7 @@ static void path_trigger_notify_impl(Unit *u, Unit *other, bool on_defer) {
return;
if (on_defer) {
path_enter_waiting(p, /* initial = */ false, /* from_trigger_notify = */ true);
path_enter_waiting(p, /* initial= */ false, /* from_trigger_notify= */ true);
return;
}
@@ -886,7 +886,7 @@ static void path_trigger_notify_impl(Unit *u, Unit *other, bool on_defer) {
}
static void path_trigger_notify(Unit *u, Unit *other) {
path_trigger_notify_impl(u, other, /* on_defer = */ false);
path_trigger_notify_impl(u, other, /* on_defer= */ false);
}
static void path_reset_failed(Unit *u) {
+1 -1
View File
@@ -101,7 +101,7 @@ static void scope_set_state(Scope *s, ScopeState state) {
log_unit_debug(UNIT(s), "Changed %s -> %s",
scope_state_to_string(old_state), scope_state_to_string(state));
unit_notify(UNIT(s), state_translation_table[old_state], state_translation_table[state], /* reload_success = */ true);
unit_notify(UNIT(s), state_translation_table[old_state], state_translation_table[state], /* reload_success= */ true);
}
static int scope_add_default_dependencies(Scope *s) {
+24 -24
View File
@@ -1248,7 +1248,7 @@ static int service_load_pid_file(Service *s, bool may_warn) {
} else
log_unit_debug(UNIT(s), "Main PID loaded: "PID_FMT, pidref.pid);
r = service_set_main_pidref(s, TAKE_PIDREF(pidref), /* start_timestamp = */ NULL);
r = service_set_main_pidref(s, TAKE_PIDREF(pidref), /* start_timestamp= */ NULL);
if (r < 0)
return r;
@@ -1278,7 +1278,7 @@ static void service_search_main_pid(Service *s) {
return;
log_unit_debug(UNIT(s), "Main PID guessed: "PID_FMT, pid.pid);
if (service_set_main_pidref(s, TAKE_PIDREF(pid), /* start_timestamp = */ NULL) < 0)
if (service_set_main_pidref(s, TAKE_PIDREF(pid), /* start_timestamp= */ NULL) < 0)
return;
r = unit_watch_pidref(UNIT(s), &s->main_pid, /* exclusive= */ false);
@@ -1357,7 +1357,7 @@ static void service_set_state(Service *s, ServiceState state) {
}
if (start_only)
unit_destroy_runtime_data(u, &s->exec_context, /* destroy_runtime_dir = */ false);
unit_destroy_runtime_data(u, &s->exec_context, /* destroy_runtime_dir= */ false);
}
if (old_state != state)
@@ -1775,7 +1775,7 @@ static int service_spawn_internal(
&exec_params.fds,
&exec_params.fd_names,
&exec_params.n_socket_fds,
/* n_stashed_fds = */ NULL);
/* n_stashed_fds= */ NULL);
if (r < 0)
return r;
@@ -1814,7 +1814,7 @@ static int service_spawn_internal(
}
if (MANAGER_IS_USER(UNIT(s)->manager) &&
!exec_needs_pid_namespace(&s->exec_context, /* params = */ NULL)) {
!exec_needs_pid_namespace(&s->exec_context, /* params= */ NULL)) {
if (asprintf(our_env + n_env++, "MANAGERPID="PID_FMT, getpid_cached()) < 0)
return -ENOMEM;
@@ -2132,7 +2132,7 @@ static void service_enter_dead(Service *s, ServiceResult f, bool allow_restart)
end_state = SERVICE_FAILED;
restart_state = SERVICE_FAILED_BEFORE_AUTO_RESTART;
}
unit_warn_leftover_processes(UNIT(s), /* start = */ false);
unit_warn_leftover_processes(UNIT(s), /* start= */ false);
if (!allow_restart)
log_unit_debug(UNIT(s), "Service restart not allowed.");
@@ -2203,7 +2203,7 @@ static void service_enter_dead(Service *s, ServiceResult f, bool allow_restart)
s->exec_runtime = exec_runtime_destroy(s->exec_runtime);
/* Also, remove the runtime directory */
unit_destroy_runtime_data(UNIT(s), &s->exec_context, /* destroy_runtime_dir = */ true);
unit_destroy_runtime_data(UNIT(s), &s->exec_context, /* destroy_runtime_dir= */ true);
/* Also get rid of the fd store, if that's configured. */
if (s->fd_store_preserve_mode == EXEC_PRESERVE_NO)
@@ -2237,7 +2237,7 @@ static void service_enter_stop_post(Service *s, ServiceResult f) {
r = service_spawn(s,
s->control_command,
service_exec_flags(s->control_command_id, /* cred_flag = */ 0),
service_exec_flags(s->control_command_id, /* cred_flag= */ 0),
s->timeout_stop_usec,
&s->control_pid);
if (r < 0) {
@@ -2349,7 +2349,7 @@ static void service_enter_stop(Service *s, ServiceResult f) {
r = service_spawn(s,
s->control_command,
service_exec_flags(s->control_command_id, /* cred_flag = */ 0),
service_exec_flags(s->control_command_id, /* cred_flag= */ 0),
s->timeout_stop_usec,
&s->control_pid);
if (r < 0) {
@@ -2434,7 +2434,7 @@ static void service_enter_start_post(Service *s) {
r = service_spawn(s,
s->control_command,
service_exec_flags(s->control_command_id, /* cred_flag = */ 0),
service_exec_flags(s->control_command_id, /* cred_flag= */ 0),
s->timeout_start_usec,
&s->control_pid);
if (r < 0) {
@@ -2480,7 +2480,7 @@ static int service_adverse_to_leftover_processes(Service *s) {
* instances running, lets not stress the rigor of these. Also ExecStartPre= parts of the service
* aren't as rigoriously written to protect against multiple use. */
if (unit_warn_leftover_processes(UNIT(s), /* start = */ true) > 0 &&
if (unit_warn_leftover_processes(UNIT(s), /* start= */ true) > 0 &&
IN_SET(s->kill_context.kill_mode, KILL_MIXED, KILL_CONTROL_GROUP) &&
!s->kill_context.send_sigkill)
return log_unit_error_errno(UNIT(s), SYNTHETIC_ERRNO(EBUSY),
@@ -2604,7 +2604,7 @@ static void service_enter_start_pre(Service *s) {
r = service_spawn(s,
s->control_command,
service_exec_flags(s->control_command_id, /* cred_flag = */ 0),
service_exec_flags(s->control_command_id, /* cred_flag= */ 0),
s->timeout_start_usec,
&s->control_pid);
if (r < 0) {
@@ -2640,7 +2640,7 @@ static void service_enter_condition(Service *s) {
r = service_spawn(s,
s->control_command,
service_exec_flags(s->control_command_id, /* cred_flag = */ 0),
service_exec_flags(s->control_command_id, /* cred_flag= */ 0),
s->timeout_start_usec,
&s->control_pid);
if (r < 0) {
@@ -2685,8 +2685,8 @@ static void service_enter_restart(Service *s, bool shortcut) {
JOB_START, UNIT(s),
s->restart_mode == SERVICE_RESTART_MODE_DIRECT ? JOB_REPLACE : JOB_RESTART_DEPENDENCIES,
TRANSACTION_REENQUEUE_ANCHOR,
/* affected_jobs = */ NULL,
&error, /* ret = */ NULL);
/* affected_jobs= */ NULL,
&error, /* ret= */ NULL);
if (r < 0) {
log_unit_warning(UNIT(s), "Failed to schedule restart job: %s", bus_error_message(&error, r));
return service_enter_dead(s, SERVICE_FAILURE_RESOURCES, /* allow_restart= */ false);
@@ -2744,7 +2744,7 @@ static void service_enter_reload_post(Service *s) {
r = service_spawn(s,
s->control_command,
service_exec_flags(s->control_command_id, /* cred_flag = */ 0),
service_exec_flags(s->control_command_id, /* cred_flag= */ 0),
s->timeout_start_usec,
&s->control_pid);
if (r < 0) {
@@ -2819,7 +2819,7 @@ static void service_enter_reload(Service *s) {
r = service_spawn(s,
s->control_command,
service_exec_flags(s->control_command_id, /* cred_flag = */ 0),
service_exec_flags(s->control_command_id, /* cred_flag= */ 0),
s->timeout_start_usec,
&s->control_pid);
if (r < 0) {
@@ -2961,7 +2961,7 @@ static void service_run_next_control(Service *s) {
r = service_spawn(s,
s->control_command,
service_exec_flags(s->control_command_id, /* cred_flag = */ 0),
service_exec_flags(s->control_command_id, /* cred_flag= */ 0),
timeout,
&s->control_pid);
if (r < 0) {
@@ -3013,7 +3013,7 @@ static int service_start(Unit *u) {
* for auto restart. We need to re-enqueue the job though, as the job type has changed
* (JOB_RESTART_DEPENDENCIES). */
service_enter_restart(s, /* shortcut = */ true);
service_enter_restart(s, /* shortcut= */ true);
return -EAGAIN;
}
@@ -3561,7 +3561,7 @@ static int service_deserialize_item(Unit *u, const char *key, const char *value,
PidRef pidref;
if (!pidref_is_set(&s->main_pid) && deserialize_pidref(fds, value, &pidref) >= 0)
(void) service_set_main_pidref(s, pidref, /* start_timestamp = */ NULL);
(void) service_set_main_pidref(s, pidref, /* start_timestamp= */ NULL);
} else if (streq(key, "main-pid-known")) {
r = parse_boolean(value);
@@ -4663,7 +4663,7 @@ static int service_dispatch_timer(sd_event_source *source, usec_t usec, void *us
log_unit_debug(UNIT(s),
"Service has no hold-off time (RestartSec=0), scheduling restart.");
service_enter_restart(s, /* shortcut = */ false);
service_enter_restart(s, /* shortcut= */ false);
break;
case SERVICE_CLEANING:
@@ -4955,7 +4955,7 @@ static void service_notify_message(
log_unit_warning(u, "New main PID "PID_FMT" does not belong to service, refusing.", new_main_pid.pid);
}
if (r > 0) {
(void) service_set_main_pidref(s, TAKE_PIDREF(new_main_pid), /* start_timestamp = */ NULL);
(void) service_set_main_pidref(s, TAKE_PIDREF(new_main_pid), /* start_timestamp= */ NULL);
r = unit_watch_pidref(UNIT(s), &s->main_pid, /* exclusive= */ false);
if (r < 0)
@@ -5152,7 +5152,7 @@ static void service_notify_pidref(Unit *u, PidRef *parent_pidref, PidRef *child_
assert(pidref_is_set(child_pidref));
if (pidref_equal(&s->main_pid, parent_pidref)) {
r = service_set_main_pidref(s, TAKE_PIDREF(*child_pidref), /* start_timestamp = */ NULL);
r = service_set_main_pidref(s, TAKE_PIDREF(*child_pidref), /* start_timestamp= */ NULL);
if (r < 0)
return (void) log_unit_warning_errno(u, r, "Failed to set new main pid: %m");
@@ -5251,7 +5251,7 @@ static int bus_name_pid_lookup_callback(sd_bus_message *reply, void *userdata, s
log_unit_debug(UNIT(s), "D-Bus name %s is now owned by process " PID_FMT, s->bus_name, pidref.pid);
(void) service_set_main_pidref(s, TAKE_PIDREF(pidref), /* start_timestamp = */ NULL);
(void) service_set_main_pidref(s, TAKE_PIDREF(pidref), /* start_timestamp= */ NULL);
(void) unit_watch_pidref(UNIT(s), &s->main_pid, /* exclusive= */ false);
return 1;
}
+1 -1
View File
@@ -45,7 +45,7 @@ static void slice_set_state(Slice *s, SliceState state) {
log_unit_debug(UNIT(s), "Changed %s -> %s",
slice_state_to_string(old_state), slice_state_to_string(state));
unit_notify(UNIT(s), state_translation_table[old_state], state_translation_table[state], /* reload_success = */ true);
unit_notify(UNIT(s), state_translation_table[old_state], state_translation_table[state], /* reload_success= */ true);
}
static int slice_add_parent_slice(Slice *s) {
+11 -11
View File
@@ -1900,7 +1900,7 @@ static void socket_set_state(Socket *s, SocketState state) {
if (state != old_state)
log_unit_debug(UNIT(s), "Changed %s -> %s", socket_state_to_string(old_state), socket_state_to_string(state));
unit_notify(UNIT(s), state_translation_table[old_state], state_translation_table[state], /* reload_success = */ true);
unit_notify(UNIT(s), state_translation_table[old_state], state_translation_table[state], /* reload_success= */ true);
}
static int socket_coldplug(Unit *u) {
@@ -2124,13 +2124,13 @@ static void socket_enter_dead(Socket *s, SocketResult f) {
else
unit_log_failure(UNIT(s), socket_result_to_string(s->result));
unit_warn_leftover_processes(UNIT(s), /* start = */ false);
unit_warn_leftover_processes(UNIT(s), /* start= */ false);
socket_set_state(s, s->result != SOCKET_SUCCESS ? SOCKET_FAILED : SOCKET_DEAD);
s->exec_runtime = exec_runtime_destroy(s->exec_runtime);
unit_destroy_runtime_data(UNIT(s), &s->exec_context, /* destroy_runtime_dir = */ true);
unit_destroy_runtime_data(UNIT(s), &s->exec_context, /* destroy_runtime_dir= */ true);
unit_unref_uid_gid(UNIT(s), true);
}
@@ -2353,7 +2353,7 @@ static void socket_enter_start_pre(Socket *s) {
socket_unwatch_control_pid(s);
unit_warn_leftover_processes(UNIT(s), /* start = */ true);
unit_warn_leftover_processes(UNIT(s), /* start= */ true);
s->control_command_id = SOCKET_EXEC_START_PRE;
s->control_command = s->exec_command[SOCKET_EXEC_START_PRE];
@@ -2398,7 +2398,7 @@ static bool socket_stop_notify(Unit *u) {
assert(s->state == SOCKET_DEFERRED);
r = manager_add_job(u->manager, JOB_START, UNIT_DEREF(s->service), JOB_LENIENT, &error, /* ret = */ NULL);
r = manager_add_job(u->manager, JOB_START, UNIT_DEREF(s->service), JOB_LENIENT, &error, /* ret= */ NULL);
if (r >= 0) { /* Yay! */
socket_set_state(s, SOCKET_RUNNING);
return true; /* changed */
@@ -2429,7 +2429,7 @@ static void socket_enter_deferred(Socket *s) {
* Put a safety net around all this though, i.e. give up if the service still can't be started
* even after all existing jobs have completed, or DeferTriggerMaxSec= is reached. */
r = socket_arm_timer(s, /* relative = */ true, s->defer_trigger_max_usec);
r = socket_arm_timer(s, /* relative= */ true, s->defer_trigger_max_usec);
if (r < 0) {
log_unit_warning_errno(UNIT(s), r, "Failed to install timer: %m");
return socket_enter_stop_pre(s, SOCKET_FAILURE_RESOURCES);
@@ -2492,7 +2492,7 @@ static void socket_enter_running(Socket *s, int cfd_in) {
}
if (s->defer_trigger != SOCKET_DEFER_NO) {
r = manager_add_job(UNIT(s)->manager, JOB_START, UNIT_DEREF(s->service), JOB_LENIENT, &error, /* ret = */ NULL);
r = manager_add_job(UNIT(s)->manager, JOB_START, UNIT_DEREF(s->service), JOB_LENIENT, &error, /* ret= */ NULL);
if (r < 0 && sd_bus_error_has_name(&error, BUS_ERROR_TRANSACTION_IS_DESTRUCTIVE) && socket_may_defer(s))
/* We only check BUS_ERROR_TRANSACTION_IS_DESTRUCTIVE here, not
* BUS_ERROR_TRANSACTION_JOBS_CONFLICTING or BUS_ERROR_TRANSACTION_ORDER_IS_CYCLIC,
@@ -2501,7 +2501,7 @@ static void socket_enter_running(Socket *s, int cfd_in) {
* Deferring activation probably won't help. */
return socket_enter_deferred(s);
} else
r = manager_add_job(UNIT(s)->manager, JOB_START, UNIT_DEREF(s->service), JOB_REPLACE, &error, /* ret = */ NULL);
r = manager_add_job(UNIT(s)->manager, JOB_START, UNIT_DEREF(s->service), JOB_REPLACE, &error, /* ret= */ NULL);
if (r < 0)
goto queue_error;
}
@@ -2568,7 +2568,7 @@ static void socket_enter_running(Socket *s, int cfd_in) {
s->n_connections++;
r = manager_add_job(UNIT(s)->manager, JOB_START, service, JOB_REPLACE, &error, /* ret = */ NULL);
r = manager_add_job(UNIT(s)->manager, JOB_START, service, JOB_REPLACE, &error, /* ret= */ NULL);
if (r < 0) {
/* We failed to activate the new service, but it still exists. Let's make sure the
* service closes and forgets the connection fd again, immediately. */
@@ -2632,7 +2632,7 @@ static int socket_start(Unit *u) {
"Socket service %s not loaded, refusing.", UNIT(service)->id);
/* If the service is already active we cannot start the socket */
if (SOCKET_SERVICE_IS_ACTIVE(service, /* allow_finalize = */ false))
if (SOCKET_SERVICE_IS_ACTIVE(service, /* allow_finalize= */ false))
return log_unit_error_errno(u, SYNTHETIC_ERRNO(EBUSY),
"Socket service %s already active, refusing.", UNIT(service)->id);
}
@@ -3521,7 +3521,7 @@ static void socket_trigger_notify(Unit *u, Unit *other) {
if (other->job)
return;
if (!SOCKET_SERVICE_IS_ACTIVE(service, /* allow_finalize = */ true))
if (!SOCKET_SERVICE_IS_ACTIVE(service, /* allow_finalize= */ true))
socket_enter_listening(s);
if (SERVICE(other)->state == SERVICE_RUNNING)
+5 -5
View File
@@ -351,7 +351,7 @@ static int swap_load(Unit *u) {
assert(u->load_state == UNIT_STUB);
/* Load a .swap file */
r = unit_load_fragment_and_dropin(u, /* fragment_required = */ !s->from_proc_swaps);
r = unit_load_fragment_and_dropin(u, /* fragment_required= */ !s->from_proc_swaps);
/* Add in some extras, and do so either when we successfully loaded something or when /proc/swaps is
* already active. */
@@ -508,7 +508,7 @@ static void swap_set_state(Swap *s, SwapState state) {
if (state != old_state)
log_unit_debug(UNIT(s), "Changed %s -> %s", swap_state_to_string(old_state), swap_state_to_string(state));
unit_notify(UNIT(s), state_translation_table[old_state], state_translation_table[state], /* reload_success = */ true);
unit_notify(UNIT(s), state_translation_table[old_state], state_translation_table[state], /* reload_success= */ true);
/* If there other units for the same device node have a job
queued it might be worth checking again if it is runnable
@@ -672,13 +672,13 @@ static void swap_enter_dead(Swap *s, SwapResult f) {
s->result = f;
unit_log_result(UNIT(s), s->result == SWAP_SUCCESS, swap_result_to_string(s->result));
unit_warn_leftover_processes(UNIT(s), /* start = */ false);
unit_warn_leftover_processes(UNIT(s), /* start= */ false);
swap_set_state(s, s->result != SWAP_SUCCESS ? SWAP_FAILED : SWAP_DEAD);
s->exec_runtime = exec_runtime_destroy(s->exec_runtime);
unit_destroy_runtime_data(UNIT(s), &s->exec_context, /* destroy_runtime_dir = */ true);
unit_destroy_runtime_data(UNIT(s), &s->exec_context, /* destroy_runtime_dir= */ true);
unit_unref_uid_gid(UNIT(s), true);
}
@@ -755,7 +755,7 @@ static void swap_enter_activating(Swap *s) {
assert(s);
unit_warn_leftover_processes(UNIT(s), /* start = */ true);
unit_warn_leftover_processes(UNIT(s), /* start= */ true);
s->control_command_id = SWAP_EXEC_ACTIVATE;
s->control_command = s->exec_command + SWAP_EXEC_ACTIVATE;
+1 -1
View File
@@ -29,7 +29,7 @@ static void target_set_state(Target *t, TargetState state) {
log_unit_debug(UNIT(t), "Changed %s -> %s",
target_state_to_string(old_state), target_state_to_string(state));
unit_notify(UNIT(t), state_translation_table[old_state], state_translation_table[state], /* reload_success = */ true);
unit_notify(UNIT(t), state_translation_table[old_state], state_translation_table[state], /* reload_success= */ true);
}
static int target_add_default_dependencies(Target *t) {
+1 -1
View File
@@ -300,7 +300,7 @@ static void timer_set_state(Timer *t, TimerState state) {
if (state != old_state)
log_unit_debug(UNIT(t), "Changed %s -> %s", timer_state_to_string(old_state), timer_state_to_string(state));
unit_notify(UNIT(t), state_translation_table[old_state], state_translation_table[state], /* reload_success = */ true);
unit_notify(UNIT(t), state_translation_table[old_state], state_translation_table[state], /* reload_success= */ true);
}
static void timer_enter_waiting(Timer *t, bool time_change);
+2 -2
View File
@@ -256,12 +256,12 @@ static int transaction_merge_jobs(Transaction *tr, sd_bus_error *e) {
assert(tr);
/* First step, try to drop unmergeable jobs for jobs that matter to anchor. */
r = transaction_ensure_mergeable(tr, /* matters_to_anchor = */ true, e);
r = transaction_ensure_mergeable(tr, /* matters_to_anchor= */ true, e);
if (r < 0)
return r;
/* Second step, do the same for jobs that not matter to anchor. */
r = transaction_ensure_mergeable(tr, /* matters_to_anchor = */ false, e);
r = transaction_ensure_mergeable(tr, /* matters_to_anchor= */ false, e);
if (r < 0)
return r;
+2 -2
View File
@@ -33,7 +33,7 @@ static int serialize_markers(FILE *f, unsigned markers) {
fputs("markers=", f);
BIT_FOREACH(m, markers)
fputs_with_separator(f, unit_marker_to_string(m), /* separator = */ NULL, &space);
fputs_with_separator(f, unit_marker_to_string(m), /* separator= */ NULL, &space);
fputc('\n', f);
return 0;
}
@@ -373,7 +373,7 @@ int unit_deserialize_state(Unit *u, FILE *f, FDSet *fds) {
* wasn't the case in prior versions with the realized state tracked in a discrete field.
* Patch cgroup_realized == 0 back to no cgroup_path here hence. */
if (crt->deserialized_cgroup_realized == 0)
unit_release_cgroup(u, /* drop_cgroup_runtime = */ false);
unit_release_cgroup(u, /* drop_cgroup_runtime= */ false);
else {
unit_invalidate_cgroup(u, _CGROUP_MASK_ALL);
unit_invalidate_cgroup_bpf_firewall(u);
+27 -27
View File
@@ -813,7 +813,7 @@ Unit* unit_free(Unit *u) {
if (u->on_console)
manager_unref_console(u->manager);
unit_release_cgroup(u, /* drop_cgroup_runtime = */ true);
unit_release_cgroup(u, /* drop_cgroup_runtime= */ true);
if (!MANAGER_IS_RELOADING(u->manager))
unit_unlink_state_files(u);
@@ -1551,8 +1551,8 @@ static int unit_add_mount_dependencies(Unit *u) {
(void) manager_load_unit_prepare(
u->manager,
p,
/* path= */NULL,
/* e= */NULL,
/* path= */ NULL,
/* e= */ NULL,
&m);
continue;
}
@@ -2140,7 +2140,7 @@ int unit_reload(Unit *u) {
if (!UNIT_VTABLE(u)->reload) {
/* Unit doesn't have a reload function, but we need to propagate the reload anyway */
unit_notify(u, unit_active_state(u), unit_active_state(u), /* reload_success = */ true);
unit_notify(u, unit_active_state(u), unit_active_state(u), /* reload_success= */ true);
return 0;
}
@@ -2290,16 +2290,16 @@ static void retroactively_start_dependencies(Unit *u) {
UNIT_FOREACH_DEPENDENCY_SAFE(other, u, UNIT_ATOM_RETROACTIVE_START_REPLACE) /* Requires= + BindsTo= */
if (!unit_has_dependency(u, UNIT_ATOM_AFTER, other) &&
!UNIT_IS_ACTIVE_OR_ACTIVATING(unit_active_state(other)))
(void) manager_add_job(u->manager, JOB_START, other, JOB_REPLACE, /* reterr_error = */ NULL, /* ret = */ NULL);
(void) manager_add_job(u->manager, JOB_START, other, JOB_REPLACE, /* reterr_error= */ NULL, /* ret= */ NULL);
UNIT_FOREACH_DEPENDENCY_SAFE(other, u, UNIT_ATOM_RETROACTIVE_START_FAIL) /* Wants= */
if (!unit_has_dependency(u, UNIT_ATOM_AFTER, other) &&
!UNIT_IS_ACTIVE_OR_ACTIVATING(unit_active_state(other)))
(void) manager_add_job(u->manager, JOB_START, other, JOB_FAIL, /* reterr_error = */ NULL, /* ret = */ NULL);
(void) manager_add_job(u->manager, JOB_START, other, JOB_FAIL, /* reterr_error= */ NULL, /* ret= */ NULL);
UNIT_FOREACH_DEPENDENCY_SAFE(other, u, UNIT_ATOM_RETROACTIVE_STOP_ON_START) /* Conflicts= (and inverse) */
if (!UNIT_IS_INACTIVE_OR_DEACTIVATING(unit_active_state(other)))
(void) manager_add_job(u->manager, JOB_STOP, other, JOB_REPLACE, /* reterr_error = */ NULL, /* ret = */ NULL);
(void) manager_add_job(u->manager, JOB_STOP, other, JOB_REPLACE, /* reterr_error= */ NULL, /* ret= */ NULL);
}
static void retroactively_stop_dependencies(Unit *u) {
@@ -2311,7 +2311,7 @@ static void retroactively_stop_dependencies(Unit *u) {
/* Pull down units which are bound to us recursively if enabled */
UNIT_FOREACH_DEPENDENCY_SAFE(other, u, UNIT_ATOM_RETROACTIVE_STOP_ON_STOP) /* BoundBy= */
if (!UNIT_IS_INACTIVE_OR_DEACTIVATING(unit_active_state(other)))
(void) manager_add_job(u->manager, JOB_STOP, other, JOB_REPLACE, /* reterr_error = */ NULL, /* ret = */ NULL);
(void) manager_add_job(u->manager, JOB_STOP, other, JOB_REPLACE, /* reterr_error= */ NULL, /* ret= */ NULL);
}
void unit_start_on_termination_deps(Unit *u, UnitDependencyAtom atom) {
@@ -2342,7 +2342,7 @@ void unit_start_on_termination_deps(Unit *u, UnitDependencyAtom atom) {
if (n_jobs == 0)
log_unit_info(u, "Triggering %s dependencies.", dependency_name);
r = manager_add_job(u->manager, JOB_START, other, job_mode, &error, /* ret = */ NULL);
r = manager_add_job(u->manager, JOB_START, other, job_mode, &error, /* ret= */ NULL);
if (r < 0)
log_unit_warning_errno(u, r, "Failed to enqueue %s%s job, ignoring: %s",
dependency_name, other->id, bus_error_message(&error, r));
@@ -2624,12 +2624,12 @@ static bool unit_process_job(Job *j, UnitActiveState ns, bool reload_success) {
case JOB_VERIFY_ACTIVE:
if (UNIT_IS_ACTIVE_OR_RELOADING(ns))
job_finish_and_invalidate(j, JOB_DONE, /* recursive = */ true, /* already = */ false);
job_finish_and_invalidate(j, JOB_DONE, /* recursive= */ true, /* already= */ false);
else if (j->state == JOB_RUNNING && ns != UNIT_ACTIVATING) {
unexpected = true;
if (UNIT_IS_INACTIVE_OR_FAILED(ns))
job_finish_and_invalidate(j, ns == UNIT_FAILED ? JOB_FAILED : JOB_DONE, /* recursive = */ true, /* already = */ false);
job_finish_and_invalidate(j, ns == UNIT_FAILED ? JOB_FAILED : JOB_DONE, /* recursive= */ true, /* already= */ false);
}
break;
@@ -2638,10 +2638,10 @@ static bool unit_process_job(Job *j, UnitActiveState ns, bool reload_success) {
if (j->state == JOB_RUNNING) {
if (ns == UNIT_ACTIVE)
job_finish_and_invalidate(j, reload_success ? JOB_DONE : JOB_FAILED, /* recursive = */ true, /* already = */ false);
job_finish_and_invalidate(j, reload_success ? JOB_DONE : JOB_FAILED, /* recursive= */ true, /* already= */ false);
else if (!IN_SET(ns, UNIT_ACTIVATING, UNIT_RELOADING, UNIT_REFRESHING)) {
unexpected = true;
job_finish_and_invalidate(j, reload_success ? JOB_CANCELED : JOB_FAILED, /* recursive = */ true, /* already = */ false);
job_finish_and_invalidate(j, reload_success ? JOB_CANCELED : JOB_FAILED, /* recursive= */ true, /* already= */ false);
}
}
@@ -2651,10 +2651,10 @@ static bool unit_process_job(Job *j, UnitActiveState ns, bool reload_success) {
case JOB_RESTART:
if (UNIT_IS_INACTIVE_OR_FAILED(ns))
job_finish_and_invalidate(j, JOB_DONE, /* recursive = */ true, /* already = */ false);
job_finish_and_invalidate(j, JOB_DONE, /* recursive= */ true, /* already= */ false);
else if (j->state == JOB_RUNNING && ns != UNIT_DEACTIVATING) {
unexpected = true;
job_finish_and_invalidate(j, JOB_FAILED, /* recursive = */ true, /* already = */ false);
job_finish_and_invalidate(j, JOB_FAILED, /* recursive= */ true, /* already= */ false);
}
break;
@@ -3346,7 +3346,7 @@ int setenv_unit_path(const char *p) {
assert(p);
/* This is mostly for debug purposes */
return RET_NERRNO(setenv("SYSTEMD_UNIT_PATH", p, /* overwrite = */ true));
return RET_NERRNO(setenv("SYSTEMD_UNIT_PATH", p, /* overwrite= */ true));
}
char* unit_dbus_path(Unit *u) {
@@ -3641,7 +3641,7 @@ int unit_install_bus_match(Unit *u, sd_bus *bus, const char *name) {
r = bus_add_match_full(
bus,
&u->match_bus_slot,
/* asynchronous = */ true,
/* asynchronous= */ true,
match,
signal_name_owner_changed,
signal_name_owner_changed_install_handler,
@@ -3801,7 +3801,7 @@ int unit_coldplug(Unit *u) {
if (u->nop_job)
RET_GATHER(r, job_coldplug(u->nop_job));
unit_modify_nft_set(u, /* add = */ true);
unit_modify_nft_set(u, /* add= */ true);
return r;
}
@@ -3858,7 +3858,7 @@ bool unit_need_daemon_reload(Unit *u) {
if (u->load_state == UNIT_LOADED) {
_cleanup_strv_free_ char **dropins = NULL;
(void) unit_find_dropin_paths(u, /* use_unit_path_cache = */ false, &dropins);
(void) unit_find_dropin_paths(u, /* use_unit_path_cache= */ false, &dropins);
if (!strv_equal(u->dropin_paths, dropins))
return true;
@@ -4313,7 +4313,7 @@ static int unit_verify_contexts(const Unit *u) {
return log_unit_error_errno(u, SYNTHETIC_ERRNO(ENOEXEC), "WorkingDirectory=~ is not allowed under DynamicUser=yes. Refusing.");
if (ec->working_directory && path_below_api_vfs(ec->working_directory) &&
exec_needs_mount_namespace(ec, /* params = */ NULL, /* runtime = */ NULL))
exec_needs_mount_namespace(ec, /* params= */ NULL, /* runtime= */ NULL))
return log_unit_error_errno(u, SYNTHETIC_ERRNO(ENOEXEC), "WorkingDirectory= may not be below /proc/, /sys/ or /dev/ when using mount namespacing. Refusing.");
if (exec_needs_pid_namespace(ec, /* params= */ NULL) && !UNIT_VTABLE(u)->notify_pidref)
@@ -4955,7 +4955,7 @@ int unit_kill_context(Unit *u, KillOperation k) {
r = unit_kill_context_one(u, main_pid, "main", is_alien, sig, send_sighup, log_func);
wait_for_exit = wait_for_exit || r > 0;
r = unit_kill_context_one(u, unit_control_pid(u), "control", /* is_alien = */ false, sig, send_sighup, log_func);
r = unit_kill_context_one(u, unit_control_pid(u), "control", /* is_alien= */ false, sig, send_sighup, log_func);
wait_for_exit = wait_for_exit || r > 0;
CGroupRuntime *crt = unit_get_cgroup_runtime(u);
@@ -5340,7 +5340,7 @@ static void unit_unref_uid_internal(
static void unit_unref_uid(Unit *u, bool destroy_now) {
assert(u);
unit_modify_user_nft_set(u, /* add = */ false, NFT_SET_SOURCE_USER, u->ref_uid);
unit_modify_user_nft_set(u, /* add= */ false, NFT_SET_SOURCE_USER, u->ref_uid);
unit_unref_uid_internal(u, &u->ref_uid, destroy_now, manager_unref_uid);
}
@@ -5348,7 +5348,7 @@ static void unit_unref_uid(Unit *u, bool destroy_now) {
static void unit_unref_gid(Unit *u, bool destroy_now) {
assert(u);
unit_modify_user_nft_set(u, /* add = */ false, NFT_SET_SOURCE_GROUP, u->ref_gid);
unit_modify_user_nft_set(u, /* add= */ false, NFT_SET_SOURCE_GROUP, u->ref_gid);
unit_unref_uid_internal(u, (uid_t*) &u->ref_gid, destroy_now, manager_unref_gid);
}
@@ -5444,8 +5444,8 @@ int unit_ref_uid_gid(Unit *u, uid_t uid, gid_t gid) {
if (r < 0)
return log_unit_warning_errno(u, r, "Couldn't add UID/GID reference to unit, proceeding without: %m");
unit_modify_user_nft_set(u, /* add = */ true, NFT_SET_SOURCE_USER, uid);
unit_modify_user_nft_set(u, /* add = */ true, NFT_SET_SOURCE_GROUP, gid);
unit_modify_user_nft_set(u, /* add= */ true, NFT_SET_SOURCE_USER, uid);
unit_modify_user_nft_set(u, /* add= */ true, NFT_SET_SOURCE_GROUP, gid);
return r;
}
@@ -6479,7 +6479,7 @@ void unit_freezer_complete(Unit *u, FreezerState kernel_state) {
freezer_state_to_string(u->freezer_state));
/* If the cgroup's final state is against what's requested by us, report as canceled. */
bus_unit_send_pending_freezer_message(u, /* canceled = */ !expected);
bus_unit_send_pending_freezer_message(u, /* canceled= */ !expected);
}
int unit_freezer_action(Unit *u, FreezerAction action) {
@@ -6786,7 +6786,7 @@ int unit_get_exec_quota_stats(Unit *u, ExecContext *c, ExecDirectoryType dt, uin
return log_unit_debug_errno(u, errno, "Failed to get exec quota stats: %m");
uint32_t proj_id;
r = read_fs_xattr_fd(fd, /* ret_xflags = */ NULL, &proj_id);
r = read_fs_xattr_fd(fd, /* ret_xflags= */ NULL, &proj_id);
if (r < 0)
return log_unit_debug_errno(u, r, "Failed to get project ID for exec quota stats: %m");
+2 -2
View File
@@ -848,7 +848,7 @@ int unit_exec_context_build_json(sd_json_variant **ret, const char *name, void *
JSON_BUILD_PAIR_STRING_NON_EMPTY("Personality", personality_to_string(c->personality)),
SD_JSON_BUILD_PAIR_BOOLEAN("IgnoreSIGPIPE", c->ignore_sigpipe),
/* Scheduling */
/* Scheduling */
SD_JSON_BUILD_PAIR_INTEGER("Nice", exec_context_get_nice(c)),
SD_JSON_BUILD_PAIR_CALLBACK("CPUSchedulingPolicy", cpu_sched_class_build_json, c),
SD_JSON_BUILD_PAIR_INTEGER("CPUSchedulingPriority", exec_context_get_cpu_sched_priority(c)),
@@ -915,7 +915,7 @@ int unit_exec_context_build_json(sd_json_variant **ret, const char *name, void *
JSON_BUILD_PAIR_CALLBACK_NON_NULL("SystemCallArchitectures", syscall_archs_build_json, c),
JSON_BUILD_PAIR_CALLBACK_NON_NULL("SystemCallLog", syscall_log_build_json, c),
/* Environment */
/* Environment */
JSON_BUILD_PAIR_STRV_NON_EMPTY("Environment", c->environment),
JSON_BUILD_PAIR_CALLBACK_NON_NULL("EnvironmentFiles", environment_files_build_json, c->environment_files),
JSON_BUILD_PAIR_STRV_NON_EMPTY("PassEnvironment", c->pass_environment),
+3 -3
View File
@@ -487,7 +487,7 @@ int vl_method_list_units(sd_varlink *link, sd_json_variant *parameters, sd_varli
if (r < 0)
return r;
if (unit)
return list_unit_one_with_selinux_access_check(link, unit, /* more = */ false);
return list_unit_one_with_selinux_access_check(link, unit, /* more= */ false);
if (!FLAGS_SET(flags, SD_VARLINK_METHOD_MORE))
return sd_varlink_error(link, SD_VARLINK_ERROR_EXPECTED_MORE, NULL);
@@ -498,7 +498,7 @@ int vl_method_list_units(sd_varlink *link, sd_json_variant *parameters, sd_varli
continue;
if (previous) {
r = list_unit_one(link, previous, /* more = */ true);
r = list_unit_one(link, previous, /* more= */ true);
if (r < 0)
return r;
}
@@ -507,7 +507,7 @@ int vl_method_list_units(sd_varlink *link, sd_json_variant *parameters, sd_varli
}
if (previous)
return list_unit_one(link, previous, /* more = */ false);
return list_unit_one(link, previous, /* more= */ false);
return sd_varlink_error(link, "io.systemd.Manager.NoSuchUnit", NULL);
}
+3 -3
View File
@@ -147,7 +147,7 @@ static int manager_varlink_send_managed_oom_initial(Manager *m) {
assert(m->managed_oom_varlink);
r = build_managed_oom_cgroups_json(m, /* allow_empty = */ false, &v);
r = build_managed_oom_cgroups_json(m, /* allow_empty= */ false, &v);
if (r <= 0)
return r;
@@ -323,7 +323,7 @@ static int vl_method_subscribe_managed_oom_cgroups(
if (!streq(u->id, "systemd-oomd.service"))
return sd_varlink_error(link, SD_VARLINK_ERROR_PERMISSION_DENIED, NULL);
r = sd_varlink_dispatch(link, parameters, /* dispatch_table = */ NULL, /* userdata = */ NULL);
r = sd_varlink_dispatch(link, parameters, /* dispatch_table= */ NULL, /* userdata= */ NULL);
if (r != 0)
return r;
@@ -334,7 +334,7 @@ static int vl_method_subscribe_managed_oom_cgroups(
_cleanup_(sd_json_variant_unrefp) sd_json_variant *v = NULL;
r = build_managed_oom_cgroups_json(m, /* allow_empty = */ true, &v);
r = build_managed_oom_cgroups_json(m, /* allow_empty= */ true, &v);
if (r < 0)
return r;