common: fix return value check for setpriority (#18412)

* common: fix return value check for setpriority

* tools: add logging for process priority setting
This commit is contained in:
o7si 2025-12-29 17:07:49 +08:00 committed by GitHub
parent e70e640db3
commit daa242dfc8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 9 additions and 3 deletions

View file

@ -251,7 +251,7 @@ bool set_process_priority(enum ggml_sched_priority prio) {
case GGML_SCHED_PRIO_REALTIME: p = -20; break;
}
if (!setpriority(PRIO_PROCESS, 0, p)) {
if (setpriority(PRIO_PROCESS, 0, p) != 0) {
LOG_WRN("failed to set process priority %d : %s (%d)\n", prio, strerror(errno), errno);
return false;
}