Combine the two run_external_process functions so they both have the same timeout protection

This commit is contained in:
Marc Di Luzio
2019-02-21 20:03:59 +00:00
parent e9ff2cbb10
commit 4578af47ba
6 changed files with 24 additions and 63 deletions

View File

@@ -79,7 +79,7 @@ static int get_gpu_state_nv(struct GameModeGPUInfo *info)
NV_CORE_OFFSET_ATTRIBUTE,
info->nv_perf_level);
const char *exec_args_core[] = { "/usr/bin/nvidia-settings", "-q", arg, "-t", NULL };
if (run_external_process_get_output(exec_args_core, buf) != 0) {
if (run_external_process(exec_args_core, buf) != 0) {
LOG_ERROR("Failed to set %s!\n", arg);
return -1;
}
@@ -98,7 +98,7 @@ static int get_gpu_state_nv(struct GameModeGPUInfo *info)
NV_MEM_OFFSET_ATTRIBUTE,
info->nv_perf_level);
const char *exec_args_mem[] = { "/usr/bin/nvidia-settings", "-q", arg, "-t", NULL };
if (run_external_process_get_output(exec_args_mem, buf) != 0) {
if (run_external_process(exec_args_mem, buf) != 0) {
LOG_ERROR("Failed to set %s!\n", arg);
return -1;
}
@@ -145,7 +145,7 @@ static int set_gpu_state_nv(struct GameModeGPUInfo *info)
info->nv_perf_level,
info->core);
const char *exec_args_core[] = { "/usr/bin/nvidia-settings", "-a", core_arg, NULL };
if (run_external_process(exec_args_core) != 0) {
if (run_external_process(exec_args_core, NULL) != 0) {
LOG_ERROR("Failed to set %s!\n", core_arg);
return -1;
}
@@ -160,7 +160,7 @@ static int set_gpu_state_nv(struct GameModeGPUInfo *info)
info->nv_perf_level,
info->mem);
const char *exec_args_mem[] = { "/usr/bin/nvidia-settings", "-a", mem_arg, NULL };
if (run_external_process(exec_args_mem) != 0) {
if (run_external_process(exec_args_mem, NULL) != 0) {
LOG_ERROR("Failed to set %s!\n", mem_arg);
return -1;
}