Set up for resetting niceness value

Add tests to check this feature
	Apply config validation in config for simplicity

	Note: if anything messes with the niceness (ie. it starts non-zero, or it's not the expected value during setup, we'll bail out)
This commit is contained in:
Marc Di Luzio
2019-05-11 10:33:29 +01:00
parent 7e5216c4a0
commit 09d63ae4f5
5 changed files with 118 additions and 17 deletions

View File

@@ -548,6 +548,11 @@ long config_get_renice_value(GameModeConfig *self)
{
long value = 0;
memcpy_locked_config(self, &value, &self->values.renice, sizeof(long));
/* Validate the renice value */
if ((value < 1 || value > 20) && value != 0) {
LOG_ONCE(ERROR, "Configured renice value '%ld' is invalid, will not renice.\n", value);
value = 0;
}
return value;
}