From 430085710859b8fb12c05261889e9b779b0dd242 Mon Sep 17 00:00:00 2001 From: hoholee12 Date: Tue, 25 Jul 2023 18:03:45 +0900 Subject: [PATCH] remove nonroot --- Utilities/Thread.cpp | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/Utilities/Thread.cpp b/Utilities/Thread.cpp index 18042d2b61..47a1388f9d 100644 --- a/Utilities/Thread.cpp +++ b/Utilities/Thread.cpp @@ -3031,9 +3031,7 @@ void thread_ctrl::set_native_priority(int priority) sig_log.error("SetThreadPriority() failed: %s", fmt::win_error{GetLastError(), nullptr}); } #elif defined(__linux__) - // available niceness for nonroot: 0~19 // available niceness for root: -20~19 - int linuxprio = 0; id_t threadpid = gettid(); uid_t euid = geteuid(); @@ -3045,19 +3043,7 @@ void thread_ctrl::set_native_priority(int priority) linuxprio = -6; else if (priority < 0) linuxprio = 6; - } - else - { - linuxprio = 6; - if (priority > 0) - linuxprio = 0; - else if (priority < 0) - linuxprio = 12; - } - // nonroot cannot increase niceness value - if ((getpriority(PRIO_PROCESS, threadpid) < linuxprio) || (euid == 0)) - { if (int err = setpriority(PRIO_PROCESS, threadpid, linuxprio)) { sig_log.error("setpriority(%d, %d) failed: %d", threadpid, linuxprio, err);