hotspot/src/os/linux/vm/os_linux.cpp
static int prio_init() {
{- -------------------------------------------
(1) もし ThreadPriorityPolicy オプションの値が 1 にセットされていれば,
geteuid() で root かどうかを調べる.
root でない場合は ThreadPriorityPolicy オプションを 0 に戻しておく.
(なおコメントによると, CAP_SYS_NICE を調べる方がエレガントだけど libcap.so が必要, とのこと)
---------------------------------------- -}
if (ThreadPriorityPolicy == 1) {
// Only root can raise thread priority. Don't allow ThreadPriorityPolicy=1
// if effective uid is not root. Perhaps, a more elegant way of doing
// this is to test CAP_SYS_NICE capability, but that will require libcap.so
if (geteuid() != 0) {
if (!FLAG_IS_DEFAULT(ThreadPriorityPolicy)) {
warning("-XX:ThreadPriorityPolicy requires root privilege on Linux");
}
ThreadPriorityPolicy = 0;
}
}
{- -------------------------------------------
(1) リターン
---------------------------------------- -}
return 0;
}
This document is available under the GNU GENERAL PUBLIC LICENSE Version 2.