8022323: [JavaSecurityScanner] review package com.sun.management.* Native methods should be private
authordsamersoff
Tue, 28 Jan 2014 12:50:53 +0400
changeset 22583 e7d5af0b11e9
parent 22582 590b12d10fea
child 22584 eed64ee05369
8022323: [JavaSecurityScanner] review package com.sun.management.* Native methods should be private Summary: create java methods that calls native one Reviewed-by: sla, dholmes
jdk/make/mapfiles/libmanagement/mapfile-vers
jdk/src/solaris/classes/sun/management/OperatingSystemImpl.java
jdk/src/solaris/native/sun/management/LinuxOperatingSystem.c
jdk/src/solaris/native/sun/management/MacosxOperatingSystem.c
jdk/src/solaris/native/sun/management/OperatingSystemImpl.c
jdk/src/solaris/native/sun/management/SolarisOperatingSystem.c
jdk/src/windows/classes/sun/management/OperatingSystemImpl.java
jdk/src/windows/native/sun/management/OperatingSystemImpl.c
--- a/jdk/make/mapfiles/libmanagement/mapfile-vers	Mon Jan 27 16:22:08 2014 -0800
+++ b/jdk/make/mapfiles/libmanagement/mapfile-vers	Tue Jan 28 12:50:53 2014 +0400
@@ -27,17 +27,17 @@
 
 SUNWprivate_1.1 {
 	global:
-	    Java_sun_management_OperatingSystemImpl_getCommittedVirtualMemorySize;
-	    Java_sun_management_OperatingSystemImpl_getFreePhysicalMemorySize;
-	    Java_sun_management_OperatingSystemImpl_getFreeSwapSpaceSize;
-	    Java_sun_management_OperatingSystemImpl_getMaxFileDescriptorCount;
-	    Java_sun_management_OperatingSystemImpl_getOpenFileDescriptorCount;
-	    Java_sun_management_OperatingSystemImpl_getProcessCpuLoad;
-	    Java_sun_management_OperatingSystemImpl_getProcessCpuTime;
-	    Java_sun_management_OperatingSystemImpl_getSystemCpuLoad;
-	    Java_sun_management_OperatingSystemImpl_getTotalPhysicalMemorySize;
-	    Java_sun_management_OperatingSystemImpl_getTotalSwapSpaceSize;
-	    Java_sun_management_OperatingSystemImpl_initialize;
+	    Java_sun_management_OperatingSystemImpl_getCommittedVirtualMemorySize0;
+	    Java_sun_management_OperatingSystemImpl_getFreePhysicalMemorySize0;
+	    Java_sun_management_OperatingSystemImpl_getFreeSwapSpaceSize0;
+	    Java_sun_management_OperatingSystemImpl_getMaxFileDescriptorCount0;
+	    Java_sun_management_OperatingSystemImpl_getOpenFileDescriptorCount0;
+	    Java_sun_management_OperatingSystemImpl_getProcessCpuLoad0;
+	    Java_sun_management_OperatingSystemImpl_getProcessCpuTime0;
+	    Java_sun_management_OperatingSystemImpl_getSystemCpuLoad0;
+	    Java_sun_management_OperatingSystemImpl_getTotalPhysicalMemorySize0;
+	    Java_sun_management_OperatingSystemImpl_getTotalSwapSpaceSize0;
+	    Java_sun_management_OperatingSystemImpl_initialize0;
 	    Java_sun_management_ClassLoadingImpl_setVerboseClass;
             Java_sun_management_DiagnosticCommandImpl_executeDiagnosticCommand;
             Java_sun_management_DiagnosticCommandImpl_getDiagnosticCommands;
--- a/jdk/src/solaris/classes/sun/management/OperatingSystemImpl.java	Mon Jan 27 16:22:08 2014 -0800
+++ b/jdk/src/solaris/classes/sun/management/OperatingSystemImpl.java	Tue Jan 28 12:50:53 2014 +0400
@@ -39,19 +39,61 @@
         super(vm);
     }
 
-    public native long getCommittedVirtualMemorySize();
-    public native long getTotalSwapSpaceSize();
-    public native long getFreeSwapSpaceSize();
-    public native long getProcessCpuTime();
-    public native long getFreePhysicalMemorySize();
-    public native long getTotalPhysicalMemorySize();
-    public native long getOpenFileDescriptorCount();
-    public native long getMaxFileDescriptorCount();
-    public native double getSystemCpuLoad();
-    public native double getProcessCpuLoad();
+    public long getCommittedVirtualMemorySize() {
+        return getCommittedVirtualMemorySize0();
+    }
+
+    public long getTotalSwapSpaceSize() {
+        return getTotalSwapSpaceSize0();
+    }
+
+    public long getFreeSwapSpaceSize() {
+        return getFreeSwapSpaceSize0();
+    }
+
+    public long getProcessCpuTime() {
+        return getProcessCpuTime0();
+    }
+
+    public long getFreePhysicalMemorySize() {
+        return getFreePhysicalMemorySize0();
+    }
+
+    public long getTotalPhysicalMemorySize() {
+        return getTotalPhysicalMemorySize0();
+    }
+
+    public long getOpenFileDescriptorCount() {
+        return getOpenFileDescriptorCount0();
+    }
+
+    public long getMaxFileDescriptorCount() {
+        return getMaxFileDescriptorCount0();
+    }
+
+    public double getSystemCpuLoad() {
+        return getSystemCpuLoad0();
+    }
+
+    public double getProcessCpuLoad() {
+        return getProcessCpuLoad0();
+    }
+
+    /* native methods */
+    private native long getCommittedVirtualMemorySize0();
+    private native long getFreePhysicalMemorySize0();
+    private native long getFreeSwapSpaceSize0();
+    private native long getMaxFileDescriptorCount0();
+    private native long getOpenFileDescriptorCount0();
+    private native long getProcessCpuTime0();
+    private native double getProcessCpuLoad0();
+    private native double getSystemCpuLoad0();
+    private native long getTotalPhysicalMemorySize0();
+    private native long getTotalSwapSpaceSize0();
 
     static {
-        initialize();
+        initialize0();
     }
-    private static native void initialize();
+
+    private static native void initialize0();
 }
--- a/jdk/src/solaris/native/sun/management/LinuxOperatingSystem.c	Mon Jan 27 16:22:08 2014 -0800
+++ b/jdk/src/solaris/native/sun/management/LinuxOperatingSystem.c	Tue Jan 28 12:50:53 2014 +0400
@@ -310,7 +310,7 @@
 }
 
 JNIEXPORT jdouble JNICALL
-Java_sun_management_OperatingSystemImpl_getSystemCpuLoad
+Java_sun_management_OperatingSystemImpl_getSystemCpuLoad0
 (JNIEnv *env, jobject dummy)
 {
     if(perfInit() == 0) {
@@ -321,7 +321,7 @@
 }
 
 JNIEXPORT jdouble JNICALL
-Java_sun_management_OperatingSystemImpl_getProcessCpuLoad
+Java_sun_management_OperatingSystemImpl_getProcessCpuLoad0
 (JNIEnv *env, jobject dummy)
 {
     if(perfInit() == 0) {
--- a/jdk/src/solaris/native/sun/management/MacosxOperatingSystem.c	Mon Jan 27 16:22:08 2014 -0800
+++ b/jdk/src/solaris/native/sun/management/MacosxOperatingSystem.c	Tue Jan 28 12:50:53 2014 +0400
@@ -31,7 +31,7 @@
 
 
 JNIEXPORT jdouble JNICALL
-Java_sun_management_OperatingSystemImpl_getSystemCpuLoad
+Java_sun_management_OperatingSystemImpl_getSystemCpuLoad0
 (JNIEnv *env, jobject dummy)
 {
     // This code is influenced by the darwin top source
@@ -83,7 +83,7 @@
 
 
 JNIEXPORT jdouble JNICALL
-Java_sun_management_OperatingSystemImpl_getProcessCpuLoad
+Java_sun_management_OperatingSystemImpl_getProcessCpuLoad0
 (JNIEnv *env, jobject dummy)
 {
     // This code is influenced by the darwin top source
--- a/jdk/src/solaris/native/sun/management/OperatingSystemImpl.c	Mon Jan 27 16:22:08 2014 -0800
+++ b/jdk/src/solaris/native/sun/management/OperatingSystemImpl.c	Tue Jan 28 12:50:53 2014 +0400
@@ -175,14 +175,14 @@
 }
 
 JNIEXPORT void JNICALL
-Java_sun_management_OperatingSystemImpl_initialize
+Java_sun_management_OperatingSystemImpl_initialize0
   (JNIEnv *env, jclass cls)
 {
     page_size = sysconf(_SC_PAGESIZE);
 }
 
 JNIEXPORT jlong JNICALL
-Java_sun_management_OperatingSystemImpl_getCommittedVirtualMemorySize
+Java_sun_management_OperatingSystemImpl_getCommittedVirtualMemorySize0
   (JNIEnv *env, jobject mbean)
 {
 #ifdef __solaris__
@@ -249,21 +249,21 @@
 }
 
 JNIEXPORT jlong JNICALL
-Java_sun_management_OperatingSystemImpl_getTotalSwapSpaceSize
+Java_sun_management_OperatingSystemImpl_getTotalSwapSpaceSize0
   (JNIEnv *env, jobject mbean)
 {
     return get_total_or_available_swap_space_size(env, JNI_FALSE);
 }
 
 JNIEXPORT jlong JNICALL
-Java_sun_management_OperatingSystemImpl_getFreeSwapSpaceSize
+Java_sun_management_OperatingSystemImpl_getFreeSwapSpaceSize0
   (JNIEnv *env, jobject mbean)
 {
     return get_total_or_available_swap_space_size(env, JNI_TRUE);
 }
 
 JNIEXPORT jlong JNICALL
-Java_sun_management_OperatingSystemImpl_getProcessCpuTime
+Java_sun_management_OperatingSystemImpl_getProcessCpuTime0
   (JNIEnv *env, jobject mbean)
 {
 #ifdef __APPLE__
@@ -305,7 +305,7 @@
 }
 
 JNIEXPORT jlong JNICALL
-Java_sun_management_OperatingSystemImpl_getFreePhysicalMemorySize
+Java_sun_management_OperatingSystemImpl_getFreePhysicalMemorySize0
   (JNIEnv *env, jobject mbean)
 {
 #ifdef __APPLE__
@@ -333,7 +333,7 @@
 }
 
 JNIEXPORT jlong JNICALL
-Java_sun_management_OperatingSystemImpl_getTotalPhysicalMemorySize
+Java_sun_management_OperatingSystemImpl_getTotalPhysicalMemorySize0
   (JNIEnv *env, jobject mbean)
 {
 #ifdef _ALLBSD_SOURCE
@@ -358,7 +358,7 @@
 
 
 JNIEXPORT jlong JNICALL
-Java_sun_management_OperatingSystemImpl_getOpenFileDescriptorCount
+Java_sun_management_OperatingSystemImpl_getOpenFileDescriptorCount0
   (JNIEnv *env, jobject mbean)
 {
 #ifdef __APPLE__
@@ -438,7 +438,7 @@
 }
 
 JNIEXPORT jlong JNICALL
-Java_sun_management_OperatingSystemImpl_getMaxFileDescriptorCount
+Java_sun_management_OperatingSystemImpl_getMaxFileDescriptorCount0
   (JNIEnv *env, jobject mbean)
 {
     struct rlimit rlp;
--- a/jdk/src/solaris/native/sun/management/SolarisOperatingSystem.c	Mon Jan 27 16:22:08 2014 -0800
+++ b/jdk/src/solaris/native/sun/management/SolarisOperatingSystem.c	Tue Jan 28 12:50:53 2014 +0400
@@ -226,14 +226,14 @@
 }
 
 JNIEXPORT jdouble JNICALL
-Java_sun_management_OperatingSystemImpl_getSystemCpuLoad
+Java_sun_management_OperatingSystemImpl_getSystemCpuLoad0
 (JNIEnv *env, jobject dummy)
 {
     return get_cpu_load(-1);
 }
 
 JNIEXPORT jdouble JNICALL
-Java_sun_management_OperatingSystemImpl_getProcessCpuLoad
+Java_sun_management_OperatingSystemImpl_getProcessCpuLoad0
 (JNIEnv *env, jobject dummy)
 {
     return get_process_load();
--- a/jdk/src/windows/classes/sun/management/OperatingSystemImpl.java	Mon Jan 27 16:22:08 2014 -0800
+++ b/jdk/src/windows/classes/sun/management/OperatingSystemImpl.java	Tue Jan 28 12:50:53 2014 +0400
@@ -50,18 +50,48 @@
             return getCommittedVirtualMemorySize0();
         }
     }
-    private native long getCommittedVirtualMemorySize0();
+
+    public long getTotalSwapSpaceSize() {
+        return getTotalSwapSpaceSize0();
+    }
+
+    public long getFreeSwapSpaceSize() {
+        return getFreeSwapSpaceSize0();
+    }
+
+    public long getProcessCpuTime() {
+        return getProcessCpuTime0();
+    }
+
+    public long getFreePhysicalMemorySize() {
+        return getFreePhysicalMemorySize0();
+    }
 
-    public native long getTotalSwapSpaceSize();
-    public native long getFreeSwapSpaceSize();
-    public native long getProcessCpuTime();
-    public native long getFreePhysicalMemorySize();
-    public native long getTotalPhysicalMemorySize();
-    public native double getSystemCpuLoad();
-    public native double getProcessCpuLoad();
+    public long getTotalPhysicalMemorySize() {
+        return getTotalPhysicalMemorySize0();
+    }
+
+    public double getSystemCpuLoad() {
+        return getSystemCpuLoad0();
+    }
+
+    public double getProcessCpuLoad() {
+        return getProcessCpuLoad0();
+    }
+
+    /* native methods */
+    private native long getCommittedVirtualMemorySize0();
+    private native long getFreePhysicalMemorySize0();
+    private native long getFreeSwapSpaceSize0();
+    private native double getProcessCpuLoad0();
+    private native long getProcessCpuTime0();
+    private native double getSystemCpuLoad0();
+    private native long getTotalPhysicalMemorySize0();
+    private native long getTotalSwapSpaceSize0();
 
     static {
-        initialize();
+        initialize0();
     }
-    private static native void initialize();
+
+    private static native void initialize0();
 }
--- a/jdk/src/windows/native/sun/management/OperatingSystemImpl.c	Mon Jan 27 16:22:08 2014 -0800
+++ b/jdk/src/windows/native/sun/management/OperatingSystemImpl.c	Tue Jan 28 12:50:53 2014 +0400
@@ -77,7 +77,7 @@
 int perfiInit(void);
 
 JNIEXPORT void JNICALL
-Java_sun_management_OperatingSystemImpl_initialize
+Java_sun_management_OperatingSystemImpl_initialize0
   (JNIEnv *env, jclass cls)
 {
     main_process = GetCurrentProcess();
@@ -97,7 +97,7 @@
 }
 
 JNIEXPORT jlong JNICALL
-Java_sun_management_OperatingSystemImpl_getTotalSwapSpaceSize
+Java_sun_management_OperatingSystemImpl_getTotalSwapSpaceSize0
   (JNIEnv *env, jobject mbean)
 {
     MEMORYSTATUSEX ms;
@@ -107,7 +107,7 @@
 }
 
 JNIEXPORT jlong JNICALL
-Java_sun_management_OperatingSystemImpl_getFreeSwapSpaceSize
+Java_sun_management_OperatingSystemImpl_getFreeSwapSpaceSize0
   (JNIEnv *env, jobject mbean)
 {
     MEMORYSTATUSEX ms;
@@ -117,7 +117,7 @@
 }
 
 JNIEXPORT jlong JNICALL
-Java_sun_management_OperatingSystemImpl_getProcessCpuTime
+Java_sun_management_OperatingSystemImpl_getProcessCpuTime0
   (JNIEnv *env, jobject mbean)
 {
 
@@ -136,7 +136,7 @@
 }
 
 JNIEXPORT jlong JNICALL
-Java_sun_management_OperatingSystemImpl_getFreePhysicalMemorySize
+Java_sun_management_OperatingSystemImpl_getFreePhysicalMemorySize0
   (JNIEnv *env, jobject mbean)
 {
     MEMORYSTATUSEX ms;
@@ -146,7 +146,7 @@
 }
 
 JNIEXPORT jlong JNICALL
-Java_sun_management_OperatingSystemImpl_getTotalPhysicalMemorySize
+Java_sun_management_OperatingSystemImpl_getTotalPhysicalMemorySize0
   (JNIEnv *env, jobject mbean)
 {
     MEMORYSTATUSEX ms;
@@ -927,14 +927,14 @@
 }
 
 JNIEXPORT jdouble JNICALL
-Java_sun_management_OperatingSystemImpl_getSystemCpuLoad
+Java_sun_management_OperatingSystemImpl_getSystemCpuLoad0
 (JNIEnv *env, jobject dummy)
 {
     return perfGetCPULoad(-1);
 }
 
 JNIEXPORT jdouble JNICALL
-Java_sun_management_OperatingSystemImpl_getProcessCpuLoad
+Java_sun_management_OperatingSystemImpl_getProcessCpuLoad0
 (JNIEnv *env, jobject dummy)
 {
     return perfGetProcessLoad();