Merge pull request #14465 from poettering/setprio-rework

When Nice= is used, clamp to RLIMIT_NICE
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2020-01-08 11:06:46 +01:00
committed by GitHub
4 changed files with 154 additions and 5 deletions
+5 -5
View File
@@ -3236,11 +3236,11 @@ static int exec_child(
}
}
if (context->nice_set)
if (setpriority(PRIO_PROCESS, 0, context->nice) < 0) {
*exit_status = EXIT_NICE;
return log_unit_error_errno(unit, errno, "Failed to set up process scheduling priority (nice level): %m");
}
if (context->nice_set) {
r = setpriority_closest(context->nice);
if (r < 0)
return log_unit_error_errno(unit, r, "Failed to set up process scheduling priority (nice level): %m");
}
if (context->cpu_sched_set) {
struct sched_param param = {