mirror of
https://github.com/FeralInteractive/gamemode.git
synced 2025-06-06 23:57:22 +02:00
daemon-config: Add ioprio configuration option
Signed-off-by: Kai Krakow <kai@kaishome.de>
This commit is contained in:
parent
a91a2e7739
commit
ebf177bebe
@ -70,6 +70,8 @@ struct GameModeConfig {
|
||||
char softrealtime[CONFIG_VALUE_MAX];
|
||||
long renice;
|
||||
|
||||
char ioprio[CONFIG_VALUE_MAX];
|
||||
|
||||
long reaper_frequency;
|
||||
};
|
||||
|
||||
@ -164,6 +166,8 @@ static int inih_handler(void *user, const char *section, const char *name, const
|
||||
valid = get_string_value(value, self->softrealtime);
|
||||
} else if (strcmp(name, "renice") == 0) {
|
||||
valid = get_long_value(name, value, &self->renice);
|
||||
} else if (strcmp(name, "ioprio") == 0) {
|
||||
valid = get_string_value(value, self->ioprio);
|
||||
}
|
||||
} else if (strcmp(section, "custom") == 0) {
|
||||
/* Custom subsection */
|
||||
@ -215,6 +219,7 @@ static void load_config_files(GameModeConfig *self)
|
||||
pthread_rwlock_wrlock(&self->rwlock);
|
||||
|
||||
/* Clear our config values */
|
||||
memset(self->ioprio, 0, sizeof(self->ioprio));
|
||||
memset(self->whitelist, 0, sizeof(self->whitelist));
|
||||
memset(self->blacklist, 0, sizeof(self->blacklist));
|
||||
memset(self->startscripts, 0, sizeof(self->startscripts));
|
||||
@ -424,3 +429,18 @@ void config_get_renice_value(GameModeConfig *self, long *value)
|
||||
{
|
||||
memcpy_locked_config(self, value, &self->renice, sizeof(long));
|
||||
}
|
||||
|
||||
/*
|
||||
* Get the ioprio value
|
||||
*/
|
||||
void config_get_ioprio_value(GameModeConfig *self, int *value)
|
||||
{
|
||||
char ioprio_value[CONFIG_VALUE_MAX] = { 0 };
|
||||
memcpy_locked_config(self, ioprio_value, &self->ioprio, sizeof(self->ioprio));
|
||||
if (0 == strncmp(ioprio_value, "off", sizeof(self->ioprio)))
|
||||
*value = IOPRIO_DONT_SET;
|
||||
else if (0 == strncmp(ioprio_value, "default", sizeof(self->ioprio)))
|
||||
*value = IOPRIO_RESET_DEFAULT;
|
||||
else
|
||||
*value = atoi(ioprio_value);
|
||||
}
|
||||
|
@ -39,6 +39,12 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||
#define CONFIG_LIST_MAX 32
|
||||
#define CONFIG_VALUE_MAX 256
|
||||
|
||||
/*
|
||||
* Special ioprio values
|
||||
*/
|
||||
#define IOPRIO_RESET_DEFAULT -1
|
||||
#define IOPRIO_DONT_SET -2
|
||||
|
||||
/*
|
||||
* Opaque config context type
|
||||
*/
|
||||
@ -113,3 +119,8 @@ void config_get_soft_realtime(GameModeConfig *self, char softrealtime[CONFIG_VAL
|
||||
* Get the renice value
|
||||
*/
|
||||
void config_get_renice_value(GameModeConfig *self, long *value);
|
||||
|
||||
/*
|
||||
* Get the ioprio value
|
||||
*/
|
||||
void config_get_ioprio_value(GameModeConfig *self, int *value);
|
||||
|
@ -110,6 +110,12 @@ softrealtime=auto
|
||||
; the value will be negated and applied as a nice value
|
||||
renice = 4
|
||||
|
||||
; By default, GameMode adjusts the iopriority of clients to BE/0, you can put any value
|
||||
; between 0 and 7 here (with 0 being highest priority), or one of the special values
|
||||
; "off" (to disable) or "reset" (to restore Linux default behavior based on CPU priority),
|
||||
; currently, only the best-effort class is supported thus you cannot set it here
|
||||
ioprio = 0
|
||||
|
||||
[filter]
|
||||
; If "whitelist" entry has a value(s)
|
||||
; gamemode will reject anything not in the whitelist
|
||||
|
@ -15,6 +15,12 @@ softrealtime=auto
|
||||
; the value will be negated and applied as a nice value
|
||||
renice = 4
|
||||
|
||||
; By default, GameMode adjusts the iopriority of clients to BE/0, you can put any value
|
||||
; between 0 and 7 here (with 0 being highest priority), or one of the special values
|
||||
; "off" (to disable) or "reset" (to restore Linux default behavior based on CPU priority),
|
||||
; currently, only the best-effort class is supported thus you cannot set it here
|
||||
ioprio = 0
|
||||
|
||||
[filter]
|
||||
; If "whitelist" entry has a value(s)
|
||||
; gamemode will reject anything not in the whitelist
|
||||
|
Loading…
x
Reference in New Issue
Block a user