Don't ever print RLIM_INFINITY in a confusing way
This commit is contained in:
parent
b7163c4a71
commit
a95528e247
|
@ -39,6 +39,7 @@ final class JNACLibrary {
|
|||
public static final int MCL_CURRENT = 1;
|
||||
public static final int ENOMEM = 12;
|
||||
public static final int RLIMIT_MEMLOCK = Constants.MAC_OS_X ? 6 : 8;
|
||||
public static final long RLIM_INFINITY = Constants.MAC_OS_X ? 9223372036854775807L : -1L;
|
||||
|
||||
static {
|
||||
try {
|
||||
|
|
|
@ -75,13 +75,23 @@ class JNANatives {
|
|||
logger.warn("Unable to lock JVM Memory: error=" + errno + ",reason=" + errMsg + ". This can result in part of the JVM being swapped out");
|
||||
if (errno == JNACLibrary.ENOMEM) {
|
||||
if (rlimitSuccess) {
|
||||
logger.warn("Increase RLIMIT_MEMLOCK (ulimit). soft limit:" + softLimit + ", hard limit:" + hardLimit);
|
||||
logger.warn("Increase RLIMIT_MEMLOCK (ulimit). soft limit: " + rlimitToString(softLimit) + ", hard limit: " + rlimitToString(hardLimit));
|
||||
} else {
|
||||
logger.warn("Increase RLIMIT_MEMLOCK (ulimit).");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static String rlimitToString(long value) {
|
||||
assert Constants.LINUX || Constants.MAC_OS_X;
|
||||
if (value == JNACLibrary.RLIM_INFINITY) {
|
||||
return "unlimited";
|
||||
} else {
|
||||
// TODO, on java 8 use Long.toUnsignedString, since thats what it is.
|
||||
return Long.toString(value);
|
||||
}
|
||||
}
|
||||
|
||||
/** Returns true if user is root, false if not, or if we don't know */
|
||||
static boolean definitelyRunningAsRoot() {
|
||||
if (Constants.WINDOWS) {
|
||||
|
|
Loading…
Reference in New Issue