1
0
mirror of https://github.com/systemd/systemd synced 2026-03-25 16:25:04 +01:00

Compare commits

..

No commits in common. "2960889a2c0086ffff5f00c527c98a1d077fa1f4" and "b96dccaba3249f5d7b9ad3acab79da74d32949c2" have entirely different histories.

434 changed files with 1913 additions and 2004 deletions

View File

@ -628,10 +628,6 @@ sensor:modalias:platform:lis3lv02d:dmi:*svn*Hewlett-Packard*:*
sensor:modalias:platform:lis3lv02d:dmi:*svn*HP*:* sensor:modalias:platform:lis3lv02d:dmi:*svn*HP*:*
ACCEL_LOCATION=base ACCEL_LOCATION=base
# HP OmniBook Ultra Flip Laptop 14-fh0xxx
sensor:modalias:platform:HID-SENSOR-200073:dmi:*:svnHP:pnHPOmniBookUltraFlipLaptop14-fh0xxx:*
ACCEL_MOUNT_MATRIX=1, 0, 0; 0, 1, 0; 0, 0, -1
sensor:modalias:acpi:SMO8500*:dmi:*:svnHewlett-Packard:pnHPStream7Tablet:* sensor:modalias:acpi:SMO8500*:dmi:*:svnHewlett-Packard:pnHPStream7Tablet:*
sensor:modalias:acpi:SMO8500*:dmi:*:svnHewlett-Packard:pnHPStream8Tablet:* sensor:modalias:acpi:SMO8500*:dmi:*:svnHewlett-Packard:pnHPStream8Tablet:*
ACCEL_MOUNT_MATRIX=0, 1, 0; 1, 0, 0; 0, 0, 1 ACCEL_MOUNT_MATRIX=0, 1, 0; 1, 0, 0; 0, 0, 1
@ -768,7 +764,7 @@ sensor:modalias:acpi:SMO8500*:dmi:bvnLENOVO:*:pvrMIIX300-*:*
# a portrait LCD panel, versions with bvr 1HCN3?WW have a landscape panel # a portrait LCD panel, versions with bvr 1HCN3?WW have a landscape panel
sensor:modalias:acpi:KIOX000A*:dmi:bvnLENOVO:bvr1HCN4?WW:*:svnLENOVO:pn80SG:* sensor:modalias:acpi:KIOX000A*:dmi:bvnLENOVO:bvr1HCN4?WW:*:svnLENOVO:pn80SG:*
sensor:modalias:acpi:KIOX000A*:dmi:bvnLENOVO:bvr1HCN2?WW:*:svnLENOVO:pn80SG:* sensor:modalias:acpi:KIOX000A*:dmi:bvnLENOVO:bvr1HCN2?WW:*:svnLENOVO:pn80SG:*
ACCEL_MOUNT_MATRIX=0, 1, 0; 1, 0, 0; 0, 0, -1 ACCEL_MOUNT_MATRIX=0, 1, 0; 1, 0, 0; 0, 0, 1
# IdeaPad Miix 310 BIOS version bvr1HCN3?WW (variant 3) # IdeaPad Miix 310 BIOS version bvr1HCN3?WW (variant 3)
sensor:modalias:acpi:KIOX000A*:dmi:bvnLENOVO:bvr1HCN3?WW:*:svnLENOVO:pn80SG:* sensor:modalias:acpi:KIOX000A*:dmi:bvnLENOVO:bvr1HCN3?WW:*:svnLENOVO:pn80SG:*
@ -803,6 +799,11 @@ sensor:modalias:i2c:bmc150_accel:dmi:*:svnLENOVO:*:pvrLenovoYoga300-11IBR:*
sensor:modalias:acpi:ACCL0001*:dmi:*:svnLENOVO:pn60072:pvr851*:* sensor:modalias:acpi:ACCL0001*:dmi:*:svnLENOVO:pn60072:pvr851*:*
ACCEL_MOUNT_MATRIX=0, 1, 0; -1, 0, 0; 0, 0, 1 ACCEL_MOUNT_MATRIX=0, 1, 0; -1, 0, 0; 0, 0, 1
# IdeaPad Duet 3 10IGL5 (82AT) and 10IGL5-LTE (82HK)
sensor:modalias:acpi:SMO8B30*:dmi:*:svnLENOVO*:pn82AT:*
sensor:modalias:acpi:SMO8B30*:dmi:*:svnLENOVO*:pn82HK:*
ACCEL_MOUNT_MATRIX=0, 1, 0; -1, 0, 0; 0, 0, 1
######################################### #########################################
# LINX # LINX
######################################### #########################################

View File

@ -54,8 +54,8 @@
<refsect1> <refsect1>
<title>Options</title> <title>Options</title>
<para>The following options are understood in both the <literal>[SysExt]</literal> and <para>The following options are understood in both the <literal>[Sysext]</literal> and
<literal>[ConfExt]</literal> sections:</para> <literal>[Confext]</literal> sections:</para>
<refsect2> <refsect2>
<title>Section Options</title> <title>Section Options</title>

View File

@ -20,7 +20,7 @@ int verb_blame(int argc, char *argv[], void *userdata) {
if (r < 0) if (r < 0)
return bus_log_connect_error(r, arg_transport, arg_runtime_scope); return bus_log_connect_error(r, arg_transport, arg_runtime_scope);
n = acquire_time_data(bus, /* require_finished= */ false, &times); n = acquire_time_data(bus, /* require_finished = */ false, &times);
if (n <= 0) if (n <= 0)
return n; return n;

View File

@ -17,7 +17,7 @@ static int parse_condition(Unit *u, const char *line) {
assert(u); assert(u);
assert(line); assert(line);
line = skip_leading_chars(line, /* bad= */ NULL); line = skip_leading_chars(line, /* bad = */ NULL);
const char *eq = strchr(line, '='); const char *eq = strchr(line, '=');
if (!eq) if (!eq)
@ -27,7 +27,7 @@ static int parse_condition(Unit *u, const char *line) {
if (!type_string) if (!type_string)
return log_oom(); return log_oom();
delete_trailing_chars(type_string, /* bad= */ NULL); delete_trailing_chars(type_string, /* bad = */ NULL);
Condition **target; Condition **target;
ConditionType type; ConditionType type;
@ -41,7 +41,7 @@ static int parse_condition(Unit *u, const char *line) {
if (type < 0) if (type < 0)
return log_error_errno(type, "Cannot parse \"%s\".", line); return log_error_errno(type, "Cannot parse \"%s\".", line);
const char *val = skip_leading_chars(eq + 1, /* bad= */ NULL); const char *val = skip_leading_chars(eq + 1, /* bad = */ NULL);
ConfigParserCallback callback; ConfigParserCallback callback;
if (condition_takes_path(type)) if (condition_takes_path(type))
@ -49,16 +49,16 @@ static int parse_condition(Unit *u, const char *line) {
else else
callback = config_parse_unit_condition_string; callback = config_parse_unit_condition_string;
return callback(/* unit= */ NULL, return callback(/* unit = */ NULL,
/* filename= */ "(cmdline)", /* filename = */ "(cmdline)",
/* line= */ 0, /* line = */ 0,
/* section= */ NULL, /* section = */ NULL,
/* section_line= */ 0, /* section_line = */ 0,
/* lvalue= */ type_string, /* lvalue = */ type_string,
/* ltype= */ type, /* ltype = */ type,
/* rvalue= */ val, /* rvalue = */ val,
/* data= */ target, /* data = */ target,
/* userdata= */ u); /* userdata = */ u);
} }
_printf_(7, 8) _printf_(7, 8)
@ -72,10 +72,10 @@ static int log_helper(void *userdata, int level, int error, const char *file, in
va_start(ap, format); va_start(ap, format);
r = log_object_internalv(level, error, file, line, func, r = log_object_internalv(level, error, file, line, func,
/* object_field= */ unit_log_field(u), /* object_field = */ unit_log_field(u),
/* object= */ u->id, /* object = */ u->id,
/* extra_field= */ NULL, /* extra_field = */ NULL,
/* extra= */ NULL, /* extra = */ NULL,
format, ap); format, ap);
va_end(ap); va_end(ap);

View File

@ -98,7 +98,7 @@ static int list_dependencies_one(sd_bus *bus, const char *name, unsigned level,
typesafe_qsort(deps, strv_length(deps), list_dependencies_compare); typesafe_qsort(deps, strv_length(deps), list_dependencies_compare);
r = acquire_boot_times(bus, /* require_finished= */ true, &boot); r = acquire_boot_times(bus, /* require_finished = */ true, &boot);
if (r < 0) if (r < 0)
return r; return r;
@ -183,7 +183,7 @@ static int list_dependencies(sd_bus *bus, const char *name) {
times = hashmap_get(unit_times_hashmap, id); times = hashmap_get(unit_times_hashmap, id);
r = acquire_boot_times(bus, /* require_finished= */ true, &boot); r = acquire_boot_times(bus, /* require_finished = */ true, &boot);
if (r < 0) if (r < 0)
return r; return r;
@ -210,7 +210,7 @@ int verb_critical_chain(int argc, char *argv[], void *userdata) {
if (r < 0) if (r < 0)
return bus_log_connect_error(r, arg_transport, arg_runtime_scope); return bus_log_connect_error(r, arg_transport, arg_runtime_scope);
n = acquire_time_data(bus, /* require_finished= */ true, &times); n = acquire_time_data(bus, /* require_finished = */ true, &times);
if (n <= 0) if (n <= 0)
return n; return n;

View File

@ -93,7 +93,7 @@ static int dump_fdstore(sd_bus *bus, const char *arg) {
if (table_isempty(table) && !sd_json_format_enabled(arg_json_format_flags)) if (table_isempty(table) && !sd_json_format_enabled(arg_json_format_flags))
log_info("No file descriptors in fdstore of '%s'.", unit); log_info("No file descriptors in fdstore of '%s'.", unit);
else { else {
r = table_print_with_pager(table, arg_json_format_flags, arg_pager_flags, /* show_header= */ true); r = table_print_with_pager(table, arg_json_format_flags, arg_pager_flags, /* show_header= */true);
if (r < 0) if (r < 0)
return r; return r;
} }

View File

@ -53,7 +53,7 @@ static int get_current_pcr(const char *alg, uint32_t pcr, void **ret, size_t *re
if (r < 0) if (r < 0)
return log_error_errno(r, "Failed to read '%s': %m", p); return log_error_errno(r, "Failed to read '%s': %m", p);
r = unhexmem_full(s, ss, /* secure= */ false, &buf, &bufsize); r = unhexmem_full(s, ss, /* secure = */ false, &buf, &bufsize);
if (r < 0) if (r < 0)
return log_error_errno(r, "Failed to decode hex PCR data '%s': %m", s); return log_error_errno(r, "Failed to decode hex PCR data '%s': %m", s);
@ -141,7 +141,7 @@ int verb_pcrs(int argc, char *argv[], void *userdata) {
return r; return r;
} }
r = table_print_with_pager(table, arg_json_format_flags, arg_pager_flags, /* show_header= */ true); r = table_print_with_pager(table, arg_json_format_flags, arg_pager_flags, /* show_header= */true);
if (r < 0) if (r < 0)
return r; return r;

View File

@ -483,7 +483,7 @@ int verb_plot(int argc, char *argv[], void *userdata) {
if (r < 0) if (r < 0)
return bus_log_connect_error(r, arg_transport, arg_runtime_scope); return bus_log_connect_error(r, arg_transport, arg_runtime_scope);
n = acquire_boot_times(bus, /* require_finished= */ true, &boot); n = acquire_boot_times(bus, /* require_finished = */ true, &boot);
if (n < 0) if (n < 0)
return n; return n;
@ -497,7 +497,7 @@ int verb_plot(int argc, char *argv[], void *userdata) {
return n; return n;
} }
n = acquire_time_data(bus, /* require_finished= */ true, &times); n = acquire_time_data(bus, /* require_finished = */ true, &times);
if (n <= 0) if (n <= 0)
return n; return n;

View File

@ -1884,7 +1884,7 @@ static int assess(const SecurityInfo *info,
return log_error_errno(r, "Failed to set columns to display: %m"); return log_error_errno(r, "Failed to set columns to display: %m");
} }
r = table_print_with_pager(details_table, json_format_flags, pager_flags, /* show_header= */ true); r = table_print_with_pager(details_table, json_format_flags, pager_flags, /* show_header= */true);
if (r < 0) if (r < 0)
return r; return r;
} }
@ -2897,7 +2897,7 @@ static int analyze_security(sd_bus *bus,
fflush(stdout); fflush(stdout);
} }
r = table_print_with_pager(overview_table, json_format_flags, pager_flags, /* show_header= */ true); r = table_print_with_pager(overview_table, json_format_flags, pager_flags, /* show_header= */true);
if (r < 0) if (r < 0)
return r; return r;
} }
@ -2919,19 +2919,19 @@ int verb_security(int argc, char *argv[], void *userdata) {
unsigned line = 0, column = 0; unsigned line = 0, column = 0;
if (arg_security_policy) { if (arg_security_policy) {
r = sd_json_parse_file(/* f= */ NULL, arg_security_policy, /* flags= */ 0, &policy, &line, &column); r = sd_json_parse_file(/*f=*/ NULL, arg_security_policy, /*flags=*/ 0, &policy, &line, &column);
if (r < 0) if (r < 0)
return log_error_errno(r, "Failed to parse '%s' at %u:%u: %m", arg_security_policy, line, column); return log_error_errno(r, "Failed to parse '%s' at %u:%u: %m", arg_security_policy, line, column);
} else { } else {
_cleanup_fclose_ FILE *f = NULL; _cleanup_fclose_ FILE *f = NULL;
_cleanup_free_ char *pp = NULL; _cleanup_free_ char *pp = NULL;
r = search_and_fopen_nulstr("systemd-analyze-security.policy", "re", /* root= */ NULL, CONF_PATHS_NULSTR("systemd"), &f, &pp); r = search_and_fopen_nulstr("systemd-analyze-security.policy", "re", /*root=*/ NULL, CONF_PATHS_NULSTR("systemd"), &f, &pp);
if (r < 0 && r != -ENOENT) if (r < 0 && r != -ENOENT)
return r; return r;
if (f) { if (f) {
r = sd_json_parse_file(f, pp, /* flags= */ 0, &policy, &line, &column); r = sd_json_parse_file(f, pp, /*flags=*/ 0, &policy, &line, &column);
if (r < 0) if (r < 0)
return log_error_errno(r, "[%s:%u:%u] Failed to parse JSON policy: %m", pp, line, column); return log_error_errno(r, "[%s:%u:%u] Failed to parse JSON policy: %m", pp, line, column);
} }
@ -2950,5 +2950,5 @@ int verb_security(int argc, char *argv[], void *userdata) {
arg_profile, arg_profile,
arg_json_format_flags, arg_json_format_flags,
arg_pager_flags, arg_pager_flags,
/* flags= */ 0); /*flags=*/ 0);
} }

View File

@ -172,7 +172,7 @@ int pretty_boot_time(sd_bus *bus, char **ret) {
BootTimes *t; BootTimes *t;
int r; int r;
r = acquire_boot_times(bus, /* require_finished= */ true, &t); r = acquire_boot_times(bus, /* require_finished = */ true, &t);
if (r < 0) if (r < 0)
return r; return r;

View File

@ -105,7 +105,7 @@ int verb_unit_gdb(int argc, char *argv[], void *userdata) {
} else } else
assert_not_reached(); assert_not_reached();
r = strv_extend_strv(&debugger_call, arg_debugger_args, /* filter_duplicates= */ false); r = strv_extend_strv(&debugger_call, arg_debugger_args, /* filter_duplicates = */ false);
if (r < 0) if (r < 0)
return log_oom(); return log_oom();

View File

@ -256,7 +256,7 @@ static int verify_unit(Unit *u, bool check_man, const char *root) {
unit_dump(u, stdout, "\t"); unit_dump(u, stdout, "\t");
log_unit_debug(u, "Creating %s/start job", u->id); log_unit_debug(u, "Creating %s/start job", u->id);
r = manager_add_job(u->manager, JOB_START, u, JOB_REPLACE, &error, /* ret= */ NULL); r = manager_add_job(u->manager, JOB_START, u, JOB_REPLACE, &error, /* ret = */ NULL);
if (r < 0) if (r < 0)
log_unit_error_errno(u, r, "Failed to create %s/start: %s", u->id, bus_error_message(&error, r)); log_unit_error_errno(u, r, "Failed to create %s/start: %s", u->id, bus_error_message(&error, r));

View File

@ -58,12 +58,12 @@ static int has_multiple_graphics_cards(void) {
if (r < 0) if (r < 0)
return r; return r;
r = sd_device_enumerator_add_match_subsystem(e, "pci", /* match= */ true); r = sd_device_enumerator_add_match_subsystem(e, "pci", /* match = */ true);
if (r < 0) if (r < 0)
return r; return r;
/* class is an unsigned number, let's validate the value later. */ /* class is an unsigned number, let's validate the value later. */
r = sd_device_enumerator_add_match_sysattr(e, "class", NULL, /* match= */ true); r = sd_device_enumerator_add_match_sysattr(e, "class", NULL, /* match = */ true);
if (r < 0) if (r < 0)
return r; return r;
@ -233,7 +233,7 @@ static int validate_device(sd_device *device) {
if (r < 0) if (r < 0)
return log_debug_errno(r, "Failed to allow uninitialized devices: %m"); return log_debug_errno(r, "Failed to allow uninitialized devices: %m");
r = sd_device_enumerator_add_match_subsystem(enumerate, "backlight", /* match= */ true); r = sd_device_enumerator_add_match_subsystem(enumerate, "backlight", /* match = */ true);
if (r < 0) if (r < 0)
return log_debug_errno(r, "Failed to add subsystem match: %m"); return log_debug_errno(r, "Failed to add subsystem match: %m");
@ -241,11 +241,11 @@ static int validate_device(sd_device *device) {
if (r < 0) if (r < 0)
return log_debug_errno(r, "Failed to add sysname unmatch: %m"); return log_debug_errno(r, "Failed to add sysname unmatch: %m");
r = sd_device_enumerator_add_match_sysattr(enumerate, "type", "platform", /* match= */ true); r = sd_device_enumerator_add_match_sysattr(enumerate, "type", "platform", /* match = */ true);
if (r < 0) if (r < 0)
return log_debug_errno(r, "Failed to add sysattr match: %m"); return log_debug_errno(r, "Failed to add sysattr match: %m");
r = sd_device_enumerator_add_match_sysattr(enumerate, "type", "firmware", /* match= */ true); r = sd_device_enumerator_add_match_sysattr(enumerate, "type", "firmware", /* match = */ true);
if (r < 0) if (r < 0)
return log_debug_errno(r, "Failed to add sysattr match: %m"); return log_debug_errno(r, "Failed to add sysattr match: %m");
@ -591,9 +591,9 @@ static int verb_load(int argc, char *argv[], void *userdata) {
if (r < 0) if (r < 0)
return log_device_error_errno(device, r, "Failed to read current brightness: %m"); return log_device_error_errno(device, r, "Failed to read current brightness: %m");
(void) clamp_brightness(device, percent, /* saved= */ false, max_brightness, &brightness); (void) clamp_brightness(device, percent, /* saved = */ false, max_brightness, &brightness);
} else if (clamp) } else if (clamp)
(void) clamp_brightness(device, percent, /* saved= */ true, max_brightness, &brightness); (void) clamp_brightness(device, percent, /* saved = */ true, max_brightness, &brightness);
r = sd_device_set_sysattr_valuef(device, "brightness", "%u", brightness); r = sd_device_set_sysattr_valuef(device, "brightness", "%u", brightness);
if (r < 0) if (r < 0)

View File

@ -264,7 +264,7 @@ int pin_callout_binary(const char *path, char **ret_path) {
const char *e; const char *e;
if (find_environment_binary(fn, &e) >= 0) { if (find_environment_binary(fn, &e) >= 0) {
/* The environment variable counts. We'd fail if the executable is not available/invalid. */ /* The environment variable counts. We'd fail if the executable is not available/invalid. */
r = open_and_check_executable(e, /* root= */ NULL, ret_path, &fd); r = open_and_check_executable(e, /* root = */ NULL, ret_path, &fd);
if (r < 0) if (r < 0)
return r; return r;
@ -273,13 +273,13 @@ int pin_callout_binary(const char *path, char **ret_path) {
_cleanup_free_ char *np = NULL; _cleanup_free_ char *np = NULL;
if (find_build_dir_binary(fn, &np) >= 0) { if (find_build_dir_binary(fn, &np) >= 0) {
r = open_and_check_executable(np, /* root= */ NULL, ret_path, &fd); r = open_and_check_executable(np, /* root = */ NULL, ret_path, &fd);
if (r >= 0) if (r >= 0)
return fd; return fd;
} }
r = find_executable_full(path, /* root= */ NULL, r = find_executable_full(path, /* root = */ NULL,
/* exec_search_path= */ NULL, /* use_path_envvar= */ true, /* exec_search_path = */ NULL, /* use_path_envvar = */ true,
ret_path, &fd); ret_path, &fd);
if (r < 0) if (r < 0)
return r; return r;

View File

@ -241,7 +241,7 @@ int cg_enumerate_subgroups(const char *path, DIR **ret) {
/* This is not recursive! */ /* This is not recursive! */
r = cg_get_path(path, /* suffix= */ NULL, &fs); r = cg_get_path(path, /* suffix = */ NULL, &fs);
if (r < 0) if (r < 0)
return r; return r;
@ -479,7 +479,7 @@ int cg_set_xattr(const char *path, const char *name, const void *value, size_t s
assert(name); assert(name);
assert(value || size <= 0); assert(value || size <= 0);
r = cg_get_path(path, /* suffix= */ NULL, &fs); r = cg_get_path(path, /* suffix = */ NULL, &fs);
if (r < 0) if (r < 0)
return r; return r;
@ -493,7 +493,7 @@ int cg_get_xattr(const char *path, const char *name, char **ret, size_t *ret_siz
assert(path); assert(path);
assert(name); assert(name);
r = cg_get_path(path, /* suffix= */ NULL, &fs); r = cg_get_path(path, /* suffix = */ NULL, &fs);
if (r < 0) if (r < 0)
return r; return r;
@ -507,7 +507,7 @@ int cg_get_xattr_bool(const char *path, const char *name) {
assert(path); assert(path);
assert(name); assert(name);
r = cg_get_path(path, /* suffix= */ NULL, &fs); r = cg_get_path(path, /* suffix = */ NULL, &fs);
if (r < 0) if (r < 0)
return r; return r;
@ -521,7 +521,7 @@ int cg_remove_xattr(const char *path, const char *name) {
assert(path); assert(path);
assert(name); assert(name);
r = cg_get_path(path, /* suffix= */ NULL, &fs); r = cg_get_path(path, /* suffix = */ NULL, &fs);
if (r < 0) if (r < 0)
return r; return r;
@ -1193,7 +1193,7 @@ int cg_path_get_slice(const char *p, char **ret_slice) {
const char *s; const char *s;
int n; int n;
n = path_find_first_component(&p, /* accept_dot_dot= */ false, &s); n = path_find_first_component(&p, /* accept_dot_dot = */ false, &s);
if (n < 0) if (n < 0)
return n; return n;
if (!valid_slice_name(s, n)) if (!valid_slice_name(s, n))
@ -1487,7 +1487,7 @@ int cg_get_owner(const char *path, uid_t *ret_uid) {
assert(ret_uid); assert(ret_uid);
r = cg_get_path(path, /* suffix= */ NULL, &f); r = cg_get_path(path, /* suffix = */ NULL, &f);
if (r < 0) if (r < 0)
return r; return r;
@ -1525,7 +1525,7 @@ int cg_get_keyed_attribute(
if (r < 0) if (r < 0)
return r; return r;
r = read_full_file(filename, &contents, /* ret_size= */ NULL); r = read_full_file(filename, &contents, /* ret_size = */ NULL);
if (r < 0) if (r < 0)
return r; return r;

View File

@ -403,7 +403,7 @@ int chaseat(int dir_fd, const char *path, ChaseFlags flags, char **ret_path, int
} }
/* Otherwise let's pin it by file descriptor, via O_PATH. */ /* Otherwise let's pin it by file descriptor, via O_PATH. */
child = r = openat_opath_with_automount(fd, first, /* automount= */ FLAGS_SET(flags, CHASE_TRIGGER_AUTOFS)); child = r = openat_opath_with_automount(fd, first, /* automount = */ FLAGS_SET(flags, CHASE_TRIGGER_AUTOFS));
if (r < 0) { if (r < 0) {
if (r != -ENOENT) if (r != -ENOENT)
return r; return r;

View File

@ -241,9 +241,9 @@ static int set_proj_id_cb(
int set_proj_id_recursive(int fd, uint32_t proj_id) { int set_proj_id_recursive(int fd, uint32_t proj_id) {
return recurse_dir_at( return recurse_dir_at(
fd, fd,
/* path= */ NULL, /* path = */ NULL,
/* statx_mask= */ 0, /* statx_mask = */ 0,
/* n_depth_max= */ UINT_MAX, /* n_depth_max = */ UINT_MAX,
RECURSE_DIR_ENSURE_TYPE|RECURSE_DIR_TOPLEVEL|RECURSE_DIR_INODE_FD, RECURSE_DIR_ENSURE_TYPE|RECURSE_DIR_TOPLEVEL|RECURSE_DIR_INODE_FD,
set_proj_id_cb, set_proj_id_cb,
UINT32_TO_PTR(proj_id)); UINT32_TO_PTR(proj_id));

View File

@ -148,7 +148,7 @@ int conf_file_new_at(const char *path, int rfd, ChaseFlags chase_flags, ConfFile
CHASE_AT_RESOLVE_IN_ROOT | CHASE_AT_RESOLVE_IN_ROOT |
CHASE_MUST_BE_DIRECTORY | CHASE_MUST_BE_DIRECTORY |
(FLAGS_SET(chase_flags, CHASE_NONEXISTENT) ? CHASE_NONEXISTENT : 0), (FLAGS_SET(chase_flags, CHASE_NONEXISTENT) ? CHASE_NONEXISTENT : 0),
&resolved_dirpath, /* ret_fd= */ NULL); &resolved_dirpath, /* ret_fd = */ NULL);
if (r < 0) if (r < 0)
return log_debug_errno(r, "Failed to chase '%s%s': %m", empty_to_root(root), skip_leading_slash(dirpath)); return log_debug_errno(r, "Failed to chase '%s%s': %m", empty_to_root(root), skip_leading_slash(dirpath));
} }
@ -177,7 +177,7 @@ int conf_file_new(const char *path, const char *root, ChaseFlags chase_flags, Co
_cleanup_free_ char *root_abs = NULL; _cleanup_free_ char *root_abs = NULL;
_cleanup_close_ int rfd = -EBADF; _cleanup_close_ int rfd = -EBADF;
r = prepare_dirs(root, /* dirs= */ NULL, &rfd, &root_abs, /* ret_dirs= */ NULL); r = prepare_dirs(root, /* dirs = */ NULL, &rfd, &root_abs, /* ret_dirs = */ NULL);
if (r < 0) if (r < 0)
return r; return r;
@ -593,7 +593,7 @@ int conf_files_list_strv(
return r; return r;
r = conf_files_list_impl(suffix, rfd, root_abs, flags, (const char * const *) dirs_abs, r = conf_files_list_impl(suffix, rfd, root_abs, flags, (const char * const *) dirs_abs,
/* replacement= */ NULL, &fh, /* ret_inserted= */ NULL); /* replacement = */ NULL, &fh, /* ret_inserted = */ NULL);
if (r < 0) if (r < 0)
return r; return r;
@ -622,7 +622,7 @@ int conf_files_list_strv_full(
return r; return r;
r = conf_files_list_impl(suffix, rfd, root_abs, flags, (const char * const *) dirs_abs, r = conf_files_list_impl(suffix, rfd, root_abs, flags, (const char * const *) dirs_abs,
/* replacement= */ NULL, &fh, /* ret_inserted= */ NULL); /* replacement = */ NULL, &fh, /* ret_inserted = */ NULL);
if (r < 0) if (r < 0)
return r; return r;
@ -646,11 +646,11 @@ int conf_files_list_strv_at(
if (rfd >= 0 && DEBUG_LOGGING) if (rfd >= 0 && DEBUG_LOGGING)
(void) fd_get_path(rfd, &root); /* for logging */ (void) fd_get_path(rfd, &root); /* for logging */
r = conf_files_list_impl(suffix, rfd, root, flags, dirs, /* replacement= */ NULL, &fh, /* ret_inserted= */ NULL); r = conf_files_list_impl(suffix, rfd, root, flags, dirs, /* replacement = */ NULL, &fh, /* ret_inserted = */ NULL);
if (r < 0) if (r < 0)
return r; return r;
return copy_and_sort_files_from_hashmap(fh, suffix, /* root= */ NULL, flags, ret); return copy_and_sort_files_from_hashmap(fh, suffix, /* root = */ NULL, flags, ret);
} }
int conf_files_list_strv_at_full( int conf_files_list_strv_at_full(
@ -672,11 +672,11 @@ int conf_files_list_strv_at_full(
if (rfd >= 0 && DEBUG_LOGGING) if (rfd >= 0 && DEBUG_LOGGING)
(void) fd_get_path(rfd, &root); /* for logging */ (void) fd_get_path(rfd, &root); /* for logging */
r = conf_files_list_impl(suffix, rfd, root, flags, dirs, /* replacement= */ NULL, &fh, /* ret_inserted= */ NULL); r = conf_files_list_impl(suffix, rfd, root, flags, dirs, /* replacement = */ NULL, &fh, /* ret_inserted = */ NULL);
if (r < 0) if (r < 0)
return r; return r;
return dump_files(fh, /* root= */ NULL, ret_files, ret_n_files); return dump_files(fh, /* root = */ NULL, ret_files, ret_n_files);
} }
int conf_files_list(char ***ret, const char *suffix, const char *root, ConfFilesFlags flags, const char *dir) { int conf_files_list(char ***ret, const char *suffix, const char *root, ConfFilesFlags flags, const char *dir) {

View File

@ -248,11 +248,11 @@ int efi_set_variable(const char *variable, const void *value, size_t size) {
* accidentally however, hence let's unset the bit first. */ * accidentally however, hence let's unset the bit first. */
r = chattr_full(AT_FDCWD, p, r = chattr_full(AT_FDCWD, p,
/* value= */ 0, /* value = */ 0,
/* mask= */ FS_IMMUTABLE_FL, /* mask = */ FS_IMMUTABLE_FL,
/* ret_previous= */ &saved_flags, /* ret_previous = */ &saved_flags,
/* ret_final= */ NULL, /* ret_final = */ NULL,
/* flags= */ 0); /* flags = */ 0);
if (r < 0 && r != -ENOENT) if (r < 0 && r != -ENOENT)
log_debug_errno(r, "Failed to drop FS_IMMUTABLE_FL flag from '%s', ignoring: %m", p); log_debug_errno(r, "Failed to drop FS_IMMUTABLE_FL flag from '%s', ignoring: %m", p);
@ -288,7 +288,7 @@ int efi_set_variable(const char *variable, const void *value, size_t size) {
/* For some reason efivarfs doesn't update mtime automatically. Let's do it manually then. This is /* For some reason efivarfs doesn't update mtime automatically. Let's do it manually then. This is
* useful for processes that cache EFI variables to detect when changes occurred. */ * useful for processes that cache EFI variables to detect when changes occurred. */
if (futimens(fd, /* times= */ NULL) < 0) if (futimens(fd, /* times = */ NULL) < 0)
log_debug_errno(errno, "Failed to update mtime/atime on %s, ignoring: %m", p); log_debug_errno(errno, "Failed to update mtime/atime on %s, ignoring: %m", p);
r = 0; r = 0;

View File

@ -881,7 +881,7 @@ int script_get_shebang_interpreter(const char *path, char **ret) {
_cleanup_free_ char *p = NULL; _cleanup_free_ char *p = NULL;
const char *s = line; const char *s = line;
r = extract_first_word(&s, &p, /* separators= */ NULL, /* flags= */ 0); r = extract_first_word(&s, &p, /* separators = */ NULL, /* flags = */ 0);
if (r < 0) if (r < 0)
return r; return r;
if (r == 0) if (r == 0)

View File

@ -329,7 +329,7 @@ int futimens_opath(int fd, const struct timespec ts[2]) {
/* Support for AT_EMPTY_PATH is added rather late (kernel 5.8), so fall back to going through /proc/ /* Support for AT_EMPTY_PATH is added rather late (kernel 5.8), so fall back to going through /proc/
* if unavailable. */ * if unavailable. */
if (utimensat(AT_FDCWD, FORMAT_PROC_FD_PATH(fd), ts, /* flags= */ 0) < 0) { if (utimensat(AT_FDCWD, FORMAT_PROC_FD_PATH(fd), ts, /* flags = */ 0) < 0) {
if (errno != ENOENT) if (errno != ENOENT)
return -errno; return -errno;
@ -649,7 +649,7 @@ static int tmp_dir_internal(const char *def, const char **ret) {
return 0; return 0;
} }
k = is_dir(def, /* follow= */ true); k = is_dir(def, /* follow = */ true);
if (k == 0) if (k == 0)
k = -ENOTDIR; k = -ENOTDIR;
if (k < 0) if (k < 0)

View File

@ -158,7 +158,7 @@ int glob_extend(char ***strv, const char *path, int flags) {
if (r < 0) if (r < 0)
return r; return r;
return strv_extend_strv_consume(strv, v, /* filter_duplicates= */ false); return strv_extend_strv_consume(strv, v, /* filter_duplicates = */ false);
} }
int glob_non_glob_prefix(const char *path, char **ret) { int glob_non_glob_prefix(const char *path, char **ret) {

View File

@ -44,7 +44,7 @@ int make_lock_file_at(int dir_fd, const char *p, int operation, LockFile *ret) {
fd = xopenat_lock_full(dfd, fd = xopenat_lock_full(dfd,
p, p,
O_CREAT|O_RDWR|O_NOFOLLOW|O_CLOEXEC|O_NOCTTY, O_CREAT|O_RDWR|O_NOFOLLOW|O_CLOEXEC|O_NOCTTY,
/* xopen_flags= */ 0, /* xopen_flags = */ 0,
0600, 0600,
LOCK_UNPOSIX, LOCK_UNPOSIX,
operation); operation);
@ -154,11 +154,11 @@ static int fcntl_lock(int fd, int operation, bool ofd) {
} }
int posix_lock(int fd, int operation) { int posix_lock(int fd, int operation) {
return fcntl_lock(fd, operation, /* ofd= */ false); return fcntl_lock(fd, operation, /*ofd=*/ false);
} }
int unposix_lock(int fd, int operation) { int unposix_lock(int fd, int operation) {
return fcntl_lock(fd, operation, /* ofd= */ true); return fcntl_lock(fd, operation, /*ofd=*/ true);
} }
void posix_unlockpp(int **fd) { void posix_unlockpp(int **fd) {
@ -167,7 +167,7 @@ void posix_unlockpp(int **fd) {
if (!*fd || **fd < 0) if (!*fd || **fd < 0)
return; return;
(void) fcntl_lock(**fd, LOCK_UN, /* ofd= */ false); (void) fcntl_lock(**fd, LOCK_UN, /*ofd=*/ false);
*fd = NULL; *fd = NULL;
} }
@ -177,7 +177,7 @@ void unposix_unlockpp(int **fd) {
if (!*fd || **fd < 0) if (!*fd || **fd < 0)
return; return;
(void) fcntl_lock(**fd, LOCK_UN, /* ofd= */ true); (void) fcntl_lock(**fd, LOCK_UN, /*ofd=*/ true);
*fd = NULL; *fd = NULL;
} }

View File

@ -145,7 +145,7 @@ static LogContext* log_context_free(LogContext *c) {
DEFINE_TRIVIAL_REF_UNREF_FUNC(LogContext, log_context, log_context_free); DEFINE_TRIVIAL_REF_UNREF_FUNC(LogContext, log_context, log_context_free);
LogContext* log_context_new_strv_consume(char **fields) { LogContext* log_context_new_strv_consume(char **fields) {
LogContext *c = log_context_new_strv(fields, /* owned= */ true); LogContext *c = log_context_new_strv(fields, /*owned=*/ true);
if (!c) if (!c)
strv_free(fields); strv_free(fields);
@ -153,7 +153,7 @@ LogContext* log_context_new_strv_consume(char **fields) {
} }
LogContext* log_context_new_iov_consume(struct iovec *input_iovec, size_t n_input_iovec) { LogContext* log_context_new_iov_consume(struct iovec *input_iovec, size_t n_input_iovec) {
LogContext *c = log_context_new_iov(input_iovec, n_input_iovec, /* owned= */ true); LogContext *c = log_context_new_iov(input_iovec, n_input_iovec, /*owned=*/ true);
if (!c) if (!c)
iovec_array_free(input_iovec, n_input_iovec); iovec_array_free(input_iovec, n_input_iovec);

View File

@ -90,13 +90,13 @@ void _reset_log_level(int *saved_log_level);
_LOG_CONTEXT_PUSH_KEY_VALUE(key, value, UNIQ_T(c, UNIQ)) _LOG_CONTEXT_PUSH_KEY_VALUE(key, value, UNIQ_T(c, UNIQ))
#define _LOG_CONTEXT_PUSH_STRV(strv, c) \ #define _LOG_CONTEXT_PUSH_STRV(strv, c) \
_unused_ _cleanup_(log_context_unrefp) LogContext *c = log_context_new_strv(strv, /* owned= */ false); _unused_ _cleanup_(log_context_unrefp) LogContext *c = log_context_new_strv(strv, /*owned=*/ false);
#define LOG_CONTEXT_PUSH_STRV(strv) \ #define LOG_CONTEXT_PUSH_STRV(strv) \
_LOG_CONTEXT_PUSH_STRV(strv, UNIQ_T(c, UNIQ)) _LOG_CONTEXT_PUSH_STRV(strv, UNIQ_T(c, UNIQ))
#define _LOG_CONTEXT_PUSH_IOV(input_iovec, n_input_iovec, c) \ #define _LOG_CONTEXT_PUSH_IOV(input_iovec, n_input_iovec, c) \
_unused_ _cleanup_(log_context_unrefp) LogContext *c = log_context_new_iov(input_iovec, n_input_iovec, /* owned= */ false); _unused_ _cleanup_(log_context_unrefp) LogContext *c = log_context_new_iov(input_iovec, n_input_iovec, /*owned=*/ false);
#define LOG_CONTEXT_PUSH_IOV(input_iovec, n_input_iovec) \ #define LOG_CONTEXT_PUSH_IOV(input_iovec, n_input_iovec) \
_LOG_CONTEXT_PUSH_IOV(input_iovec, n_input_iovec, UNIQ_T(c, UNIQ)) _LOG_CONTEXT_PUSH_IOV(input_iovec, n_input_iovec, UNIQ_T(c, UNIQ))

View File

@ -374,7 +374,7 @@ int log_syntax_parse_error_internal(
log_syntax_parse_error_internal(unit, config_file, config_line, error, critical, PROJECT_FILE, __LINE__, __func__, lvalue, rvalue) log_syntax_parse_error_internal(unit, config_file, config_line, error, critical, PROJECT_FILE, __LINE__, __func__, lvalue, rvalue)
#define log_syntax_parse_error(unit, config_file, config_line, error, lvalue, rvalue) \ #define log_syntax_parse_error(unit, config_file, config_line, error, lvalue, rvalue) \
log_syntax_parse_error_full(unit, config_file, config_line, error, /* critical= */ false, lvalue, rvalue) log_syntax_parse_error_full(unit, config_file, config_line, error, /* critical = */ false, lvalue, rvalue)
#define DEBUG_LOGGING _unlikely_(log_get_max_level() >= LOG_DEBUG) #define DEBUG_LOGGING _unlikely_(log_get_max_level() >= LOG_DEBUG)

View File

@ -113,7 +113,7 @@ int mkdirat_parents_internal(int dir_fd, const char *path, mode_t mode, uid_t ui
/* drop the last component */ /* drop the last component */
path = strndupa_safe(path, e - path); path = strndupa_safe(path, e - path);
r = is_dir_at(dir_fd, path, /* follow= */ true); r = is_dir_at(dir_fd, path, /* follow = */ true);
if (r > 0) if (r > 0)
return 0; return 0;
if (r == 0) if (r == 0)

View File

@ -1465,11 +1465,11 @@ int path_glob_can_match(const char *pattern, const char *prefix, char **ret) {
const char *p, *q; const char *p, *q;
int r, s; int r, s;
r = path_find_first_component(&a, /* accept_dot_dot= */ false, &p); r = path_find_first_component(&a, /* accept_dot_dot = */ false, &p);
if (r < 0) if (r < 0)
return r; return r;
s = path_find_first_component(&b, /* accept_dot_dot= */ false, &q); s = path_find_first_component(&b, /* accept_dot_dot = */ false, &q);
if (s < 0) if (s < 0)
return s; return s;

View File

@ -29,7 +29,7 @@ int pidfd_check_pidfs(int pid_fd) {
_cleanup_close_ int our_fd = -EBADF; _cleanup_close_ int our_fd = -EBADF;
if (pid_fd < 0) { if (pid_fd < 0) {
our_fd = pidfd_open(getpid_cached(), /* flags= */ 0); our_fd = pidfd_open(getpid_cached(), /* flags = */ 0);
if (our_fd < 0) if (our_fd < 0)
return -errno; return -errno;

View File

@ -62,7 +62,7 @@ int proc_cmdline_filter_pid1_args(char **argv, char ***ret) {
if (a[1] == '-') { if (a[1] == '-') {
if (a[2] == '\0') { if (a[2] == '\0') {
/* "--" is specified, accepting remaining strings. */ /* "--" is specified, accepting remaining strings. */
r = strv_extend_strv(&filtered, strv_skip(p, 1), /* filter_duplicates= */ false); r = strv_extend_strv(&filtered, strv_skip(p, 1), /* filter_duplicates = */ false);
if (r < 0) if (r < 0)
return r; return r;
break; break;
@ -137,7 +137,7 @@ static int proc_cmdline_strv_internal(char ***ret, bool filter_pid1_args) {
if (detect_container() > 0) { if (detect_container() > 0) {
_cleanup_strv_free_ char **args = NULL; _cleanup_strv_free_ char **args = NULL;
r = pid_get_cmdline_strv(1, /* flags= */ 0, &args); r = pid_get_cmdline_strv(1, /* flags = */ 0, &args);
if (r < 0) if (r < 0)
return r; return r;
@ -159,7 +159,7 @@ static int proc_cmdline_strv_internal(char ***ret, bool filter_pid1_args) {
} }
int proc_cmdline_strv(char ***ret) { int proc_cmdline_strv(char ***ret) {
return proc_cmdline_strv_internal(ret, /* filter_pid1_args= */ false); return proc_cmdline_strv_internal(ret, /* filter_pid1_args = */ false);
} }
static char *mangle_word(const char *word, ProcCmdlineFlags flags) { static char *mangle_word(const char *word, ProcCmdlineFlags flags) {
@ -216,7 +216,7 @@ int proc_cmdline_parse(proc_cmdline_parse_t parse_item, void *data, ProcCmdlineF
* for proc_cmdline_parse(), let's make this clear. */ * for proc_cmdline_parse(), let's make this clear. */
assert(!(flags & (PROC_CMDLINE_VALUE_OPTIONAL|PROC_CMDLINE_TRUE_WHEN_MISSING))); assert(!(flags & (PROC_CMDLINE_VALUE_OPTIONAL|PROC_CMDLINE_TRUE_WHEN_MISSING)));
r = proc_cmdline_strv_internal(&args, /* filter_pid1_args= */ true); r = proc_cmdline_strv_internal(&args, /* filter_pid1_args = */ true);
if (r < 0) if (r < 0)
return r; return r;
@ -326,7 +326,7 @@ int proc_cmdline_get_key(const char *key, ProcCmdlineFlags flags, char **ret_val
if (FLAGS_SET(flags, PROC_CMDLINE_VALUE_OPTIONAL) && !ret_value) if (FLAGS_SET(flags, PROC_CMDLINE_VALUE_OPTIONAL) && !ret_value)
return -EINVAL; return -EINVAL;
r = proc_cmdline_strv_internal(&args, /* filter_pid1_args= */ true); r = proc_cmdline_strv_internal(&args, /* filter_pid1_args = */ true);
if (r < 0) if (r < 0)
return r; return r;

View File

@ -249,7 +249,7 @@ int pid_get_cmdline(pid_t pid, size_t max_columns, ProcessCmdlineFlags flags, ch
/* Drop trailing NULs, otherwise strv_parse_nulstr() adds additional empty strings at the end. /* Drop trailing NULs, otherwise strv_parse_nulstr() adds additional empty strings at the end.
* See also issue #21186. */ * See also issue #21186. */
args = strv_parse_nulstr_full(t, k, /* drop_trailing_nuls= */ true); args = strv_parse_nulstr_full(t, k, /* drop_trailing_nuls = */ true);
if (!args) if (!args)
return -ENOMEM; return -ENOMEM;
@ -315,7 +315,7 @@ int pid_get_cmdline_strv(pid_t pid, ProcessCmdlineFlags flags, char ***ret) {
if (r < 0) if (r < 0)
return r; return r;
args = strv_parse_nulstr_full(t, k, /* drop_trailing_nuls= */ true); args = strv_parse_nulstr_full(t, k, /* drop_trailing_nuls = */ true);
if (!args) if (!args)
return -ENOMEM; return -ENOMEM;
@ -2339,7 +2339,7 @@ int read_errno(int errno_fd) {
/* The issue here is that it's impossible to distinguish between an error code returned by child and /* The issue here is that it's impossible to distinguish between an error code returned by child and
* IO error arose when reading it. So, the function logs errors and return EIO for the later case. */ * IO error arose when reading it. So, the function logs errors and return EIO for the later case. */
ssize_t n = loop_read(errno_fd, &r, sizeof(r), /* do_poll= */ false); ssize_t n = loop_read(errno_fd, &r, sizeof(r), /* do_poll = */ false);
if (n < 0) { if (n < 0) {
log_debug_errno(n, "Failed to read errno: %m"); log_debug_errno(n, "Failed to read errno: %m");
return -EIO; return -EIO;

View File

@ -183,7 +183,7 @@ int convert_meminfo_value_to_uint64_bytes(const char *s, uint64_t *ret) {
assert(s); assert(s);
assert(ret); assert(ret);
r = extract_first_word(&s, &w, /* separators= */ NULL, /* flags= */ 0); r = extract_first_word(&s, &w, /* separators = */ NULL, /* flags = */ 0);
if (r < 0) if (r < 0)
return r; return r;
if (r == 0) if (r == 0)

View File

@ -5,7 +5,7 @@
typedef struct RateLimit { typedef struct RateLimit {
usec_t interval; /* Keep those two fields first so they can be initialized easily: */ usec_t interval; /* Keep those two fields first so they can be initialized easily: */
unsigned burst; /* RateLimit rl = { INTERVAL, BURST }; */ unsigned burst; /* RateLimit rl = { INTERVAL, BURST }; */
unsigned num; unsigned num;
usec_t begin; usec_t begin;
} RateLimit; } RateLimit;

View File

@ -230,9 +230,9 @@ int recurse_dir(
r = func(RECURSE_DIR_SKIP_OPEN_DIR_ERROR_BASE + errno, r = func(RECURSE_DIR_SKIP_OPEN_DIR_ERROR_BASE + errno,
p, p,
dir_fd, dir_fd,
/* inode_fd= */ -EBADF, /* inode_fd = */ -EBADF,
i, i,
/* sx= */ NULL, /* sx = */ NULL,
userdata); userdata);
if (r == RECURSE_DIR_LEAVE_DIRECTORY) if (r == RECURSE_DIR_LEAVE_DIRECTORY)
break; break;
@ -274,9 +274,9 @@ int recurse_dir(
r = func(RECURSE_DIR_SKIP_OPEN_INODE_ERROR_BASE + errno, r = func(RECURSE_DIR_SKIP_OPEN_INODE_ERROR_BASE + errno,
p, p,
dir_fd, dir_fd,
/* inode_fd= */ -EBADF, /* inode_fd = */ -EBADF,
i, i,
/* sx= */ NULL, /* sx = */ NULL,
userdata); userdata);
if (r == RECURSE_DIR_LEAVE_DIRECTORY) if (r == RECURSE_DIR_LEAVE_DIRECTORY)
break; break;
@ -322,9 +322,9 @@ int recurse_dir(
r = func(RECURSE_DIR_SKIP_STAT_INODE_ERROR_BASE + errno, r = func(RECURSE_DIR_SKIP_STAT_INODE_ERROR_BASE + errno,
p, p,
dir_fd, dir_fd,
/* inode_fd= */ -EBADF, /* inode_fd = */ -EBADF,
i, i,
/* sx= */ NULL, /* sx = */ NULL,
userdata); userdata);
if (r == RECURSE_DIR_LEAVE_DIRECTORY) if (r == RECURSE_DIR_LEAVE_DIRECTORY)
break; break;
@ -352,9 +352,9 @@ int recurse_dir(
r = func(RECURSE_DIR_SKIP_STAT_INODE_ERROR_BASE + EISDIR, r = func(RECURSE_DIR_SKIP_STAT_INODE_ERROR_BASE + EISDIR,
p, p,
dir_fd, dir_fd,
/* inode_fd= */ -EBADF, /* inode_fd = */ -EBADF,
i, i,
/* sx= */ NULL, /* sx = */ NULL,
userdata); userdata);
if (r == RECURSE_DIR_LEAVE_DIRECTORY) if (r == RECURSE_DIR_LEAVE_DIRECTORY)
break; break;
@ -384,7 +384,7 @@ int recurse_dir(
if (sx_valid && FLAGS_SET(sx.stx_attributes_mask, STATX_ATTR_MOUNT_ROOT)) if (sx_valid && FLAGS_SET(sx.stx_attributes_mask, STATX_ATTR_MOUNT_ROOT))
is_mount = FLAGS_SET(sx.stx_attributes, STATX_ATTR_MOUNT_ROOT); is_mount = FLAGS_SET(sx.stx_attributes, STATX_ATTR_MOUNT_ROOT);
else { else {
r = is_mount_point_at(dir_fd, i->d_name, /* flags= */ 0); r = is_mount_point_at(dir_fd, i->d_name, /* flags = */ 0);
if (r < 0) if (r < 0)
log_debug_errno(r, "Failed to determine whether %s is a submount, assuming not: %m", p); log_debug_errno(r, "Failed to determine whether %s is a submount, assuming not: %m", p);

View File

@ -464,7 +464,7 @@ int pid_getrlimit(pid_t pid, int resource, struct rlimit *ret) {
const char *p = procfs_file_alloca(pid, "limits"); const char *p = procfs_file_alloca(pid, "limits");
_cleanup_free_ char *limits = NULL; _cleanup_free_ char *limits = NULL;
r = read_full_file(p, &limits, /* ret_size= */ NULL); r = read_full_file(p, &limits, /* ret_size = */ NULL);
if (r < 0) if (r < 0)
return -EPERM; /* propagate original permission error if we can't access the limits file */ return -EPERM; /* propagate original permission error if we can't access the limits file */

View File

@ -1320,7 +1320,7 @@ ssize_t flush_mqueue(int fd) {
return -ENOMEM; return -ENOMEM;
} }
l = mq_receive(fd, buf, attr.mq_msgsize, /* msg_prio= */ NULL); l = mq_receive(fd, buf, attr.mq_msgsize, /* msg_prio = */ NULL);
if (l < 0) { if (l < 0) {
if (errno == EINTR) if (errno == EINTR)
continue; continue;

View File

@ -332,7 +332,7 @@ static char *ascii_ellipsize_mem(const char *s, size_t old_length, size_t new_le
x = ((new_length - need_space) * percent + 50) / 100; x = ((new_length - need_space) * percent + 50) / 100;
assert(x <= new_length - need_space); assert(x <= new_length - need_space);
write_ellipsis(mempcpy(t, s, x), /* unicode= */ false); write_ellipsis(mempcpy(t, s, x), /* unicode = */ false);
suffix_len = new_length - x - need_space; suffix_len = new_length - x - need_space;
memcpy(t + x + 3, s + old_length - suffix_len, suffix_len); memcpy(t + x + 3, s + old_length - suffix_len, suffix_len);
*(t + x + 3 + suffix_len) = '\0'; *(t + x + 3 + suffix_len) = '\0';
@ -454,7 +454,7 @@ char* ellipsize_mem(const char *s, size_t old_length, size_t new_length, unsigne
return NULL; return NULL;
memcpy_safe(e, s, len); memcpy_safe(e, s, len);
write_ellipsis(e + len, /* unicode= */ true); write_ellipsis(e + len, /* unicode = */ true);
char *dst = e + len + 3; char *dst = e + len + 3;
@ -533,7 +533,7 @@ char* cellescape(char *buf, size_t len, const char *s) {
} }
if (i + 4 <= len) /* yay, enough space */ if (i + 4 <= len) /* yay, enough space */
i += write_ellipsis(buf + i, /* unicode= */ false); i += write_ellipsis(buf + i, /* unicode = */ false);
else if (i + 3 <= len) { /* only space for ".." */ else if (i + 3 <= len) { /* only space for ".." */
buf[i++] = '.'; buf[i++] = '.';
buf[i++] = '.'; buf[i++] = '.';

View File

@ -925,7 +925,7 @@ int strv_extend_joined_with_size_sentinel(char ***l, size_t *n, ...) {
va_list ap; va_list ap;
va_start(ap, n); va_start(ap, n);
char *x = strextendv_with_separator(/* x= */ NULL, /* separator= */ NULL, ap); char *x = strextendv_with_separator(/* x= */ NULL, /* separator=*/ NULL, ap);
va_end(ap); va_end(ap);
if (!x) if (!x)
return -ENOMEM; return -ENOMEM;

View File

@ -377,7 +377,7 @@ int ask_string_full(
/* n_columns= */ SIZE_MAX, /* n_columns= */ SIZE_MAX,
/* column_width= */ SIZE_MAX, /* column_width= */ SIZE_MAX,
/* ellipsize_percentage= */ 0, /* ellipsize_percentage= */ 0,
/* grey_prefix= */ string, /* grey_prefix=*/ string,
/* with_numbers= */ false); /* with_numbers= */ false);
if (r < 0) if (r < 0)
goto fail; goto fail;
@ -730,7 +730,7 @@ int acquire_terminal(
.fd = notify, .fd = notify,
.events = POLLIN, .events = POLLIN,
}, },
/* n_fds= */ 1, /* n_fds = */ 1,
left, left,
&poll_ss); &poll_ss);
if (r < 0) if (r < 0)
@ -1095,7 +1095,7 @@ bool tty_is_vc(const char *tty) {
* about whether it's strictly valid, but only asking "does this fall into the vt category?", for which * about whether it's strictly valid, but only asking "does this fall into the vt category?", for which
* "yes" seems to be a better answer. */ * "yes" seems to be a better answer. */
return vtnr_from_tty_raw(tty, /* ret= */ NULL) >= 0; return vtnr_from_tty_raw(tty, /* ret = */ NULL) >= 0;
} }
bool tty_is_console(const char *tty) { bool tty_is_console(const char *tty) {
@ -1387,7 +1387,7 @@ int proc_cmdline_tty_size(const char *tty, unsigned *ret_rows, unsigned *ret_col
if (!colskey) if (!colskey)
return -ENOMEM; return -ENOMEM;
r = proc_cmdline_get_key_many(/* flags= */ 0, r = proc_cmdline_get_key_many(/* flags = */ 0,
rowskey, &rowsvalue, rowskey, &rowsvalue,
colskey, &colsvalue); colskey, &colsvalue);
if (r < 0) if (r < 0)
@ -1655,7 +1655,7 @@ int openpt_allocate_in_namespace(
_cleanup_close_pair_ int pair[2] = EBADF_PAIR; _cleanup_close_pair_ int pair[2] = EBADF_PAIR;
int r; int r;
r = pidref_namespace_open(pidref, &pidnsfd, &mntnsfd, /* ret_netns_fd= */ NULL, &usernsfd, &rootfd); r = pidref_namespace_open(pidref, &pidnsfd, &mntnsfd, /* ret_netns_fd = */ NULL, &usernsfd, &rootfd);
if (r < 0) if (r < 0)
return r; return r;

View File

@ -1060,31 +1060,31 @@ int parse_timestamp(const char *t, usec_t *ret) {
size_t t_len = strlen(t); size_t t_len = strlen(t);
if (t_len > 2 && t[t_len - 1] == 'Z') { if (t_len > 2 && t[t_len - 1] == 'Z') {
/* Try to parse as RFC3339-style welded UTC: "1985-04-12T23:20:50.52Z" */ /* Try to parse as RFC3339-style welded UTC: "1985-04-12T23:20:50.52Z" */
r = parse_timestamp_impl(t, t_len - 1, /* utc= */ true, /* isdst= */ -1, /* gmtoff= */ 0, ret); r = parse_timestamp_impl(t, t_len - 1, /* utc = */ true, /* isdst = */ -1, /* gmtoff = */ 0, ret);
if (r >= 0) if (r >= 0)
return r; return r;
} }
/* RFC3339-style welded offset: "1990-12-31T15:59:60-08:00" */ /* RFC3339-style welded offset: "1990-12-31T15:59:60-08:00" */
if (t_len > 7 && IN_SET(t[t_len - 6], '+', '-') && t[t_len - 7] != ' ' && parse_gmtoff(&t[t_len - 6], &gmtoff) >= 0) if (t_len > 7 && IN_SET(t[t_len - 6], '+', '-') && t[t_len - 7] != ' ' && parse_gmtoff(&t[t_len - 6], &gmtoff) >= 0)
return parse_timestamp_impl(t, t_len - 6, /* utc= */ true, /* isdst= */ -1, gmtoff, ret); return parse_timestamp_impl(t, t_len - 6, /* utc = */ true, /* isdst = */ -1, gmtoff, ret);
const char *tz = strrchr(t, ' '); const char *tz = strrchr(t, ' ');
if (!tz) if (!tz)
return parse_timestamp_impl(t, /* max_len= */ SIZE_MAX, /* utc= */ false, /* isdst= */ -1, /* gmtoff= */ 0, ret); return parse_timestamp_impl(t, /* max_len = */ SIZE_MAX, /* utc = */ false, /* isdst = */ -1, /* gmtoff = */ 0, ret);
size_t max_len = tz - t; size_t max_len = tz - t;
tz++; tz++;
/* Shortcut, parse the string as UTC. */ /* Shortcut, parse the string as UTC. */
if (streq(tz, "UTC")) if (streq(tz, "UTC"))
return parse_timestamp_impl(t, max_len, /* utc= */ true, /* isdst= */ -1, /* gmtoff= */ 0, ret); return parse_timestamp_impl(t, max_len, /* utc = */ true, /* isdst = */ -1, /* gmtoff = */ 0, ret);
/* If the timezone is compatible with RFC-822/ISO 8601 (e.g. +06, or -03:00) then parse the string as /* If the timezone is compatible with RFC-822/ISO 8601 (e.g. +06, or -03:00) then parse the string as
* UTC and shift the result. Note, this must be earlier than the timezone check with tzname[], as * UTC and shift the result. Note, this must be earlier than the timezone check with tzname[], as
* tzname[] may be in the same format. */ * tzname[] may be in the same format. */
if (parse_gmtoff(tz, &gmtoff) >= 0) if (parse_gmtoff(tz, &gmtoff) >= 0)
return parse_timestamp_impl(t, max_len, /* utc= */ true, /* isdst= */ -1, gmtoff, ret); return parse_timestamp_impl(t, max_len, /* utc = */ true, /* isdst = */ -1, gmtoff, ret);
/* Check if the last word matches tzname[] of the local timezone. Note, this must be done earlier /* Check if the last word matches tzname[] of the local timezone. Note, this must be done earlier
* than the check by timezone_is_valid() below, as some short timezone specifications have their own * than the check by timezone_is_valid() below, as some short timezone specifications have their own
@ -1096,7 +1096,7 @@ int parse_timestamp(const char *t, usec_t *ret) {
continue; continue;
/* The specified timezone matches tzname[] of the local timezone. */ /* The specified timezone matches tzname[] of the local timezone. */
return parse_timestamp_impl(t, max_len, /* utc= */ false, /* isdst= */ j, /* gmtoff= */ 0, ret); return parse_timestamp_impl(t, max_len, /* utc = */ false, /* isdst = */ j, /* gmtoff = */ 0, ret);
} }
/* If the last word is a valid timezone file (e.g. Asia/Tokyo), then save the current timezone, apply /* If the last word is a valid timezone file (e.g. Asia/Tokyo), then save the current timezone, apply
@ -1104,15 +1104,15 @@ int parse_timestamp(const char *t, usec_t *ret) {
if (timezone_is_valid(tz, LOG_DEBUG)) { if (timezone_is_valid(tz, LOG_DEBUG)) {
SAVE_TIMEZONE; SAVE_TIMEZONE;
if (setenv("TZ", tz, /* overwrite= */ true) < 0) if (setenv("TZ", tz, /* overwrite = */ true) < 0)
return negative_errno(); return negative_errno();
return parse_timestamp_impl(t, max_len, /* utc= */ false, /* isdst= */ -1, /* gmtoff= */ 0, ret); return parse_timestamp_impl(t, max_len, /* utc = */ false, /* isdst = */ -1, /* gmtoff = */ 0, ret);
} }
/* Otherwise, assume that the last word is a part of the time and try to parse the whole string as a /* Otherwise, assume that the last word is a part of the time and try to parse the whole string as a
* local time. */ * local time. */
return parse_timestamp_impl(t, SIZE_MAX, /* utc= */ false, /* isdst= */ -1, /* gmtoff= */ 0, ret); return parse_timestamp_impl(t, SIZE_MAX, /* utc = */ false, /* isdst = */ -1, /* gmtoff = */ 0, ret);
} }
static const char* extract_multiplier(const char *p, usec_t *ret) { static const char* extract_multiplier(const char *p, usec_t *ret) {
@ -1172,7 +1172,7 @@ int parse_time(const char *t, usec_t *ret, usec_t default_unit) {
assert(t); assert(t);
assert(default_unit > 0); assert(default_unit > 0);
p = skip_leading_chars(t, /* bad= */ NULL); p = skip_leading_chars(t, /* bad = */ NULL);
s = startswith(p, "infinity"); s = startswith(p, "infinity");
if (s) { if (s) {
if (!in_charset(s, WHITESPACE)) if (!in_charset(s, WHITESPACE))
@ -1190,7 +1190,7 @@ int parse_time(const char *t, usec_t *ret, usec_t default_unit) {
long long l; long long l;
char *e; char *e;
p = skip_leading_chars(p, /* bad= */ NULL); p = skip_leading_chars(p, /* bad = */ NULL);
if (*p == 0) { if (*p == 0) {
if (!something) if (!something)
return -EINVAL; return -EINVAL;
@ -1628,7 +1628,7 @@ int verify_timezone(const char *name, int log_level) {
void reset_timezonep(char **p) { void reset_timezonep(char **p) {
assert(p); assert(p);
(void) set_unset_env("TZ", *p, /* overwrite= */ true); (void) set_unset_env("TZ", *p, /* overwrite = */ true);
tzset(); tzset();
*p = mfree(*p); *p = mfree(*p);
} }

View File

@ -125,11 +125,11 @@ char* format_timespan(char *buf, size_t l, usec_t t, usec_t accuracy) _warn_unus
_warn_unused_result_ _warn_unused_result_
static inline char* format_timestamp_relative(char *buf, size_t l, usec_t t) { static inline char* format_timestamp_relative(char *buf, size_t l, usec_t t) {
return format_timestamp_relative_full(buf, l, t, CLOCK_REALTIME, /* implicit_left= */ false); return format_timestamp_relative_full(buf, l, t, CLOCK_REALTIME, /* implicit_left = */ false);
} }
_warn_unused_result_ _warn_unused_result_
static inline char* format_timestamp_relative_monotonic(char *buf, size_t l, usec_t t) { static inline char* format_timestamp_relative_monotonic(char *buf, size_t l, usec_t t) {
return format_timestamp_relative_full(buf, l, t, CLOCK_MONOTONIC, /* implicit_left= */ false); return format_timestamp_relative_full(buf, l, t, CLOCK_MONOTONIC, /* implicit_left = */ false);
} }
_warn_unused_result_ _warn_unused_result_

View File

@ -202,7 +202,7 @@ int tempfn_xxxxxx(const char *p, const char *extra, char **ret) {
* /foo/bar/.#<extra>waldoXXXXXX * /foo/bar/.#<extra>waldoXXXXXX
*/ */
return tempfn_build(p, extra, "XXXXXX", /* child= */ false, ret); return tempfn_build(p, extra, "XXXXXX", /* child = */ false, ret);
} }
int tempfn_random(const char *p, const char *extra, char **ret) { int tempfn_random(const char *p, const char *extra, char **ret) {
@ -222,7 +222,7 @@ int tempfn_random(const char *p, const char *extra, char **ret) {
if (asprintf(&s, "%016" PRIx64, random_u64()) < 0) if (asprintf(&s, "%016" PRIx64, random_u64()) < 0)
return -ENOMEM; return -ENOMEM;
return tempfn_build(p, extra, s, /* child= */ false, ret); return tempfn_build(p, extra, s, /* child = */ false, ret);
} }
int tempfn_random_child(const char *p, const char *extra, char **ret) { int tempfn_random_child(const char *p, const char *extra, char **ret) {
@ -246,7 +246,7 @@ int tempfn_random_child(const char *p, const char *extra, char **ret) {
if (asprintf(&s, "%016" PRIx64, random_u64()) < 0) if (asprintf(&s, "%016" PRIx64, random_u64()) < 0)
return -ENOMEM; return -ENOMEM;
return tempfn_build(p, extra, s, /* child= */ true, ret); return tempfn_build(p, extra, s, /* child = */ true, ret);
} }
int open_tmpfile_unlinkable(const char *directory, int flags) { int open_tmpfile_unlinkable(const char *directory, int flags) {

View File

@ -125,7 +125,7 @@ int uid_range_add_str(UIDRange **range, const char *s) {
if (r < 0) if (r < 0)
return r; return r;
return uid_range_add_internal(range, start, end - start + 1, /* coalesce= */ true); return uid_range_add_internal(range, start, end - start + 1, /* coalesce = */ true);
} }
int uid_range_next_lower(const UIDRange *range, uid_t *uid) { int uid_range_next_lower(const UIDRange *range, uid_t *uid) {
@ -274,7 +274,7 @@ int uid_range_load_userns(const char *path, UIDRangeUsernsMode mode, UIDRange **
&range, &range,
IN_SET(mode, UID_RANGE_USERNS_INSIDE, GID_RANGE_USERNS_INSIDE) ? uid_base : uid_shift, IN_SET(mode, UID_RANGE_USERNS_INSIDE, GID_RANGE_USERNS_INSIDE) ? uid_base : uid_shift,
uid_range, uid_range,
/* coalesce= */ false); /* coalesce = */ false);
if (r < 0) if (r < 0)
return r; return r;
} }

View File

@ -814,7 +814,7 @@ int running_in_chroot(void) {
if (getenv_bool("SYSTEMD_IGNORE_CHROOT") > 0) if (getenv_bool("SYSTEMD_IGNORE_CHROOT") > 0)
return 0; return 0;
r = inode_same("/proc/1/root", "/", /* flags= */ 0); r = inode_same("/proc/1/root", "/", /* flags = */ 0);
if (r == -ENOENT) { if (r == -ENOENT) {
r = proc_mounted(); r = proc_mounted();
if (r == 0) { if (r == 0) {

View File

@ -473,9 +473,9 @@ int fd_setcrtime(int fd, usec_t usec) {
usec = now(CLOCK_REALTIME); usec = now(CLOCK_REALTIME);
le = htole64((uint64_t) usec); le = htole64((uint64_t) usec);
return xsetxattr_full(fd, /* path= */ NULL, AT_EMPTY_PATH, return xsetxattr_full(fd, /* path = */ NULL, AT_EMPTY_PATH,
"user.crtime_usec", (const char*) &le, sizeof(le), "user.crtime_usec", (const char*) &le, sizeof(le),
/* xattr_flags= */ 0); /* xattr_flags = */ 0);
} }
bool xattr_is_acl(const char *name) { bool xattr_is_acl(const char *name) {

View File

@ -147,10 +147,10 @@ static int run(int argc, char *argv[]) {
log_warning_errno(fd, "Failed to open console, ignoring: %m"); log_warning_errno(fd, "Failed to open console, ignoring: %m");
else else
dprintf(fd, ANSI_HIGHLIGHT_RED "%s " BATTERY_LOW_MESSAGE ANSI_NORMAL "\n", dprintf(fd, ANSI_HIGHLIGHT_RED "%s " BATTERY_LOW_MESSAGE ANSI_NORMAL "\n",
glyph_full(GLYPH_LOW_BATTERY, /* force_utf= */ false)); glyph_full(GLYPH_LOW_BATTERY, /* force_utf = */ false));
if (asprintf(&plymouth_message, "%s " BATTERY_LOW_MESSAGE, if (asprintf(&plymouth_message, "%s " BATTERY_LOW_MESSAGE,
glyph_full(GLYPH_LOW_BATTERY, /* force_utf= */ true)) < 0) glyph_full(GLYPH_LOW_BATTERY, /* force_utf = */ true)) < 0)
return log_oom(); return log_oom();
(void) plymouth_send_message("shutdown", plymouth_message); (void) plymouth_send_message("shutdown", plymouth_message);

View File

@ -3133,4 +3133,4 @@ static EFI_STATUS run(EFI_HANDLE image) {
} }
} }
DEFINE_EFI_MAIN_FUNCTION(run, "systemd-boot", /* wait_for_debugger= */ false); DEFINE_EFI_MAIN_FUNCTION(run, "systemd-boot", /*wait_for_debugger=*/false);

View File

@ -128,7 +128,7 @@ EFI_STATUS device_path_to_str(const EFI_DEVICE_PATH *dp, char16_t **ret) {
return EFI_SUCCESS; return EFI_SUCCESS;
} }
str = dp_to_text->ConvertDevicePathToText(dp, /* DisplayOnly= */ false, /* AllowShortcuts= */ false); str = dp_to_text->ConvertDevicePathToText(dp, /* DisplayOnly=*/ false, /* AllowShortcuts= */ false);
if (!str) if (!str)
return EFI_OUT_OF_RESOURCES; return EFI_OUT_OF_RESOURCES;

View File

@ -5,13 +5,14 @@
#define FWHEADERMAGIC (UINT32_C(0xfeeddead)) #define FWHEADERMAGIC (UINT32_C(0xfeeddead))
/* The structure of the efifw UKI blob is the following: /* The structure of the efifw UKI blob is the following:
* --------------------------------------------------------- * ---------------------------------------------------------
* EfiFw header|fwid|payload| reserved for future attributes * EfiFw header|fwid|payload| reserved for future attributes
* --------------------------------------------------------- * ---------------------------------------------------------
* The base header defines the length of full header, fwid and payload. * The base header defines the length of full header, fwid and payload.
* The fwid is a NUL terminated string. * The fwid is a NUL terminated string.
* The payload contains the actual efi firmware. */ * The payload contains the actual efi firmware.
*/
typedef struct EfiFwHeader { typedef struct EfiFwHeader {
uint32_t magic; /* magic number that defines Efifw */ uint32_t magic; /* magic number that defines Efifw */
uint32_t header_len; /* total length of header including all attributes */ uint32_t header_len; /* total length of header including all attributes */

View File

@ -72,7 +72,7 @@ static EFI_STATUS load_via_boot_services(
}); });
err = BS->LoadImage(/* BootPolicy= */ false, err = BS->LoadImage(/* BootPolicy= */false,
parent, parent,
&kernel_file_path->memmap_path.Header, &kernel_file_path->memmap_path.Header,
kernel->iov_base, kernel->iov_base,

View File

@ -30,7 +30,7 @@ typedef struct {
} _packed_ GptHeader; } _packed_ GptHeader;
assert_cc(sizeof(GptHeader) == 512); assert_cc(sizeof(GptHeader) == 512);
static bool verify_gpt(/* const */ GptHeader *h, EFI_LBA lba_expected) { static bool verify_gpt(/*const*/ GptHeader *h, EFI_LBA lba_expected) {
uint32_t crc32, crc32_saved; uint32_t crc32, crc32_saved;
EFI_STATUS err; EFI_STATUS err;

View File

@ -367,8 +367,8 @@ static void pe_locate_sections(
n_section_table, n_section_table,
section_names, section_names,
validate_base, validate_base,
/* device_table= */ NULL, /* device_table = */ NULL,
/* device= */ NULL, /* device = */ NULL,
sections); sections);
/* It doesn't make sense not to provide validate_base here */ /* It doesn't make sense not to provide validate_base here */
@ -387,8 +387,8 @@ static void pe_locate_sections(
n_section_table, n_section_table,
hwid_section_names, hwid_section_names,
validate_base, validate_base,
/* device_table= */ NULL, /* device_table = */ NULL,
/* device= */ NULL, /* device = */ NULL,
hwids_section); hwids_section);
if (PE_SECTION_VECTOR_IS_SET(hwids_section)) { if (PE_SECTION_VECTOR_IS_SET(hwids_section)) {

View File

@ -166,7 +166,7 @@ EFI_STATUS secure_boot_enroll_at(EFI_FILE *root_dir, const char16_t *path, bool
} }
if (need_custom_mode && !custom_mode_enabled()) { if (need_custom_mode && !custom_mode_enabled()) {
err = set_custom_mode(/* enable= */ true); err = set_custom_mode(/* enable = */ true);
if (err != EFI_SUCCESS) { if (err != EFI_SUCCESS) {
log_error_status(err, "Failed to enable custom mode: %m"); log_error_status(err, "Failed to enable custom mode: %m");
goto out_deallocate; goto out_deallocate;

View File

@ -69,7 +69,7 @@ static EFI_STATUS bmp_parse_header(
if (file->size < file->offset) if (file->size < file->offset)
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
/* check device-independent bitmap */ /* check device-independent bitmap */
struct bmp_dib *dib = (struct bmp_dib *) (bmp + sizeof(struct bmp_file)); struct bmp_dib *dib = (struct bmp_dib *) (bmp + sizeof(struct bmp_file));
if (dib->size < SIZEOF_BMP_DIB) if (dib->size < SIZEOF_BMP_DIB)
return EFI_UNSUPPORTED; return EFI_UNSUPPORTED;

View File

@ -377,7 +377,7 @@ static int update_efi_boot_binaries(
if (!dest_path) if (!dest_path)
return log_oom(); return log_oom();
r = copy_file_with_version_check(source_path, dest_path, /* force= */ false); r = copy_file_with_version_check(source_path, dest_path, /* force = */ false);
if (IN_SET(r, -ESTALE, -ESRCH)) if (IN_SET(r, -ESTALE, -ESRCH))
continue; continue;
RET_GATHER(ret, r); RET_GATHER(ret, r);
@ -607,7 +607,7 @@ static int efi_timestamp(EFI_TIME *ret) {
if (r != -ENXIO) if (r != -ENXIO)
log_debug_errno(r, "Failed to parse $SOURCE_DATE_EPOCH, ignoring: %m"); log_debug_errno(r, "Failed to parse $SOURCE_DATE_EPOCH, ignoring: %m");
r = localtime_or_gmtime_usec(epoch != UINT64_MAX ? epoch : now(CLOCK_REALTIME), /* utc= */ true, &tm); r = localtime_or_gmtime_usec(epoch != UINT64_MAX ? epoch : now(CLOCK_REALTIME), /*utc=*/ true, &tm);
if (r < 0) if (r < 0)
return log_error_errno(r, "Failed to convert timestamp to calendar time: %m"); return log_error_errno(r, "Failed to convert timestamp to calendar time: %m");
@ -700,7 +700,7 @@ static int install_secure_boot_auto_enroll(const char *esp, X509 *certificate, E
return log_error_errno(SYNTHETIC_ERRNO(EIO), "Failed to write signature list to bio"); return log_error_errno(SYNTHETIC_ERRNO(EIO), "Failed to write signature list to bio");
_cleanup_(PKCS7_freep) PKCS7 *p7 = NULL; _cleanup_(PKCS7_freep) PKCS7 *p7 = NULL;
p7 = PKCS7_sign(certificate, private_key, /* certs= */ NULL, bio, PKCS7_DETACHED|PKCS7_NOATTR|PKCS7_BINARY|PKCS7_NOSMIMECAP); p7 = PKCS7_sign(certificate, private_key, /*certs=*/ NULL, bio, PKCS7_DETACHED|PKCS7_NOATTR|PKCS7_BINARY|PKCS7_NOSMIMECAP);
if (!p7) if (!p7)
return log_error_errno(SYNTHETIC_ERRNO(EIO), "Failed to calculate PKCS7 signature: %s", return log_error_errno(SYNTHETIC_ERRNO(EIO), "Failed to calculate PKCS7 signature: %s",
ERR_error_string(ERR_get_error(), NULL)); ERR_error_string(ERR_get_error(), NULL));
@ -979,7 +979,7 @@ static int load_secure_boot_auto_enroll(
} }
if (arg_certificate_source_type == OPENSSL_CERTIFICATE_SOURCE_FILE) { if (arg_certificate_source_type == OPENSSL_CERTIFICATE_SOURCE_FILE) {
r = parse_path_argument(arg_certificate, /* suppress_root= */ false, &arg_certificate); r = parse_path_argument(arg_certificate, /*suppress_root=*/ false, &arg_certificate);
if (r < 0) if (r < 0)
return r; return r;
} }

View File

@ -68,7 +68,7 @@ int vl_method_set_reboot_to_firmware(sd_varlink *link, sd_json_variant *paramete
int vl_method_get_reboot_to_firmware(sd_varlink *link, sd_json_variant *parameters, sd_varlink_method_flags_t flags, void *userdata) { int vl_method_get_reboot_to_firmware(sd_varlink *link, sd_json_variant *parameters, sd_varlink_method_flags_t flags, void *userdata) {
int r; int r;
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) if (r != 0)
return r; return r;

View File

@ -940,7 +940,7 @@ int vl_method_list_boot_entries(sd_varlink *link, sd_json_variant *parameters, s
assert(link); assert(link);
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) if (r != 0)
return r; return r;
@ -952,7 +952,7 @@ int vl_method_list_boot_entries(sd_varlink *link, sd_json_variant *parameters, s
/* ret_part= */ NULL, /* ret_part= */ NULL,
/* ret_pstart= */ NULL, /* ret_pstart= */ NULL,
/* ret_psize= */ NULL, /* ret_psize= */ NULL,
/* ret_uuid= */ NULL, /* ret_uuid=*/ NULL,
&esp_devid); &esp_devid);
if (r == -EACCES) /* We really need the ESP path for this call, hence also log about access errors */ if (r == -EACCES) /* We really need the ESP path for this call, hence also log about access errors */
return log_error_errno(r, "Failed to determine ESP location: %m"); return log_error_errno(r, "Failed to determine ESP location: %m");

View File

@ -126,7 +126,7 @@ int settle_entry_token(void) {
arg_root, arg_root,
secure_getenv("KERNEL_INSTALL_CONF_ROOT"), secure_getenv("KERNEL_INSTALL_CONF_ROOT"),
arg_machine_id, arg_machine_id,
/* machine_id_is_random= */ false, /* machine_id_is_random = */ false,
&arg_entry_token_type, &arg_entry_token_type,
&arg_entry_token); &arg_entry_token);
if (r < 0) if (r < 0)

View File

@ -1166,7 +1166,7 @@ static int introspect(int argc, char **argv, void *userdata) {
TABLE_SET_COLOR, ansi_highlight()); TABLE_SET_COLOR, ansi_highlight());
else else
r = table_add_cell_stringf( r = table_add_cell_stringf(
table, /* ret_cell= */ NULL, ".%s", m->name); table, /* ret_cell = */ NULL, ".%s", m->name);
if (r < 0) if (r < 0)
return table_log_add_error(r); return table_log_add_error(r);
@ -1725,7 +1725,7 @@ static int bus_message_dump(sd_bus_message *m, uint64_t flags) {
return log_error_errno(r, "Failed to rewind: %m"); return log_error_errno(r, "Failed to rewind: %m");
if (FLAGS_SET(flags, SD_BUS_MESSAGE_DUMP_SUBTREE_ONLY)) { if (FLAGS_SET(flags, SD_BUS_MESSAGE_DUMP_SUBTREE_ONLY)) {
r = sd_bus_message_peek_type(m, /* ret_type= */ NULL, &contents); r = sd_bus_message_peek_type(m, /* ret_type = */ NULL, &contents);
if (r < 0) if (r < 0)
return bus_log_parse_error(r); return bus_log_parse_error(r);
@ -1765,7 +1765,7 @@ static int bus_message_dump(sd_bus_message *m, uint64_t flags) {
fputs(FLAGS_SET(flags, SD_BUS_MESSAGE_DUMP_SUBTREE_ONLY) ? contents : sd_bus_message_get_signature(m, true), stdout); fputs(FLAGS_SET(flags, SD_BUS_MESSAGE_DUMP_SUBTREE_ONLY) ? contents : sd_bus_message_get_signature(m, true), stdout);
fputc(' ', stdout); fputc(' ', stdout);
r = format_cmdline(m, stdout, /* needs_space= */ false); r = format_cmdline(m, stdout, /* needs_space = */ false);
if (r < 0) if (r < 0)
return bus_log_parse_error(r); return bus_log_parse_error(r);
@ -1845,7 +1845,7 @@ static int call(int argc, char **argv, void *userdata) {
return log_error_errno(r, "Call failed: %s", bus_error_message(&error, r)); return log_error_errno(r, "Call failed: %s", bus_error_message(&error, r));
} }
return bus_message_dump(reply, /* flags= */ 0); return bus_message_dump(reply, /* flags = */ 0);
} }
static int emit_signal(int argc, char **argv, void *userdata) { static int emit_signal(int argc, char **argv, void *userdata) {
@ -1932,7 +1932,7 @@ static int get_property(int argc, char **argv, void *userdata) {
static int on_bus_signal(sd_bus_message *msg, void *userdata, sd_bus_error *ret_error) { static int on_bus_signal(sd_bus_message *msg, void *userdata, sd_bus_error *ret_error) {
return sd_event_exit(sd_bus_get_event(sd_bus_message_get_bus(ASSERT_PTR(msg))), return sd_event_exit(sd_bus_get_event(sd_bus_message_get_bus(ASSERT_PTR(msg))),
bus_message_dump(msg, /* flags= */ 0)); bus_message_dump(msg, /* flags = */ 0));
} }
static int wait_signal(int argc, char **argv, void *userdata) { static int wait_signal(int argc, char **argv, void *userdata) {

View File

@ -908,7 +908,7 @@ static int loop(const char *root) {
if (t >= usec_add(last_refresh, arg_delay) || immediate_refresh) { if (t >= usec_add(last_refresh, arg_delay) || immediate_refresh) {
r = refresh(root, a, b, iteration++, /* depth= */ 0, /* ret= */ NULL); r = refresh(root, a, b, iteration++, /* depth = */ 0, /* ret = */ NULL);
if (r < 0) if (r < 0)
return log_error_errno(r, "Failed to refresh: %m"); return log_error_errno(r, "Failed to refresh: %m");

View File

@ -262,7 +262,7 @@ static void automount_set_state(Automount *a, AutomountState state) {
if (state != old_state) if (state != old_state)
log_unit_debug(UNIT(a), "Changed %s -> %s", automount_state_to_string(old_state), automount_state_to_string(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) { static int automount_coldplug(Unit *u) {
@ -781,7 +781,7 @@ static void automount_enter_running(Automount *a) {
goto fail; 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) { if (r < 0) {
log_unit_warning(UNIT(a), "Failed to queue mount startup job: %s", bus_error_message(&error, r)); log_unit_warning(UNIT(a), "Failed to queue mount startup job: %s", bus_error_message(&error, r));
goto fail; goto fail;
@ -997,7 +997,7 @@ static int automount_dispatch_io(sd_event_source *s, int fd, uint32_t events, vo
goto fail; 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) { if (r < 0) {
log_unit_warning(UNIT(a), "Failed to queue unmount job: %s", bus_error_message(&error, r)); log_unit_warning(UNIT(a), "Failed to queue unmount job: %s", bus_error_message(&error, r));
goto fail; goto fail;

View File

@ -236,7 +236,7 @@ int bpf_devices_apply_policy(
if (r < 0) if (r < 0)
return log_error_errno(r, "Extending device control BPF program failed: %m"); 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) if (r < 0)
return log_error_errno(r, "Failed to determine cgroup path: %m"); return log_error_errno(r, "Failed to determine cgroup path: %m");

View File

@ -696,7 +696,7 @@ int bpf_firewall_install(Unit *u) {
return log_unit_debug_errno(u, SYNTHETIC_ERRNO(EOPNOTSUPP), return log_unit_debug_errno(u, SYNTHETIC_ERRNO(EOPNOTSUPP),
"bpf-firewall: BPF firewalling not supported, proceeding without."); "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) if (r < 0)
return log_unit_error_errno(u, r, "bpf-firewall: Failed to determine cgroup path: %m"); return log_unit_error_errno(u, r, "bpf-firewall: Failed to determine cgroup path: %m");

View File

@ -151,7 +151,7 @@ int bpf_foreign_install(Unit *u) {
if (!crt) if (!crt)
return 0; 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) if (r < 0)
return log_unit_error_errno(u, r, "bpf-foreign: Failed to get cgroup path: %m"); return log_unit_error_errno(u, r, "bpf-foreign: Failed to get cgroup path: %m");

View File

@ -207,7 +207,7 @@ int bpf_restrict_fs_cleanup(Unit *u) {
assert(u->manager); assert(u->manager);
/* If we never successfully detected support, there is nothing to clean up. */ /* 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; return 0;
if (!u->manager->restrict_fs) if (!u->manager->restrict_fs)

View File

@ -115,7 +115,7 @@ static int restrict_ifaces_install_impl(Unit *u) {
if (!crt) if (!crt)
return 0; 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) if (r < 0)
return log_unit_error_errno(u, r, "restrict-interfaces: Failed to get cgroup path: %m"); return log_unit_error_errno(u, r, "restrict-interfaces: Failed to get cgroup path: %m");

View File

@ -128,7 +128,7 @@ int bpf_socket_bind_supported(void) {
if (dlopen_bpf_full(LOG_WARNING) < 0) if (dlopen_bpf_full(LOG_WARNING) < 0)
return false; 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) { if (r < 0) {
log_debug_errno(r, "bpf-socket-bind: socket bind filtering is not supported: %m"); log_debug_errno(r, "bpf-socket-bind: socket bind filtering is not supported: %m");
return false; return false;
@ -179,7 +179,7 @@ static int socket_bind_install_impl(Unit *u) {
if (!crt) if (!crt)
return 0; 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) if (r < 0)
return log_unit_error_errno(u, r, "bpf-socket-bind: Failed to get cgroup path: %m"); return log_unit_error_errno(u, r, "bpf-socket-bind: Failed to get cgroup path: %m");

View File

@ -1609,7 +1609,7 @@ static void cgroup_context_apply(
if (apply_mask & CGROUP_MASK_BPF_RESTRICT_NETWORK_INTERFACES) if (apply_mask & CGROUP_MASK_BPF_RESTRICT_NETWORK_INTERFACES)
cgroup_apply_restrict_network_interfaces(u); 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) { 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)) if (crt && streq_ptr(crt->cgroup_path, path))
return 0; return 0;
unit_release_cgroup(u, /* drop_cgroup_runtime= */ true); unit_release_cgroup(u, /* drop_cgroup_runtime = */ true);
crt = unit_setup_cgroup_runtime(u); crt = unit_setup_cgroup_runtime(u);
if (!crt) if (!crt)
@ -2101,7 +2101,7 @@ static int unit_update_cgroup(
CGroupRuntime *crt = ASSERT_PTR(unit_get_cgroup_runtime(u)); CGroupRuntime *crt = ASSERT_PTR(unit_get_cgroup_runtime(u));
uint64_t cgroup_id = 0; 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) { if (r == 0) {
r = cg_path_get_cgroupid(cgroup_full_path, &cgroup_id); r = cg_path_get_cgroupid(cgroup_full_path, &cgroup_id);
if (r < 0) 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 /* 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 * we should keep, especially CPU usage and *_peak ones which would be shown even after
* the unit stops. */ * the unit stops. */
unit_release_cgroup(u, /* drop_cgroup_runtime= */ false); unit_release_cgroup(u, /* drop_cgroup_runtime = */ false);
return true; return true;
} }
@ -2793,13 +2793,13 @@ void unit_prune_cgroup(Unit *u) {
return; return;
/* Cache the last resource usage values before we destroy the cgroup */ /* 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++) 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 */ /* 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 */ /* 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 */ (void) bpf_restrict_fs_cleanup(u); /* Remove cgroup from the global LSM BPF map */
#endif #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); 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. */ /* 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); 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) { if (r >= 0) {
/* Also, move all other userspace processes remaining in the root cgroup into that scope. */ /* Also, move all other userspace processes remaining in the root cgroup into that scope. */
r = cg_migrate(m->cgroup_root, scope_path, 0); r = cg_migrate(m->cgroup_root, scope_path, 0);
@ -4169,8 +4169,8 @@ CGroupRuntime* cgroup_runtime_new(void) {
.deserialized_cgroup_realized = -1, .deserialized_cgroup_realized = -1,
}; };
unit_reset_cpu_accounting(/* unit= */ NULL, crt); unit_reset_cpu_accounting(/* unit = */ NULL, crt);
unit_reset_io_accounting(/* unit= */ NULL, crt); unit_reset_io_accounting(/* unit = */ NULL, crt);
cgroup_runtime_reset_memory_accounting_last(crt); cgroup_runtime_reset_memory_accounting_last(crt);
assert_se(cgroup_runtime_reset_ip_accounting(crt) >= 0); assert_se(cgroup_runtime_reset_ip_accounting(crt) >= 0);

View File

@ -605,12 +605,12 @@ static int property_get_log_filter_patterns(
return r; return r;
r = sd_bus_message_append_log_filter_patterns(reply, c->log_filter_allowed_patterns, r = sd_bus_message_append_log_filter_patterns(reply, c->log_filter_allowed_patterns,
/* is_allowlist= */ true); /* is_allowlist = */ true);
if (r < 0) if (r < 0)
return r; return r;
r = sd_bus_message_append_log_filter_patterns(reply, c->log_filter_denied_patterns, r = sd_bus_message_append_log_filter_patterns(reply, c->log_filter_denied_patterns,
/* is_allowlist= */ false); /* is_allowlist = */ false);
if (r < 0) if (r < 0)
return r; return r;
@ -2248,7 +2248,7 @@ int bus_exec_context_set_transient_property(
if (r < 0) if (r < 0)
return r; 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); 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); ProtectHostname t = protect_hostname_from_string(s);

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) { 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) { 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) { 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) { 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) { 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) { 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) { 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 { 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) 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 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) { 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 /* 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. */ * 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) { 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 /* 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. */ * 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) { 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) { 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 /* 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) */ * 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) { 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) { 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 /* 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. */ * 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) { 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 /* 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 * insist on the unit being loaded either (because even improperly loaded units might still have
* processes around). */ * 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) { 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) if (r < 0)
return r; 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) if (r < 0)
return r; 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 * 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 * 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. */ * 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) if (r < 0)
goto ratelimited; 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) if (r < 0)
goto ratelimited; goto ratelimited;
if (r == 0) if (r == 0)
@ -2180,7 +2180,7 @@ static int list_unit_files_by_patterns(sd_bus_message *message, void *userdata,
if (r < 0) if (r < 0)
return r; 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) if (r < 0)
return r; 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) { 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) { 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) { 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) { 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) { 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) { 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) { 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) { 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) { 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) { 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) { 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) { 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) { static int method_revert_unit_files(sd_bus_message *message, void *userdata, sd_bus_error *reterr_error) {

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 * We'll see ENODEV when trying to enumerate processes and the cgroup is removed at the same
* time. Handle this gracefully. */ * 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)) if (IN_SET(r, 0, -EOPNOTSUPP, -ENODEV))
break; break;
if (r < 0) if (r < 0)
@ -2005,7 +2005,7 @@ int bus_unit_queue_job_one(
return -ENOMEM; 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) if (r < 0)
return r; return r;

View File

@ -128,7 +128,7 @@ static int signal_activation_request(sd_bus_message *message, void *userdata, sd
goto failed; 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) if (r < 0)
goto failed; goto failed;

View File

@ -177,7 +177,7 @@ static void device_set_state(Device *d, DeviceState state) {
if (state != old_state) if (state != old_state)
log_unit_debug(UNIT(d), "Changed %s -> %s", device_state_to_string(old_state), device_state_to_string(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) { 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. /* Note, even if the device is being processed by udevd, setup the unit on enumerate.
* See also the comments in device_catchup(). */ * 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 */ /* 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 * To achieve that, they set the path to SYSTEMD_ALIAS. Hence, we cannot refuse aliases start
* with /dev/, unfortunately. */ * 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); 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, /* 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 * 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.) */ * 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) if (r < 0)
return r; return r;
/* Add an additional unit for the device node */ /* Add an additional unit for the device node */
if (sd_device_get_devname(dev, &devname) >= 0) 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 { } else {
Unit *u; Unit *u;
@ -1272,7 +1272,7 @@ void device_found_node(Manager *m, const char *node, DeviceFound found, DeviceFo
return; 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 */ /* Update the device unit's state, should it exist */

View File

@ -536,7 +536,7 @@ static int load_credential_glob(
if (!j) if (!j)
return -ENOMEM; return -ENOMEM;
r = safe_glob(j, /* flags= */ 0, &paths); r = safe_glob(j, /* flags = */ 0, &paths);
if (r == -ENOENT) if (r == -ENOENT)
continue; continue;
if (r < 0) 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"); return log_debug_errno(dfd, "Failed to create workspace for credentials: %m");
workspace_rm = workspace; 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) if (r < 0)
return r; 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 /* rename() requires both the source and target to be writable, hence lock down write permission
* as last step. */ * 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) if (r < 0)
return log_debug_errno(r, "Failed to adjust ACLs of credentials dir: %m"); 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)) { if (!FLAGS_SET(params->flags, EXEC_SETUP_CREDENTIALS_FRESH)) {
/* We may reuse the previous credential dir */ /* 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) if (r < 0)
return r; return r;
if (r == 0) { if (r == 0) {
@ -1042,13 +1042,13 @@ static int setup_credentials_internal(
if (dfd < 0) if (dfd < 0)
return dfd; 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) if (r < 0)
return r; 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) if (r < 0)
return log_debug_errno(r, "Failed to adjust ACLs of credentials dir: %m"); return log_debug_errno(r, "Failed to adjust ACLs of credentials dir: %m");

View File

@ -915,7 +915,7 @@ static int get_fixed_group(
assert(group_or_gid); assert(group_or_gid);
assert(ret_groupname); 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) if (r < 0)
return r; return r;
@ -993,7 +993,7 @@ static int get_supplementary_groups(
return -E2BIG; return -E2BIG;
const char *g = *i; 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) if (r < 0)
return r; return r;
@ -2114,7 +2114,7 @@ static int build_environment(
if (!username && !c->dynamic_user && p->runtime_scope == RUNTIME_SCOPE_SYSTEM) { if (!username && !c->dynamic_user && p->runtime_scope == RUNTIME_SCOPE_SYSTEM) {
assert(!c->user); 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) { if (r < 0) {
log_debug_errno(r, "Failed to determine credentials for user root: %s", log_debug_errno(r, "Failed to determine credentials for user root: %s",
STRERROR_USER(r)); STRERROR_USER(r));
@ -2347,28 +2347,28 @@ static int bpffs_helper(const ExecContext *c, int socket_fd) {
assert(c); assert(c);
assert(socket_fd >= 0); 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) if (fs_fd < 0)
return log_debug_errno(fs_fd, "Failed to receive file descriptor from parent: %m"); 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]; char number[STRLEN("0x") + sizeof(c->bpf_delegate_commands) * 2 + 1];
xsprintf(number, "0x%"PRIx64, c->bpf_delegate_commands); 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"); return log_debug_errno(errno, "Failed to FSCONFIG_SET_STRING: %m");
xsprintf(number, "0x%"PRIx64, c->bpf_delegate_maps); 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"); return log_debug_errno(errno, "Failed to FSCONFIG_SET_STRING: %m");
xsprintf(number, "0x%"PRIx64, c->bpf_delegate_programs); 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"); return log_debug_errno(errno, "Failed to FSCONFIG_SET_STRING: %m");
xsprintf(number, "0x%"PRIx64, c->bpf_delegate_attachments); 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"); 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 log_debug_errno(errno, "Failed to create bpffs superblock: %m");
return 0; return 0;
@ -2604,7 +2604,7 @@ static int can_mount_proc(void) {
if (n != 0) /* on success we should have read 0 bytes */ if (n != 0) /* on success we should have read 0 bytes */
return -EIO; return -EIO;
r = wait_for_terminate_and_check("(sd-proc-check)", TAKE_PID(pid), /* flags= */ 0); r = wait_for_terminate_and_check("(sd-proc-check)", TAKE_PID(pid), 0 /* flags= */);
if (r < 0) if (r < 0)
return log_debug_errno(r, "Failed to wait for (sd-proc-check) child process to terminate: %m"); 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 */ 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, p->pidref_transport_fd,
pidref.fd, pidref.fd,
&IOVEC_MAKE(&pidref.pid, sizeof(pidref.pid)), &IOVEC_MAKE(&pidref.pid, sizeof(pidref.pid)),
/* iovlen= */ 1, /*iovlen=*/ 1,
/* flags= */ 0); /*flags=*/ 0);
/* Send error code to child process. */ /* Send error code to child process. */
(void) write(errno_pipe[1], &q, sizeof(q)); (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 /* 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; return -errno;
uint32_t xattr_flags = 0; 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) if (r < 0)
return r; return r;
/* Refuse if parent has FS_XFLAG_PROJINHERIT since this will mean the total number of blocks will not /* 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 */ /* Get the project ID of the current directory */
uint32_t proj_id; 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)) { 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); log_debug_errno(r, "Not applying storage quotas. FS_IOC_FSGETXATTR not supported for %s: %m", target_dir);
return 0; return 0;
@ -4988,7 +4988,7 @@ static int setup_term_environment(const ExecContext *context, char ***env) {
if (!key) if (!key)
return -ENOMEM; return -ENOMEM;
r = proc_cmdline_get_key(key, /* flags= */ 0, &cmdline); r = proc_cmdline_get_key(key, /* flags = */ 0, &cmdline);
if (r > 0) if (r > 0)
return strv_env_assign(env, "TERM", cmdline); return strv_env_assign(env, "TERM", cmdline);
if (r < 0) 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 * or PAM shall be invoked, let's consult NSS even for root, so that the user
* gets accurate $SHELL in session(-like) contexts. */ * gets accurate $SHELL in session(-like) contexts. */
r = get_fixed_user(u, 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); &username, &uid, &gid, &pwent_home, &shell);
if (r < 0) { if (r < 0) {
*exit_status = EXIT_USER; *exit_status = EXIT_USER;

View File

@ -3701,7 +3701,7 @@ static int exec_context_deserialize(ExecContext *c, FILE *f) {
_cleanup_free_ void *d = NULL; _cleanup_free_ void *d = NULL;
size_t size; 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) if (r < 0)
return r; return r;

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 */ /* 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 (r < 0) {
if (ignore) if (ignore)
continue; continue;
@ -2260,7 +2260,7 @@ int exec_command_append(ExecCommand *c, const char *path, ...) {
if (!l) if (!l)
return -ENOMEM; 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) if (r < 0)
return r; return r;

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 */ /* Optionally base64 decode the data, if requested, to allow binary credentials */
if (unbase64) { 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) { if (r < 0) {
log_warning_errno(r, "Failed to base64 decode credential '%s', ignoring: %m", cn); log_warning_errno(r, "Failed to base64 decode credential '%s', ignoring: %m", cn);
continue; continue;

View File

@ -406,13 +406,13 @@ void job_dump(Job *j, FILE *f, const char *prefix) {
* be merged with C either. * be merged with C either.
*/ */
static const JobType job_merging_table[] = { 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_START */
/* JOB_VERIFY_ACTIVE */ JOB_START, /*JOB_VERIFY_ACTIVE */ JOB_START,
/* JOB_STOP */ -1, -1, /*JOB_STOP */ -1, -1,
/* JOB_RELOAD */ JOB_RELOAD_OR_START, JOB_RELOAD, -1, /*JOB_RELOAD */ JOB_RELOAD_OR_START, JOB_RELOAD, -1,
/* JOB_RESTART */ JOB_RESTART, JOB_RESTART, -1, JOB_RESTART, /*JOB_RESTART */ JOB_RESTART, JOB_RESTART, -1, JOB_RESTART,
}; };
JobType job_type_lookup_merge(JobType a, JobType b) { JobType job_type_lookup_merge(JobType a, JobType b) {

View File

@ -126,11 +126,11 @@ int unit_load_dropin(Unit *u) {
return r; return r;
/* Load .conf dropins */ /* 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) if (r <= 0)
return 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) if (r < 0)
return log_oom(); return log_oom();

View File

@ -1015,7 +1015,7 @@ int config_parse_exec(
/* Check explicitly for an unquoted semicolon as command separator token. */ /* Check explicitly for an unquoted semicolon as command separator token. */
if (p[0] == ';' && (!p[1] || strchr(WHITESPACE, p[1]))) { if (p[0] == ';' && (!p[1] || strchr(WHITESPACE, p[1]))) {
p++; p++;
p = skip_leading_chars(p, /* bad= */ NULL); p = skip_leading_chars(p, /* bad = */ NULL);
semicolon = true; semicolon = true;
break; break;
} }
@ -1024,7 +1024,7 @@ int config_parse_exec(
* extract_first_word() would return the same for all of those. */ * extract_first_word() would return the same for all of those. */
if (p[0] == '\\' && p[1] == ';' && (!p[2] || strchr(WHITESPACE, p[2]))) { if (p[0] == '\\' && p[1] == ';' && (!p[2] || strchr(WHITESPACE, p[2]))) {
p += 2; p += 2;
p = skip_leading_chars(p, /* bad= */ NULL); p = skip_leading_chars(p, /* bad = */ NULL);
if (strv_extend(&args, ";") < 0) if (strv_extend(&args, ";") < 0)
return log_oom(); return log_oom();
@ -2817,7 +2817,7 @@ int config_parse_pass_environ(
return log_oom(); 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) if (r < 0)
return log_oom(); return log_oom();
@ -2886,7 +2886,7 @@ int config_parse_unset_environ(
return log_oom(); 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) if (r < 0)
return log_oom(); return log_oom();
@ -4678,7 +4678,7 @@ int config_parse_set_credential(
size_t size; size_t size;
if (encrypted) { 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) if (r == -ENOMEM)
return log_oom(); return log_oom();
if (r < 0) { if (r < 0) {
@ -6631,7 +6631,7 @@ int config_parse_protect_hostname(
return 0; 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, return log_syntax(unit, LOG_WARNING, filename, line, 0,
"Invalid hostname is specified to %s=, ignoring: %s", lvalue, h); "Invalid hostname is specified to %s=, ignoring: %s", lvalue, h);

View File

@ -841,7 +841,7 @@ static int parse_config_file(void) {
(const char* const*) files, (const char* const*) files,
(const char* const*) dirs, (const char* const*) dirs,
"user.conf.d", "user.conf.d",
/* root= */ NULL, /* root = */ NULL,
"Manager\0", "Manager\0",
config_item_table_lookup, items, config_item_table_lookup, items,
CONFIG_PARSE_WARN, 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 /* 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. */ * have it and we're not using pretty_name. */
status_printf(ANSI_HIGHLIGHT_RED " !! " ANSI_NORMAL, 0, 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. /* 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. */ * Otherwise the system might end up in a completely undebuggable state afterwards. */
if (switch_root_init) { 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) if (r < 0)
log_warning_errno(r, "Failed to chase configured init %s/%s: %m", log_warning_errno(r, "Failed to chase configured init %s/%s: %m",
switch_root_dir, switch_root_init); switch_root_dir, switch_root_init);
} else { } 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) if (r < 0)
log_debug_errno(r, "Failed to chase our own binary %s/%s: %m", log_debug_errno(r, "Failed to chase our own binary %s/%s: %m",
switch_root_dir, SYSTEMD_BINARY_PATH); switch_root_dir, SYSTEMD_BINARY_PATH);
} }
if (r < 0) { 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) { if (r < 0) {
*ret_error_message = "Switch root target contains no usable init"; *ret_error_message = "Switch root target contains no usable init";
return log_error_errno(r, "Failed to chase %s/sbin/init", switch_root_dir); 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 /* 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. */ * 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) if (r < 0)
log_debug_errno(r, "Failed to parse systemd.condition_first_boot= kernel command line argument, ignoring: %m"); 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) { if (!skip_setup) {
/* Check that /usr/ is either on the same file system as / or mounted already. */ /* 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"; *ret_error_message = "Refusing to run in unsupported environment where /usr/ is not populated";
return -ENOEXEC; return -ENOEXEC;
} }
@ -2458,11 +2458,11 @@ static int initialize_runtime(
(void) import_credentials(); (void) import_credentials();
(void) os_release_status(); (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) | (first_boot ? MACHINE_ID_SETUP_FORCE_TRANSIENT : 0) |
(arg_machine_id_from_firmware ? MACHINE_ID_SETUP_FORCE_FIRMWARE : 0), (arg_machine_id_from_firmware ? MACHINE_ID_SETUP_FORCE_FIRMWARE : 0),
/* ret= */ NULL); /* ret = */ NULL);
(void) hostname_setup(/* really= */ true); (void) hostname_setup(/* really = */ true);
(void) loopback_setup(); (void) loopback_setup();
bump_unix_max_dgram_qlen(); bump_unix_max_dgram_qlen();

View File

@ -1005,7 +1005,7 @@ int manager_new(RuntimeScope runtime_scope, ManagerTestRunFlags test_run_flags,
return r; return r;
#if HAVE_LIBBPF #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); r = bpf_restrict_fs_setup(m);
if (r < 0) if (r < 0)
log_warning_errno(r, "Failed to setup LSM BPF, ignoring: %m"); 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 */ /* 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) if (r < 0)
log_unit_warning_errno(u, r, "Failed to enqueue stop job, ignoring: %s", bus_error_message(&error, r)); 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; 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) if (r < 0)
log_unit_warning_errno(u, r, "Failed to enqueue start job, ignoring: %s", bus_error_message(&error, r)); 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; 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) if (r < 0)
log_unit_warning_errno(u, r, "Failed to enqueue stop job, ignoring: %s", bus_error_message(&error, r)); 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); CLEANUP_ARRAY(changes, n_changes, install_changes_free);
log_info("Applying preset policy."); log_info("Applying preset policy.");
r = unit_file_preset_all(RUNTIME_SCOPE_SYSTEM, /* file_flags= */ 0, r = unit_file_preset_all(RUNTIME_SCOPE_SYSTEM, /* file_flags = */ 0,
/* root_dir= */ NULL, mode, &changes, &n_changes); /* root_dir = */ NULL, mode, &changes, &n_changes);
install_changes_dump(r, "preset", changes, n_changes, /* quiet= */ false); install_changes_dump(r, "preset", changes, n_changes, /* quiet = */ false);
if (r < 0) if (r < 0)
log_full_errno(r == -EEXIST ? LOG_NOTICE : LOG_WARNING, r, log_full_errno(r == -EEXIST ? LOG_NOTICE : LOG_WARNING, r,
"Failed to populate /etc with preset unit settings, ignoring: %m"); "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; return r;
assert(unit); 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) { 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); assert(m);
/* Let whoever invoked us know that we are now reloading */ /* 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 */ /* And ensure that we'll send READY=1 again as soon as we are ready again */
m->ready_sent = false; m->ready_sent = false;

View File

@ -665,7 +665,7 @@ static int mount_load(Unit *u) {
bool from_kernel = m->from_proc_self_mountinfo || u->perpetual; 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 /* 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 * 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; break;
case MOUNT_MOUNTED: case MOUNT_MOUNTED:
assert(!pidref_is_set(&m->control_pid)); 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; break;
default: default:
; ;
@ -897,13 +897,13 @@ static void mount_enter_dead(Mount *m, MountResult f, bool flush_result) {
m->result = f; m->result = f;
unit_log_result(UNIT(m), m->result == MOUNT_SUCCESS, mount_result_to_string(m->result)); 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); mount_set_state(m, m->result != MOUNT_SUCCESS ? MOUNT_FAILED : MOUNT_DEAD);
m->exec_runtime = exec_runtime_destroy(m->exec_runtime); 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); 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 * Note that this effectively means fresh creds are used during remount, but that's mostly what
* users would expect anyways. */ * 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); 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) else if (state == MOUNT_UNMOUNTING_SIGTERM && m->kill_context.send_sigkill)
mount_enter_signal(m, MOUNT_UNMOUNTING_SIGKILL, MOUNT_SUCCESS); mount_enter_signal(m, MOUNT_UNMOUNTING_SIGKILL, MOUNT_SUCCESS);
else else
mount_enter_dead_or_mounted(m, MOUNT_SUCCESS, /* flush_result= */ false); mount_enter_dead_or_mounted(m, MOUNT_SUCCESS, /* flush_result = */ false);
return; return;
fail: 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) { static int mount_set_umount_command(Mount *m, ExecCommand *c) {
@ -1058,7 +1058,7 @@ static void mount_enter_unmounting(Mount *m) {
return; return;
fail: 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) { 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; bool source_is_dir = true;
if (mount_is_bind(p)) { if (mount_is_bind(p)) {
r = is_dir(p->what, /* follow= */ true); r = is_dir(p->what, /* follow = */ true);
if (r < 0 && r != -ENOENT) 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); log_unit_info_errno(UNIT(m), r, "Failed to determine type of bind mount source '%s', ignoring: %m", p->what);
else if (r == 0) else if (r == 0)
@ -1248,12 +1248,12 @@ static void mount_enter_mounting(Mount *m) {
} }
mount_unwatch_control_pid(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_id = MOUNT_EXEC_MOUNT;
m->control_command = m->exec_command + 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) { if (r < 0) {
log_unit_error_errno(UNIT(m), r, "Failed to prepare mount command line: %m"); log_unit_error_errno(UNIT(m), r, "Failed to prepare mount command line: %m");
goto fail; goto fail;
@ -1269,7 +1269,7 @@ static void mount_enter_mounting(Mount *m) {
return; return;
fail: 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) { 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_id = MOUNT_EXEC_REMOUNT;
m->control_command = m->exec_command + 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) { if (r < 0) {
log_unit_error_errno(UNIT(m), r, "Failed to prepare remount command line: %m"); log_unit_error_errno(UNIT(m), r, "Failed to prepare remount command line: %m");
goto fail; goto fail;
@ -1317,7 +1317,7 @@ static void mount_enter_remounting(Mount *m) {
fail: fail:
mount_set_reload_result(m, MOUNT_FAILURE_RESOURCES); 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) { 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."); log_unit_warning(UNIT(m), "Mount process finished, but there is no mount.");
f = MOUNT_FAILURE_PROTOCOL; f = MOUNT_FAILURE_PROTOCOL;
} }
mount_enter_dead(m, f, /* flush_result= */ false); mount_enter_dead(m, f, /* flush_result = */ false);
break; break;
case MOUNT_MOUNTING_DONE: 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:
case MOUNT_REMOUNTING_SIGTERM: case MOUNT_REMOUNTING_SIGTERM:
case MOUNT_REMOUNTING_SIGKILL: 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; break;
case MOUNT_UNMOUNTING: 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? /* Hmm, umount process spawned by us failed, but the mount disappeared anyway?
* Maybe someone else is trying to unmount at the same time. */ * Maybe someone else is trying to unmount at the same time. */
log_unit_notice(u, "Mount disappeared even though umount process failed, continuing."); 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 } else
/* At this point, either the unmount succeeded or unexpected error occurred. We usually /* 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 * 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 * 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 * attempt. IOW, if we eventually managed to unmount the stuff, don't enter failed
* end state. */ * end state. */
mount_enter_dead_or_mounted(m, f, /* flush_result= */ true); mount_enter_dead_or_mounted(m, f, /* flush_result = */ true);
break; break;
case MOUNT_UNMOUNTING_SIGTERM: case MOUNT_UNMOUNTING_SIGTERM:
case MOUNT_UNMOUNTING_SIGKILL: 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; break;
case MOUNT_CLEANING: case MOUNT_CLEANING:
if (m->clean_result == MOUNT_SUCCESS) if (m->clean_result == MOUNT_SUCCESS)
m->clean_result = f; m->clean_result = f;
mount_enter_dead(m, MOUNT_SUCCESS, /* flush_result= */ false); mount_enter_dead(m, MOUNT_SUCCESS, /* flush_result = */ false);
break; break;
default: 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); mount_enter_signal(m, MOUNT_REMOUNTING_SIGKILL, MOUNT_SUCCESS);
} else { } else {
log_unit_warning(UNIT(m), "Remounting timed out. Skipping SIGKILL. Ignoring."); 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; 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); mount_set_reload_result(m, MOUNT_FAILURE_TIMEOUT);
log_unit_warning(UNIT(m), "Mount process still around after SIGKILL. Ignoring."); 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; break;
case MOUNT_UNMOUNTING: 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); mount_enter_signal(m, MOUNT_UNMOUNTING_SIGKILL, MOUNT_FAILURE_TIMEOUT);
} else { } else {
log_unit_warning(UNIT(m), "Mount process timed out. Skipping SIGKILL. Ignoring."); 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; break;
case MOUNT_UNMOUNTING_SIGKILL: case MOUNT_UNMOUNTING_SIGKILL:
log_unit_warning(UNIT(m), "Mount process still around after SIGKILL. Ignoring."); 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; break;
case MOUNT_CLEANING: 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()), * Also explicitly override the result (see the comment in mount_sigchld_event()),
* but more aggressively here since the state change is extrinsic. */ * but more aggressively here since the state change is extrinsic. */
mount_cycle_clear(mount); mount_cycle_clear(mount);
mount_enter_dead(mount, MOUNT_SUCCESS, /* flush_result= */ true); mount_enter_dead(mount, MOUNT_SUCCESS, /* flush_result = */ true);
break; break;
case MOUNT_MOUNTING_DONE: case MOUNT_MOUNTING_DONE:
@ -2395,7 +2395,7 @@ static int mount_test_startable(Unit *u) {
r = unit_test_start_limit(u); r = unit_test_start_limit(u);
if (r < 0) { 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; return r;
} }

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 /* 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 * 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. */ * 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) if (r < 0)
return r; return r;
@ -1484,12 +1484,12 @@ static int mount_private_apivfs(
return r; return r;
/* OK. We have a new mount instance. Let's clear an existing mount and its submounts. */ /* 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) if (r < 0)
log_debug_errno(r, "Failed to unmount directories below '%s', ignoring: %m", entry_path); log_debug_errno(r, "Failed to unmount directories below '%s', ignoring: %m", entry_path);
/* Then, move the new mount instance. */ /* 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) if (r < 0)
return r; return r;
@ -1502,13 +1502,13 @@ static int mount_private_apivfs(
static int mount_private_sysfs(const MountEntry *m, const NamespaceParameters *p) { static int mount_private_sysfs(const MountEntry *m, const NamespaceParameters *p) {
assert(m); assert(m);
assert(p); 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) { static int mount_private_cgroup2fs(const MountEntry *m, const NamespaceParameters *p) {
assert(m); assert(m);
assert(p); 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) { 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) if (fs_fd < 0)
return log_debug_errno(errno, "Failed to fsopen: %m"); 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) if (r < 0)
return log_debug_errno(r, "Failed to send bpffs fd to child: %m"); 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) if (r < 0)
return r; return r;
@ -1763,7 +1763,7 @@ static int mount_bpffs(const MountEntry *m, PidRef *pidref, int socket_fd, int e
pidref_done(pidref); 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) if (mnt_fd < 0)
return log_debug_errno(errno, "Failed to fsmount bpffs: %m"); 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_READ_WRITE_IMPLICIT:
case MOUNT_EXEC: case MOUNT_EXEC:
case MOUNT_NOEXEC: 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) if (r == -ENOENT && m->ignore)
return 0; return 0;
if (r < 0) if (r < 0)
@ -1952,7 +1952,7 @@ static int apply_one_mount(
host_os_release_id_like, host_os_release_id_like,
host_os_release_version_id, host_os_release_version_id,
host_os_release_level, 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, extension_release,
class); class);
if (r < 0) if (r < 0)
@ -2751,7 +2751,7 @@ int setup_namespace(const NamespaceParameters *p, char **reterr_path) {
if (r < 0) if (r < 0)
return r; 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) if (r < 0)
return r; return r;
@ -2995,7 +2995,7 @@ int setup_namespace(const NamespaceParameters *p, char **reterr_path) {
} else if (p->root_directory) { } else if (p->root_directory) {
/* A root directory is specified. Turn its directory into bind mount, if it isn't one yet. */ /* 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) if (r < 0)
return log_debug_errno(r, "Failed to detect that %s is a mount point or not: %m", root); return log_debug_errno(r, "Failed to detect that %s is a mount point or not: %m", root);
if (r == 0) { if (r == 0) {
@ -3021,7 +3021,7 @@ int setup_namespace(const NamespaceParameters *p, char **reterr_path) {
return r; return r;
/* MS_MOVE does not work on MS_SHARED so the remount MS_SHARED will be done later */ /* 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 (r == -EINVAL && p->root_directory) {
/* If we are using root_directory and we don't have privileges (ie: user manager in a user /* 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, * 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); r = mount_nofollow_verbose(LOG_DEBUG, root, root, NULL, MS_BIND|MS_REC, NULL);
if (r < 0) if (r < 0)
return r; return r;
r = mount_switch_root(root, /* mount_propagation_flag= */ 0); r = mount_switch_root(root, /* mount_propagation_flag = */ 0);
} }
if (r < 0) if (r < 0)
return log_debug_errno(r, "Failed to mount root with MS_MOVE: %m"); 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 (;;) { for (;;) {
_cleanup_free_ char *word = NULL; _cleanup_free_ char *word = NULL;
r = extract_first_word(&s, &word, ",", /* flags= */ 0); r = extract_first_word(&s, &word, ",", /* flags = */ 0);
if (r < 0) if (r < 0)
return log_warning_errno(r, "Failed to parse delegate options \"%s\": %m", s); return log_warning_errno(r, "Failed to parse delegate options \"%s\": %m", s);
if (r == 0) if (r == 0)

View File

@ -478,7 +478,7 @@ static void path_set_state(Path *p, PathState state) {
if (state != old_state) if (state != old_state)
log_unit_debug(UNIT(p), "Changed %s -> %s", path_state_to_string(old_state), path_state_to_string(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); 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; return 0;
} }
path_trigger_notify_impl(UNIT(p), trigger, /* on_defer= */ true); path_trigger_notify_impl(UNIT(p), trigger, /* on_defer = */ true);
return 0; return 0;
} }
@ -857,7 +857,7 @@ static void path_trigger_notify_impl(Unit *u, Unit *other, bool on_defer) {
return; return;
if (on_defer) { if (on_defer) {
path_enter_waiting(p, /* initial= */ false, /* from_trigger_notify= */ true); path_enter_waiting(p, /* initial = */ false, /* from_trigger_notify = */ true);
return; 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) { 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) { static void path_reset_failed(Unit *u) {

View File

@ -101,7 +101,7 @@ static void scope_set_state(Scope *s, ScopeState state) {
log_unit_debug(UNIT(s), "Changed %s -> %s", log_unit_debug(UNIT(s), "Changed %s -> %s",
scope_state_to_string(old_state), scope_state_to_string(state)); 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) { static int scope_add_default_dependencies(Scope *s) {

View File

@ -1248,7 +1248,7 @@ static int service_load_pid_file(Service *s, bool may_warn) {
} else } else
log_unit_debug(UNIT(s), "Main PID loaded: "PID_FMT, pidref.pid); 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) if (r < 0)
return r; return r;
@ -1278,7 +1278,7 @@ static void service_search_main_pid(Service *s) {
return; return;
log_unit_debug(UNIT(s), "Main PID guessed: "PID_FMT, pid.pid); 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; return;
r = unit_watch_pidref(UNIT(s), &s->main_pid, /* exclusive= */ false); 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) 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) if (old_state != state)
@ -1775,7 +1775,7 @@ static int service_spawn_internal(
&exec_params.fds, &exec_params.fds,
&exec_params.fd_names, &exec_params.fd_names,
&exec_params.n_socket_fds, &exec_params.n_socket_fds,
/* n_stashed_fds= */ NULL); /* n_stashed_fds = */ NULL);
if (r < 0) if (r < 0)
return r; return r;
@ -1814,7 +1814,7 @@ static int service_spawn_internal(
} }
if (MANAGER_IS_USER(UNIT(s)->manager) && 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) if (asprintf(our_env + n_env++, "MANAGERPID="PID_FMT, getpid_cached()) < 0)
return -ENOMEM; return -ENOMEM;
@ -2132,7 +2132,7 @@ static void service_enter_dead(Service *s, ServiceResult f, bool allow_restart)
end_state = SERVICE_FAILED; end_state = SERVICE_FAILED;
restart_state = SERVICE_FAILED_BEFORE_AUTO_RESTART; 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) if (!allow_restart)
log_unit_debug(UNIT(s), "Service restart not allowed."); 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); s->exec_runtime = exec_runtime_destroy(s->exec_runtime);
/* Also, remove the runtime directory */ /* 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. */ /* Also get rid of the fd store, if that's configured. */
if (s->fd_store_preserve_mode == EXEC_PRESERVE_NO) 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, r = service_spawn(s,
s->control_command, 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->timeout_stop_usec,
&s->control_pid); &s->control_pid);
if (r < 0) { if (r < 0) {
@ -2349,7 +2349,7 @@ static void service_enter_stop(Service *s, ServiceResult f) {
r = service_spawn(s, r = service_spawn(s,
s->control_command, 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->timeout_stop_usec,
&s->control_pid); &s->control_pid);
if (r < 0) { if (r < 0) {
@ -2434,7 +2434,7 @@ static void service_enter_start_post(Service *s) {
r = service_spawn(s, r = service_spawn(s,
s->control_command, 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->timeout_start_usec,
&s->control_pid); &s->control_pid);
if (r < 0) { 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 * 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. */ * 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) && IN_SET(s->kill_context.kill_mode, KILL_MIXED, KILL_CONTROL_GROUP) &&
!s->kill_context.send_sigkill) !s->kill_context.send_sigkill)
return log_unit_error_errno(UNIT(s), SYNTHETIC_ERRNO(EBUSY), 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, r = service_spawn(s,
s->control_command, 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->timeout_start_usec,
&s->control_pid); &s->control_pid);
if (r < 0) { if (r < 0) {
@ -2640,7 +2640,7 @@ static void service_enter_condition(Service *s) {
r = service_spawn(s, r = service_spawn(s,
s->control_command, 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->timeout_start_usec,
&s->control_pid); &s->control_pid);
if (r < 0) { if (r < 0) {
@ -2685,8 +2685,8 @@ static void service_enter_restart(Service *s, bool shortcut) {
JOB_START, UNIT(s), JOB_START, UNIT(s),
s->restart_mode == SERVICE_RESTART_MODE_DIRECT ? JOB_REPLACE : JOB_RESTART_DEPENDENCIES, s->restart_mode == SERVICE_RESTART_MODE_DIRECT ? JOB_REPLACE : JOB_RESTART_DEPENDENCIES,
TRANSACTION_REENQUEUE_ANCHOR, TRANSACTION_REENQUEUE_ANCHOR,
/* affected_jobs= */ NULL, /* affected_jobs = */ NULL,
&error, /* ret= */ NULL); &error, /* ret = */ NULL);
if (r < 0) { if (r < 0) {
log_unit_warning(UNIT(s), "Failed to schedule restart job: %s", bus_error_message(&error, r)); 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); 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, r = service_spawn(s,
s->control_command, 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->timeout_start_usec,
&s->control_pid); &s->control_pid);
if (r < 0) { if (r < 0) {
@ -2819,7 +2819,7 @@ static void service_enter_reload(Service *s) {
r = service_spawn(s, r = service_spawn(s,
s->control_command, 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->timeout_start_usec,
&s->control_pid); &s->control_pid);
if (r < 0) { if (r < 0) {
@ -2961,7 +2961,7 @@ static void service_run_next_control(Service *s) {
r = service_spawn(s, r = service_spawn(s,
s->control_command, s->control_command,
service_exec_flags(s->control_command_id, /* cred_flag= */ 0), service_exec_flags(s->control_command_id, /* cred_flag = */ 0),
timeout, timeout,
&s->control_pid); &s->control_pid);
if (r < 0) { 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 * for auto restart. We need to re-enqueue the job though, as the job type has changed
* (JOB_RESTART_DEPENDENCIES). */ * (JOB_RESTART_DEPENDENCIES). */
service_enter_restart(s, /* shortcut= */ true); service_enter_restart(s, /* shortcut = */ true);
return -EAGAIN; return -EAGAIN;
} }
@ -3561,7 +3561,7 @@ static int service_deserialize_item(Unit *u, const char *key, const char *value,
PidRef pidref; PidRef pidref;
if (!pidref_is_set(&s->main_pid) && deserialize_pidref(fds, value, &pidref) >= 0) 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")) { } else if (streq(key, "main-pid-known")) {
r = parse_boolean(value); 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), log_unit_debug(UNIT(s),
"Service has no hold-off time (RestartSec=0), scheduling restart."); "Service has no hold-off time (RestartSec=0), scheduling restart.");
service_enter_restart(s, /* shortcut= */ false); service_enter_restart(s, /* shortcut = */ false);
break; break;
case SERVICE_CLEANING: 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); log_unit_warning(u, "New main PID "PID_FMT" does not belong to service, refusing.", new_main_pid.pid);
} }
if (r > 0) { 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); r = unit_watch_pidref(UNIT(s), &s->main_pid, /* exclusive= */ false);
if (r < 0) 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)); assert(pidref_is_set(child_pidref));
if (pidref_equal(&s->main_pid, parent_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) if (r < 0)
return (void) log_unit_warning_errno(u, r, "Failed to set new main pid: %m"); 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); 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); (void) unit_watch_pidref(UNIT(s), &s->main_pid, /* exclusive= */ false);
return 1; return 1;
} }

View File

@ -45,7 +45,7 @@ static void slice_set_state(Slice *s, SliceState state) {
log_unit_debug(UNIT(s), "Changed %s -> %s", log_unit_debug(UNIT(s), "Changed %s -> %s",
slice_state_to_string(old_state), slice_state_to_string(state)); 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) { static int slice_add_parent_slice(Slice *s) {

View File

@ -1900,7 +1900,7 @@ static void socket_set_state(Socket *s, SocketState state) {
if (state != old_state) if (state != old_state)
log_unit_debug(UNIT(s), "Changed %s -> %s", socket_state_to_string(old_state), socket_state_to_string(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) { static int socket_coldplug(Unit *u) {
@ -2124,13 +2124,13 @@ static void socket_enter_dead(Socket *s, SocketResult f) {
else else
unit_log_failure(UNIT(s), socket_result_to_string(s->result)); 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); socket_set_state(s, s->result != SOCKET_SUCCESS ? SOCKET_FAILED : SOCKET_DEAD);
s->exec_runtime = exec_runtime_destroy(s->exec_runtime); 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); unit_unref_uid_gid(UNIT(s), true);
} }
@ -2353,7 +2353,7 @@ static void socket_enter_start_pre(Socket *s) {
socket_unwatch_control_pid(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_id = SOCKET_EXEC_START_PRE;
s->control_command = s->exec_command[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); 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! */ if (r >= 0) { /* Yay! */
socket_set_state(s, SOCKET_RUNNING); socket_set_state(s, SOCKET_RUNNING);
return true; /* changed */ 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 * 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. */ * 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) { if (r < 0) {
log_unit_warning_errno(UNIT(s), r, "Failed to install timer: %m"); log_unit_warning_errno(UNIT(s), r, "Failed to install timer: %m");
return socket_enter_stop_pre(s, SOCKET_FAILURE_RESOURCES); 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) { 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)) 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 /* We only check BUS_ERROR_TRANSACTION_IS_DESTRUCTIVE here, not
* BUS_ERROR_TRANSACTION_JOBS_CONFLICTING or BUS_ERROR_TRANSACTION_ORDER_IS_CYCLIC, * 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. */ * Deferring activation probably won't help. */
return socket_enter_deferred(s); return socket_enter_deferred(s);
} else } 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) if (r < 0)
goto queue_error; goto queue_error;
} }
@ -2568,7 +2568,7 @@ static void socket_enter_running(Socket *s, int cfd_in) {
s->n_connections++; 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) { if (r < 0) {
/* We failed to activate the new service, but it still exists. Let's make sure the /* 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. */ * 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); "Socket service %s not loaded, refusing.", UNIT(service)->id);
/* If the service is already active we cannot start the socket */ /* 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), return log_unit_error_errno(u, SYNTHETIC_ERRNO(EBUSY),
"Socket service %s already active, refusing.", UNIT(service)->id); "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) if (other->job)
return; return;
if (!SOCKET_SERVICE_IS_ACTIVE(service, /* allow_finalize= */ true)) if (!SOCKET_SERVICE_IS_ACTIVE(service, /* allow_finalize = */ true))
socket_enter_listening(s); socket_enter_listening(s);
if (SERVICE(other)->state == SERVICE_RUNNING) if (SERVICE(other)->state == SERVICE_RUNNING)

View File

@ -351,7 +351,7 @@ static int swap_load(Unit *u) {
assert(u->load_state == UNIT_STUB); assert(u->load_state == UNIT_STUB);
/* Load a .swap file */ /* 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 /* Add in some extras, and do so either when we successfully loaded something or when /proc/swaps is
* already active. */ * already active. */
@ -508,7 +508,7 @@ static void swap_set_state(Swap *s, SwapState state) {
if (state != old_state) if (state != old_state)
log_unit_debug(UNIT(s), "Changed %s -> %s", swap_state_to_string(old_state), swap_state_to_string(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 /* If there other units for the same device node have a job
queued it might be worth checking again if it is runnable 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; s->result = f;
unit_log_result(UNIT(s), s->result == SWAP_SUCCESS, swap_result_to_string(s->result)); 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); swap_set_state(s, s->result != SWAP_SUCCESS ? SWAP_FAILED : SWAP_DEAD);
s->exec_runtime = exec_runtime_destroy(s->exec_runtime); 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); unit_unref_uid_gid(UNIT(s), true);
} }
@ -755,7 +755,7 @@ static void swap_enter_activating(Swap *s) {
assert(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_id = SWAP_EXEC_ACTIVATE;
s->control_command = s->exec_command + SWAP_EXEC_ACTIVATE; s->control_command = s->exec_command + SWAP_EXEC_ACTIVATE;

View File

@ -29,7 +29,7 @@ static void target_set_state(Target *t, TargetState state) {
log_unit_debug(UNIT(t), "Changed %s -> %s", log_unit_debug(UNIT(t), "Changed %s -> %s",
target_state_to_string(old_state), target_state_to_string(state)); 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) { static int target_add_default_dependencies(Target *t) {

View File

@ -300,7 +300,7 @@ static void timer_set_state(Timer *t, TimerState state) {
if (state != old_state) if (state != old_state)
log_unit_debug(UNIT(t), "Changed %s -> %s", timer_state_to_string(old_state), timer_state_to_string(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); static void timer_enter_waiting(Timer *t, bool time_change);

View File

@ -256,12 +256,12 @@ static int transaction_merge_jobs(Transaction *tr, sd_bus_error *e) {
assert(tr); assert(tr);
/* First step, try to drop unmergeable jobs for jobs that matter to anchor. */ /* 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) if (r < 0)
return r; return r;
/* Second step, do the same for jobs that not matter to anchor. */ /* 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) if (r < 0)
return r; return r;

View File

@ -33,7 +33,7 @@ static int serialize_markers(FILE *f, unsigned markers) {
fputs("markers=", f); fputs("markers=", f);
BIT_FOREACH(m, markers) 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); fputc('\n', f);
return 0; 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. * 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. */ * Patch cgroup_realized == 0 back to no cgroup_path here hence. */
if (crt->deserialized_cgroup_realized == 0) if (crt->deserialized_cgroup_realized == 0)
unit_release_cgroup(u, /* drop_cgroup_runtime= */ false); unit_release_cgroup(u, /* drop_cgroup_runtime = */ false);
else { else {
unit_invalidate_cgroup(u, _CGROUP_MASK_ALL); unit_invalidate_cgroup(u, _CGROUP_MASK_ALL);
unit_invalidate_cgroup_bpf_firewall(u); unit_invalidate_cgroup_bpf_firewall(u);

View File

@ -813,7 +813,7 @@ Unit* unit_free(Unit *u) {
if (u->on_console) if (u->on_console)
manager_unref_console(u->manager); 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)) if (!MANAGER_IS_RELOADING(u->manager))
unit_unlink_state_files(u); unit_unlink_state_files(u);
@ -1551,8 +1551,8 @@ static int unit_add_mount_dependencies(Unit *u) {
(void) manager_load_unit_prepare( (void) manager_load_unit_prepare(
u->manager, u->manager,
p, p,
/* path= */ NULL, /* path= */NULL,
/* e= */ NULL, /* e= */NULL,
&m); &m);
continue; continue;
} }
@ -2140,7 +2140,7 @@ int unit_reload(Unit *u) {
if (!UNIT_VTABLE(u)->reload) { if (!UNIT_VTABLE(u)->reload) {
/* Unit doesn't have a reload function, but we need to propagate the reload anyway */ /* 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; 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= */ UNIT_FOREACH_DEPENDENCY_SAFE(other, u, UNIT_ATOM_RETROACTIVE_START_REPLACE) /* Requires= + BindsTo= */
if (!unit_has_dependency(u, UNIT_ATOM_AFTER, other) && if (!unit_has_dependency(u, UNIT_ATOM_AFTER, other) &&
!UNIT_IS_ACTIVE_OR_ACTIVATING(unit_active_state(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= */ UNIT_FOREACH_DEPENDENCY_SAFE(other, u, UNIT_ATOM_RETROACTIVE_START_FAIL) /* Wants= */
if (!unit_has_dependency(u, UNIT_ATOM_AFTER, other) && if (!unit_has_dependency(u, UNIT_ATOM_AFTER, other) &&
!UNIT_IS_ACTIVE_OR_ACTIVATING(unit_active_state(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) */ 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))) 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) { 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 */ /* Pull down units which are bound to us recursively if enabled */
UNIT_FOREACH_DEPENDENCY_SAFE(other, u, UNIT_ATOM_RETROACTIVE_STOP_ON_STOP) /* BoundBy= */ UNIT_FOREACH_DEPENDENCY_SAFE(other, u, UNIT_ATOM_RETROACTIVE_STOP_ON_STOP) /* BoundBy= */
if (!UNIT_IS_INACTIVE_OR_DEACTIVATING(unit_active_state(other))) 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) { 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) if (n_jobs == 0)
log_unit_info(u, "Triggering %s dependencies.", dependency_name); 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) if (r < 0)
log_unit_warning_errno(u, r, "Failed to enqueue %s%s job, ignoring: %s", log_unit_warning_errno(u, r, "Failed to enqueue %s%s job, ignoring: %s",
dependency_name, other->id, bus_error_message(&error, r)); 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: case JOB_VERIFY_ACTIVE:
if (UNIT_IS_ACTIVE_OR_RELOADING(ns)) 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) { else if (j->state == JOB_RUNNING && ns != UNIT_ACTIVATING) {
unexpected = true; unexpected = true;
if (UNIT_IS_INACTIVE_OR_FAILED(ns)) 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; break;
@ -2638,10 +2638,10 @@ static bool unit_process_job(Job *j, UnitActiveState ns, bool reload_success) {
if (j->state == JOB_RUNNING) { if (j->state == JOB_RUNNING) {
if (ns == UNIT_ACTIVE) 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)) { else if (!IN_SET(ns, UNIT_ACTIVATING, UNIT_RELOADING, UNIT_REFRESHING)) {
unexpected = true; 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: case JOB_RESTART:
if (UNIT_IS_INACTIVE_OR_FAILED(ns)) 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) { else if (j->state == JOB_RUNNING && ns != UNIT_DEACTIVATING) {
unexpected = true; 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; break;
@ -3346,7 +3346,7 @@ int setenv_unit_path(const char *p) {
assert(p); assert(p);
/* This is mostly for debug purposes */ /* 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) { 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( r = bus_add_match_full(
bus, bus,
&u->match_bus_slot, &u->match_bus_slot,
/* asynchronous= */ true, /* asynchronous = */ true,
match, match,
signal_name_owner_changed, signal_name_owner_changed,
signal_name_owner_changed_install_handler, signal_name_owner_changed_install_handler,
@ -3801,7 +3801,7 @@ int unit_coldplug(Unit *u) {
if (u->nop_job) if (u->nop_job)
RET_GATHER(r, job_coldplug(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; return r;
} }
@ -3858,7 +3858,7 @@ bool unit_need_daemon_reload(Unit *u) {
if (u->load_state == UNIT_LOADED) { if (u->load_state == UNIT_LOADED) {
_cleanup_strv_free_ char **dropins = NULL; _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)) if (!strv_equal(u->dropin_paths, dropins))
return true; 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."); 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) && 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."); 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) 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); r = unit_kill_context_one(u, main_pid, "main", is_alien, sig, send_sighup, log_func);
wait_for_exit = wait_for_exit || r > 0; 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; wait_for_exit = wait_for_exit || r > 0;
CGroupRuntime *crt = unit_get_cgroup_runtime(u); 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) { static void unit_unref_uid(Unit *u, bool destroy_now) {
assert(u); 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); 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) { static void unit_unref_gid(Unit *u, bool destroy_now) {
assert(u); 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); 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) if (r < 0)
return log_unit_warning_errno(u, r, "Couldn't add UID/GID reference to unit, proceeding without: %m"); 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_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_GROUP, gid);
return r; return r;
} }
@ -6479,7 +6479,7 @@ void unit_freezer_complete(Unit *u, FreezerState kernel_state) {
freezer_state_to_string(u->freezer_state)); freezer_state_to_string(u->freezer_state));
/* If the cgroup's final state is against what's requested by us, report as canceled. */ /* 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) { 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"); return log_unit_debug_errno(u, errno, "Failed to get exec quota stats: %m");
uint32_t proj_id; 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) if (r < 0)
return log_unit_debug_errno(u, r, "Failed to get project ID for exec quota stats: %m"); return log_unit_debug_errno(u, r, "Failed to get project ID for exec quota stats: %m");

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)), JSON_BUILD_PAIR_STRING_NON_EMPTY("Personality", personality_to_string(c->personality)),
SD_JSON_BUILD_PAIR_BOOLEAN("IgnoreSIGPIPE", c->ignore_sigpipe), 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_INTEGER("Nice", exec_context_get_nice(c)),
SD_JSON_BUILD_PAIR_CALLBACK("CPUSchedulingPolicy", cpu_sched_class_build_json, 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)), 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("SystemCallArchitectures", syscall_archs_build_json, c),
JSON_BUILD_PAIR_CALLBACK_NON_NULL("SystemCallLog", syscall_log_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_STRV_NON_EMPTY("Environment", c->environment),
JSON_BUILD_PAIR_CALLBACK_NON_NULL("EnvironmentFiles", environment_files_build_json, c->environment_files), JSON_BUILD_PAIR_CALLBACK_NON_NULL("EnvironmentFiles", environment_files_build_json, c->environment_files),
JSON_BUILD_PAIR_STRV_NON_EMPTY("PassEnvironment", c->pass_environment), JSON_BUILD_PAIR_STRV_NON_EMPTY("PassEnvironment", c->pass_environment),

View File

@ -487,7 +487,7 @@ int vl_method_list_units(sd_varlink *link, sd_json_variant *parameters, sd_varli
if (r < 0) if (r < 0)
return r; return r;
if (unit) 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)) if (!FLAGS_SET(flags, SD_VARLINK_METHOD_MORE))
return sd_varlink_error(link, SD_VARLINK_ERROR_EXPECTED_MORE, NULL); 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; continue;
if (previous) { if (previous) {
r = list_unit_one(link, previous, /* more= */ true); r = list_unit_one(link, previous, /* more = */ true);
if (r < 0) if (r < 0)
return r; return r;
} }
@ -507,7 +507,7 @@ int vl_method_list_units(sd_varlink *link, sd_json_variant *parameters, sd_varli
} }
if (previous) 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); return sd_varlink_error(link, "io.systemd.Manager.NoSuchUnit", NULL);
} }

View File

@ -147,7 +147,7 @@ static int manager_varlink_send_managed_oom_initial(Manager *m) {
assert(m->managed_oom_varlink); 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) if (r <= 0)
return r; return r;
@ -323,7 +323,7 @@ static int vl_method_subscribe_managed_oom_cgroups(
if (!streq(u->id, "systemd-oomd.service")) if (!streq(u->id, "systemd-oomd.service"))
return sd_varlink_error(link, SD_VARLINK_ERROR_PERMISSION_DENIED, NULL); 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) if (r != 0)
return r; return r;
@ -334,7 +334,7 @@ static int vl_method_subscribe_managed_oom_cgroups(
_cleanup_(sd_json_variant_unrefp) sd_json_variant *v = NULL; _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) if (r < 0)
return r; return r;

View File

@ -320,7 +320,7 @@ static void coredump_context_check_pidns(CoredumpContext *context) {
assert(context); assert(context);
assert(pidref_is_set(&context->pidref)); assert(pidref_is_set(&context->pidref));
r = pidref_in_same_namespace(/* pid1= */ NULL, &context->pidref, NAMESPACE_PID); r = pidref_in_same_namespace(/* pid1 = */ NULL, &context->pidref, NAMESPACE_PID);
if (r < 0) if (r < 0)
log_debug_errno(r, "Failed to check pidns of crashing process, ignoring: %m"); log_debug_errno(r, "Failed to check pidns of crashing process, ignoring: %m");

Some files were not shown because too many files have changed in this diff Show More