diff --git a/src/hotspot/os/bsd/os_bsd.cpp b/src/hotspot/os/bsd/os_bsd.cpp index 97d61fd90b7c952d6b0602606312468849222307..e31b5293572e596228fe91545f92e242ba0f18c9 100644 --- a/src/hotspot/os/bsd/os_bsd.cpp +++ b/src/hotspot/os/bsd/os_bsd.cpp @@ -2484,7 +2484,7 @@ int os::java_to_os_priority[CriticalPriority + 1] = { static int prio_init() { if (ThreadPriorityPolicy == 1) { if (geteuid() != 0) { - if (!FLAG_IS_DEFAULT(ThreadPriorityPolicy)) { + if (!FLAG_IS_DEFAULT(ThreadPriorityPolicy) && !FLAG_IS_JIMAGE_RESOURCE(ThreadPriorityPolicy)) { warning("-XX:ThreadPriorityPolicy=1 may require system level permission, " \ "e.g., being the root user. If the necessary permission is not " \ "possessed, changes to priority will be silently ignored."); diff --git a/src/hotspot/os/linux/os_linux.cpp b/src/hotspot/os/linux/os_linux.cpp index f318c7d0527bcb44c46d256c03b8254cabe290f4..6ee57c1f80de224594132fc27d37c5d097862107 100644 --- a/src/hotspot/os/linux/os_linux.cpp +++ b/src/hotspot/os/linux/os_linux.cpp @@ -4334,7 +4334,7 @@ int os::java_to_os_priority[CriticalPriority + 1] = { static int prio_init() { if (ThreadPriorityPolicy == 1) { if (geteuid() != 0) { - if (!FLAG_IS_DEFAULT(ThreadPriorityPolicy)) { + if (!FLAG_IS_DEFAULT(ThreadPriorityPolicy) && !FLAG_IS_JIMAGE_RESOURCE(ThreadPriorityPolicy)) { warning("-XX:ThreadPriorityPolicy=1 may require system level permission, " \ "e.g., being the root user. If the necessary permission is not " \ "possessed, changes to priority will be silently ignored."); diff --git a/src/hotspot/share/runtime/flags/jvmFlag.cpp b/src/hotspot/share/runtime/flags/jvmFlag.cpp index 79b85630f82a26f7478b64aef68e7636dd6a4e01..630c8becd97b2bc51810be1b282e8873a9798a50 100644 --- a/src/hotspot/share/runtime/flags/jvmFlag.cpp +++ b/src/hotspot/share/runtime/flags/jvmFlag.cpp @@ -294,6 +294,10 @@ bool JVMFlag::is_command_line() { return (_flags & ORIG_COMMAND_LINE) != 0; } +bool JVMFlag::is_jimage_resource() { + return (get_origin() == JIMAGE_RESOURCE); +} + void JVMFlag::set_command_line() { _flags = Flags(_flags | ORIG_COMMAND_LINE); } @@ -989,6 +993,12 @@ bool JVMFlag::wasSetOnCmdline(const char* name, bool* value) { return true; } +bool JVMFlagEx::is_jimage_resource(JVMFlags flag) { + assert((size_t)flag < JVMFlag::numFlags, "bad command line flag index"); + JVMFlag* f = &JVMFlag::flags[flag]; + return f->is_jimage_resource(); +} + void JVMFlagEx::setOnCmdLine(JVMFlagsWithType flag) { JVMFlag* faddr = address_of_flag(flag); assert(faddr != NULL, "Unknown flag"); diff --git a/src/hotspot/share/runtime/flags/jvmFlag.hpp b/src/hotspot/share/runtime/flags/jvmFlag.hpp index 52151bdda7d5006ef3c845e0fed9bb95f2ffcfdb..c0854b33c01b47fb623bb5f91ebb1e01694df8c5 100644 --- a/src/hotspot/share/runtime/flags/jvmFlag.hpp +++ b/src/hotspot/share/runtime/flags/jvmFlag.hpp @@ -175,6 +175,7 @@ struct JVMFlag { bool is_default(); bool is_ergonomic(); + bool is_jimage_resource(); bool is_command_line(); void set_command_line(); diff --git a/src/hotspot/share/runtime/globals_extension.hpp b/src/hotspot/share/runtime/globals_extension.hpp index 0297b3d08dbc6260901f87674b80acf8e4c43d85..02491f6c783cf161a9a3dc7789a2d8e302a73e86 100644 --- a/src/hotspot/share/runtime/globals_extension.hpp +++ b/src/hotspot/share/runtime/globals_extension.hpp @@ -299,6 +299,7 @@ typedef enum { #define FLAG_IS_DEFAULT(name) (JVMFlagEx::is_default(FLAG_MEMBER(name))) #define FLAG_IS_ERGO(name) (JVMFlagEx::is_ergo(FLAG_MEMBER(name))) #define FLAG_IS_CMDLINE(name) (JVMFlagEx::is_cmdline(FLAG_MEMBER(name))) +#define FLAG_IS_JIMAGE_RESOURCE(name) (JVMFlagEx::is_jimage_resource(FLAG_MEMBER(name))) #define FLAG_SET_DEFAULT(name, value) ((name) = (value)) @@ -330,6 +331,7 @@ class JVMFlagEx : JVMFlag { static bool is_default(JVMFlags flag); static bool is_ergo(JVMFlags flag); static bool is_cmdline(JVMFlags flag); + static bool is_jimage_resource(JVMFlags flag); static void setOnCmdLine(JVMFlagsWithType flag); };