summaryrefslogtreecommitdiffstats
path: root/src/core/dbus-util.c
diff options
context:
space:
mode:
authorAnita Zhang <the.anitazha@gmail.com>2020-03-09 23:09:17 +0100
committerAnita Zhang <the.anitazha@gmail.com>2020-10-08 01:17:23 +0200
commit4d824a4e0b008a359adda0e960706316f207047e (patch)
tree04c5b68e821899102206ae1be6746632aa96d9cd /src/core/dbus-util.c
parentunit: don't emit PropertiesChanged signal if adding a dependency to a unit is... (diff)
downloadsystemd-4d824a4e0b008a359adda0e960706316f207047e.tar.xz
systemd-4d824a4e0b008a359adda0e960706316f207047e.zip
core: add ManagedOOM*= properties to configure systemd-oomd on the unit
This adds the hook ups so it can be read with the usual systemd utilities. Used in later commits by sytemd-oomd.
Diffstat (limited to 'src/core/dbus-util.c')
-rw-r--r--src/core/dbus-util.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/core/dbus-util.c b/src/core/dbus-util.c
index 951450e53d..f534001a9c 100644
--- a/src/core/dbus-util.c
+++ b/src/core/dbus-util.c
@@ -91,6 +91,35 @@ int bus_set_transient_bool(
return 1;
}
+int bus_set_transient_percent(
+ Unit *u,
+ const char *name,
+ int *p,
+ sd_bus_message *message,
+ UnitWriteFlags flags,
+ sd_bus_error *error) {
+
+ const char *v;
+ int r;
+
+ assert(p);
+
+ r = sd_bus_message_read(message, "s", &v);
+ if (r < 0)
+ return r;
+
+ r = parse_percent(v);
+ if (r < 0)
+ return r;
+
+ if (!UNIT_WRITE_FLAGS_NOOP(flags)) {
+ *p = r;
+ unit_write_settingf(u, flags, name, "%s=%d%%", name, r);
+ }
+
+ return 1;
+}
+
int bus_set_transient_usec_internal(
Unit *u,
const char *name,