mirror of https://github.com/RPCS3/rpcs3.git
remove nonroot
This commit is contained in:
parent
b9257cf0a3
commit
4300857108
|
@ -3031,9 +3031,7 @@ void thread_ctrl::set_native_priority(int priority)
|
||||||
sig_log.error("SetThreadPriority() failed: %s", fmt::win_error{GetLastError(), nullptr});
|
sig_log.error("SetThreadPriority() failed: %s", fmt::win_error{GetLastError(), nullptr});
|
||||||
}
|
}
|
||||||
#elif defined(__linux__)
|
#elif defined(__linux__)
|
||||||
// available niceness for nonroot: 0~19
|
|
||||||
// available niceness for root: -20~19
|
// available niceness for root: -20~19
|
||||||
|
|
||||||
int linuxprio = 0;
|
int linuxprio = 0;
|
||||||
id_t threadpid = gettid();
|
id_t threadpid = gettid();
|
||||||
uid_t euid = geteuid();
|
uid_t euid = geteuid();
|
||||||
|
@ -3045,19 +3043,7 @@ void thread_ctrl::set_native_priority(int priority)
|
||||||
linuxprio = -6;
|
linuxprio = -6;
|
||||||
else if (priority < 0)
|
else if (priority < 0)
|
||||||
linuxprio = 6;
|
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))
|
if (int err = setpriority(PRIO_PROCESS, threadpid, linuxprio))
|
||||||
{
|
{
|
||||||
sig_log.error("setpriority(%d, %d) failed: %d", threadpid, linuxprio, err);
|
sig_log.error("setpriority(%d, %d) failed: %d", threadpid, linuxprio, err);
|
||||||
|
|
Loading…
Reference in New Issue