summaryrefslogtreecommitdiffstats
path: root/src/shared
diff options
context:
space:
mode:
Diffstat (limited to 'src/shared')
-rw-r--r--src/shared/bus-get-properties.c17
-rw-r--r--src/shared/bus-get-properties.h1
-rw-r--r--src/shared/bus-unit-util.c19
-rw-r--r--src/shared/conf-parser.c1
-rw-r--r--src/shared/conf-parser.h1
5 files changed, 19 insertions, 20 deletions
diff --git a/src/shared/bus-get-properties.c b/src/shared/bus-get-properties.c
index 32f68d5e6a..a5ce7ef17f 100644
--- a/src/shared/bus-get-properties.c
+++ b/src/shared/bus-get-properties.c
@@ -55,23 +55,6 @@ int bus_property_get_id128(
return sd_bus_message_append_array(reply, 'y', id->bytes, 16);
}
-int bus_property_get_percent(
- sd_bus *bus,
- const char *path,
- const char *interface,
- const char *property,
- sd_bus_message *reply,
- void *userdata,
- sd_bus_error *error) {
-
- char pstr[DECIMAL_STR_MAX(int) + 2];
- int p = *(int*) userdata;
-
- xsprintf(pstr, "%d%%", p);
-
- return sd_bus_message_append_basic(reply, 's', pstr);
-}
-
#if __SIZEOF_SIZE_T__ != 8
int bus_property_get_size(
sd_bus *bus,
diff --git a/src/shared/bus-get-properties.h b/src/shared/bus-get-properties.h
index 9832c0d067..26f3e8588c 100644
--- a/src/shared/bus-get-properties.h
+++ b/src/shared/bus-get-properties.h
@@ -8,7 +8,6 @@
int bus_property_get_bool(sd_bus *bus, const char *path, const char *interface, const char *property, sd_bus_message *reply, void *userdata, sd_bus_error *error);
int bus_property_set_bool(sd_bus *bus, const char *path, const char *interface, const char *property, sd_bus_message *value, void *userdata, sd_bus_error *error);
int bus_property_get_id128(sd_bus *bus, const char *path, const char *interface, const char *property, sd_bus_message *reply, void *userdata, sd_bus_error *error);
-int bus_property_get_percent(sd_bus *bus, const char *path, const char *interface, const char *property, sd_bus_message *reply, void *userdata, sd_bus_error *error);
#define bus_property_get_usec ((sd_bus_property_get_t) NULL)
#define bus_property_set_usec ((sd_bus_property_set_t) NULL)
diff --git a/src/shared/bus-unit-util.c b/src/shared/bus-unit-util.c
index 8fd2f89adc..84f57d94d2 100644
--- a/src/shared/bus-unit-util.c
+++ b/src/shared/bus-unit-util.c
@@ -435,10 +435,25 @@ static int bus_append_cgroup_property(sd_bus_message *m, const char *field, cons
if (STR_IN_SET(field, "DevicePolicy",
"Slice",
"ManagedOOMSwap",
- "ManagedOOMMemoryPressure",
- "ManagedOOMMemoryPressureLimitPercent"))
+ "ManagedOOMMemoryPressure"))
return bus_append_string(m, field, eq);
+ if (STR_IN_SET(field, "ManagedOOMMemoryPressureLimit")) {
+ char *n;
+
+ r = parse_permyriad(eq);
+ if (r < 0)
+ return log_error_errno(r, "Failed to parse %s value: %s", field, eq);
+
+ n = strjoina(field, "Permyriad");
+
+ r = sd_bus_message_append(m, "(sv)", n, "u", (uint32_t) r);
+ if (r < 0)
+ return bus_log_create_error(r);
+
+ return 1;
+ }
+
if (STR_IN_SET(field, "CPUAccounting",
"MemoryAccounting",
"IOAccounting",
diff --git a/src/shared/conf-parser.c b/src/shared/conf-parser.c
index 0a1f2d67d4..f838d4513d 100644
--- a/src/shared/conf-parser.c
+++ b/src/shared/conf-parser.c
@@ -1356,3 +1356,4 @@ int config_parse_hwaddrs(
}
DEFINE_CONFIG_PARSE(config_parse_percent, parse_percent, "Failed to parse percent value");
+DEFINE_CONFIG_PARSE(config_parse_permyriad, parse_permyriad, "Failed to parse permyriad value");
diff --git a/src/shared/conf-parser.h b/src/shared/conf-parser.h
index b194821937..283d60a473 100644
--- a/src/shared/conf-parser.h
+++ b/src/shared/conf-parser.h
@@ -150,6 +150,7 @@ CONFIG_PARSER_PROTOTYPE(config_parse_vlanprotocol);
CONFIG_PARSER_PROTOTYPE(config_parse_hwaddr);
CONFIG_PARSER_PROTOTYPE(config_parse_hwaddrs);
CONFIG_PARSER_PROTOTYPE(config_parse_percent);
+CONFIG_PARSER_PROTOTYPE(config_parse_permyriad);
typedef enum Disabled {
DISABLED_CONFIGURATION,