diff options
author | Lennart Poettering <lennart@poettering.net> | 2023-03-29 22:10:01 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2023-04-13 06:44:27 +0200 |
commit | 4fb8f1e88322b94b0fa051d3c6fd19cac0227aaa (patch) | |
tree | 25abb04a9f420f533a85a8548d21103f165708b2 /src/core/dbus-unit.c | |
parent | b9c1883a9cd9b5126fe648f3e198143dc19a222d (diff) | |
download | systemd-4fb8f1e88322b94b0fa051d3c6fd19cac0227aaa.tar.gz |
service: allow freeing the fdstore via cleaning
Now that we have a potentially pinned fdstore let's add a concept for
cleaning it explicitly on user requested. Let's expose this via
"systemctl clean", i.e. the same way as user directories are cleaned.
Diffstat (limited to 'src/core/dbus-unit.c')
-rw-r--r-- | src/core/dbus-unit.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/src/core/dbus-unit.c b/src/core/dbus-unit.c index 3f083a8174..c01f41cb44 100644 --- a/src/core/dbus-unit.c +++ b/src/core/dbus-unit.c @@ -90,6 +90,12 @@ static int property_get_can_clean( return r; } + if (FLAGS_SET(mask, EXEC_CLEAN_FDSTORE)) { + r = sd_bus_message_append(reply, "s", "fdstore"); + if (r < 0) + return r; + } + return sd_bus_message_close_container(reply); } @@ -696,6 +702,7 @@ int bus_unit_method_clean(sd_bus_message *message, void *userdata, sd_bus_error return r; for (;;) { + ExecCleanMask m; const char *i; r = sd_bus_message_read(message, "s", &i); @@ -704,17 +711,11 @@ int bus_unit_method_clean(sd_bus_message *message, void *userdata, sd_bus_error if (r == 0) break; - if (streq(i, "all")) - mask |= EXEC_CLEAN_ALL; - else { - ExecDirectoryType t; - - t = exec_resource_type_from_string(i); - if (t < 0) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid resource type: %s", i); + m = exec_clean_mask_from_string(i); + if (m < 0) + return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid resource type: %s", i); - mask |= 1U << t; - } + mask |= m; } r = sd_bus_message_exit_container(message); |