diff options
author | Lennart Poettering <lennart@poettering.net> | 2015-10-19 19:02:47 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2015-10-19 19:02:47 +0200 |
commit | aa486a72be9903daf870b050616769d1b4e78a33 (patch) | |
tree | 6561f4ea355882a41dbc4267c652a27dd85c5586 /src/shared/bus-util.c | |
parent | 9badb85de0821c98c7adf5dc90b2ba590987dbb5 (diff) | |
parent | e9cc999a306a789049304997f855dec2eabe5579 (diff) |
Merge pull request #1598 from evverx/run-oomscoreadjust
systemd-run can launch units with OOMScoreAdjust
Diffstat (limited to 'src/shared/bus-util.c')
-rw-r--r-- | src/shared/bus-util.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/shared/bus-util.c b/src/shared/bus-util.c index a5d6edbba9..78d6b0eb27 100644 --- a/src/shared/bus-util.c +++ b/src/shared/bus-util.c @@ -1665,6 +1665,21 @@ int bus_append_unit_property_assignment(sd_bus_message *m, const char *assignmen } r = sd_bus_message_append(m, "v", "t", n); + } else if (streq(field, "OOMScoreAdjust")) { + int oa; + + r = safe_atoi(eq, &oa); + if (r < 0) { + log_error("Failed to parse %s value %s", field, eq); + return -EINVAL; + } + + if (!oom_score_adjust_is_valid(oa)) { + log_error("OOM score adjust value out of range"); + return -EINVAL; + } + + r = sd_bus_message_append(m, "v", "i", oa); } else { log_error("Unknown assignment %s.", assignment); return -EINVAL; |