Merge

Fri, 28 Aug 2020 07:33:24 +0100

author
andrew
date
Fri, 28 Aug 2020 07:33:24 +0100
changeset 14176
060a9636fe44
parent 14173
f88390a07754
parent 14175
b52035c5f3fa
child 14177
ef41e0d32c15

Merge

     1.1 --- a/make/mapfiles/libmanagement/mapfile-vers	Thu Aug 27 06:13:12 2020 +0100
     1.2 +++ b/make/mapfiles/libmanagement/mapfile-vers	Fri Aug 28 07:33:24 2020 +0100
     1.3 @@ -28,15 +28,17 @@
     1.4  SUNWprivate_1.1 {
     1.5  	global:
     1.6  	    Java_sun_management_OperatingSystemImpl_getCommittedVirtualMemorySize;
     1.7 -	    Java_sun_management_OperatingSystemImpl_getFreePhysicalMemorySize;
     1.8 -	    Java_sun_management_OperatingSystemImpl_getFreeSwapSpaceSize;
     1.9 +	    Java_sun_management_OperatingSystemImpl_getFreePhysicalMemorySize0;
    1.10 +	    Java_sun_management_OperatingSystemImpl_getFreeSwapSpaceSize0;
    1.11  	    Java_sun_management_OperatingSystemImpl_getMaxFileDescriptorCount;
    1.12  	    Java_sun_management_OperatingSystemImpl_getOpenFileDescriptorCount;
    1.13  	    Java_sun_management_OperatingSystemImpl_getProcessCpuLoad;
    1.14  	    Java_sun_management_OperatingSystemImpl_getProcessCpuTime;
    1.15 -	    Java_sun_management_OperatingSystemImpl_getSystemCpuLoad;
    1.16 -	    Java_sun_management_OperatingSystemImpl_getTotalPhysicalMemorySize;
    1.17 -	    Java_sun_management_OperatingSystemImpl_getTotalSwapSpaceSize;
    1.18 +	    Java_sun_management_OperatingSystemImpl_getSystemCpuLoad0;
    1.19 +	    Java_sun_management_OperatingSystemImpl_getTotalPhysicalMemorySize0;
    1.20 +	    Java_sun_management_OperatingSystemImpl_getTotalSwapSpaceSize0;
    1.21 +	    Java_sun_management_OperatingSystemImpl_getSingleCpuLoad0;
    1.22 +	    Java_sun_management_OperatingSystemImpl_getHostConfiguredCpuCount0;
    1.23  	    Java_sun_management_OperatingSystemImpl_initialize;
    1.24  	    Java_sun_management_ClassLoadingImpl_setVerboseClass;
    1.25              Java_sun_management_DiagnosticCommandImpl_executeDiagnosticCommand;
     2.1 --- a/src/aix/native/sun/management/AixOperatingSystem.c	Thu Aug 27 06:13:12 2020 +0100
     2.2 +++ b/src/aix/native/sun/management/AixOperatingSystem.c	Fri Aug 28 07:33:24 2020 +0100
     2.3 @@ -1,5 +1,5 @@
     2.4  /*
     2.5 - * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
     2.6 + * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
     2.7   * Copyright 2017 SAP SE. All rights reserved.
     2.8   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     2.9   *
    2.10 @@ -27,7 +27,7 @@
    2.11  #include "sun_management_OperatingSystemImpl.h"
    2.12  
    2.13  JNIEXPORT jdouble JNICALL
    2.14 -Java_sun_management_OperatingSystemImpl_getSystemCpuLoad
    2.15 +Java_sun_management_OperatingSystemImpl_getSystemCpuLoad0
    2.16  (JNIEnv *env, jobject dummy)
    2.17  {
    2.18    return -1.0;
     3.1 --- a/src/linux/classes/jdk/internal/platform/cgroupv1/Metrics.java	Thu Aug 27 06:13:12 2020 +0100
     3.2 +++ b/src/linux/classes/jdk/internal/platform/cgroupv1/Metrics.java	Fri Aug 28 07:33:24 2020 +0100
     3.3 @@ -31,6 +31,9 @@
     3.4  import java.nio.file.Files;
     3.5  import java.nio.file.Path;
     3.6  import java.nio.file.Paths;
     3.7 +import java.security.AccessController;
     3.8 +import java.security.PrivilegedActionException;
     3.9 +import java.security.PrivilegedExceptionAction;
    3.10  import java.util.stream.Stream;
    3.11  
    3.12  public class Metrics implements jdk.internal.platform.Metrics {
    3.13 @@ -73,7 +76,7 @@
    3.14           * 34 28 0:29 / /sys/fs/cgroup/MemorySubSystem rw,nosuid,nodev,noexec,relatime shared:16 - cgroup cgroup rw,MemorySubSystem
    3.15           */
    3.16          try (Stream<String> lines =
    3.17 -             Files.lines(Paths.get("/proc/self/mountinfo"))) {
    3.18 +             readFilePrivileged(Paths.get("/proc/self/mountinfo"))) {
    3.19  
    3.20              lines.filter(line -> line.contains(" - cgroup "))
    3.21                   .map(line -> line.split(" "))
    3.22 @@ -107,7 +110,7 @@
    3.23           *
    3.24           */
    3.25          try (Stream<String> lines =
    3.26 -             Files.lines(Paths.get("/proc/self/cgroup"))) {
    3.27 +             readFilePrivileged(Paths.get("/proc/self/cgroup"))) {
    3.28  
    3.29              lines.map(line -> line.split(":"))
    3.30                   .filter(line -> (line.length >= 3))
    3.31 @@ -125,6 +128,25 @@
    3.32          return null;
    3.33      }
    3.34  
    3.35 +    static Stream<String> readFilePrivileged(Path path) throws IOException {
    3.36 +        try {
    3.37 +            PrivilegedExceptionAction<Stream<String>> pea = () -> Files.lines(path);
    3.38 +            return AccessController.doPrivileged(pea);
    3.39 +        } catch (PrivilegedActionException e) {
    3.40 +            unwrapIOExceptionAndRethrow(e);
    3.41 +            throw new InternalError(e.getCause());
    3.42 +        }
    3.43 +    }
    3.44 +
    3.45 +    static void unwrapIOExceptionAndRethrow(PrivilegedActionException pae) throws IOException {
    3.46 +        Throwable x = pae.getCause();
    3.47 +        if (x instanceof IOException)
    3.48 +            throw (IOException) x;
    3.49 +        if (x instanceof RuntimeException)
    3.50 +            throw (RuntimeException) x;
    3.51 +        if (x instanceof Error)
    3.52 +            throw (Error) x;
    3.53 +    }
    3.54      /**
    3.55       * createSubSystem objects and initialize mount points
    3.56       */
     4.1 --- a/src/linux/classes/jdk/internal/platform/cgroupv1/SubSystem.java	Thu Aug 27 06:13:12 2020 +0100
     4.2 +++ b/src/linux/classes/jdk/internal/platform/cgroupv1/SubSystem.java	Fri Aug 28 07:33:24 2020 +0100
     4.3 @@ -30,6 +30,9 @@
     4.4  import java.nio.file.Files;
     4.5  import java.nio.file.Path;
     4.6  import java.nio.file.Paths;
     4.7 +import java.security.AccessController;
     4.8 +import java.security.PrivilegedActionException;
     4.9 +import java.security.PrivilegedExceptionAction;
    4.10  import java.util.ArrayList;
    4.11  import java.util.Optional;
    4.12  import java.util.stream.Stream;
    4.13 @@ -88,14 +91,24 @@
    4.14      public static String getStringValue(SubSystem subsystem, String parm) {
    4.15          if (subsystem == null) return null;
    4.16  
    4.17 -        try(BufferedReader bufferedReader = Files.newBufferedReader(Paths.get(subsystem.path(), parm))) {
    4.18 +        try {
    4.19 +            return subsystem.readStringValue(parm);
    4.20 +        } catch (IOException e) {
    4.21 +            return null;
    4.22 +        }
    4.23 +    }
    4.24 +
    4.25 +    private String readStringValue(String param) throws IOException {
    4.26 +        PrivilegedExceptionAction<BufferedReader> pea = () ->
    4.27 +                Files.newBufferedReader(Paths.get(path(), param));
    4.28 +        try (BufferedReader bufferedReader =
    4.29 +                     AccessController.doPrivileged(pea)) {
    4.30              String line = bufferedReader.readLine();
    4.31              return line;
    4.32 +        } catch (PrivilegedActionException e) {
    4.33 +            Metrics.unwrapIOExceptionAndRethrow(e);
    4.34 +            throw new InternalError(e.getCause());
    4.35          }
    4.36 -        catch (IOException e) {
    4.37 -            return null;
    4.38 -        }
    4.39 -
    4.40      }
    4.41  
    4.42      public static long getLongValue(SubSystem subsystem, String parm) {
    4.43 @@ -136,7 +149,7 @@
    4.44  
    4.45          if (subsystem == null) return 0L;
    4.46  
    4.47 -        try (Stream<String> lines = Files.lines(Paths.get(subsystem.path(), parm))) {
    4.48 +        try (Stream<String> lines = Metrics.readFilePrivileged(Paths.get(subsystem.path(), parm))) {
    4.49  
    4.50              Optional<String> result = lines.map(line -> line.split(" "))
    4.51                                             .filter(line -> (line.length == 2 &&
     5.1 --- a/src/share/classes/com/sun/management/OperatingSystemMXBean.java	Thu Aug 27 06:13:12 2020 +0100
     5.2 +++ b/src/share/classes/com/sun/management/OperatingSystemMXBean.java	Fri Aug 28 07:33:24 2020 +0100
     5.3 @@ -1,5 +1,5 @@
     5.4  /*
     5.5 - * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
     5.6 + * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
     5.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     5.8   *
     5.9   * This code is free software; you can redistribute it and/or modify it
    5.10 @@ -30,6 +30,12 @@
    5.11   * on which the Java virtual machine is running.
    5.12   *
    5.13   * <p>
    5.14 + * This interface provides information about the operating environment
    5.15 + * on which the Java virtual machine is running. That might be a native
    5.16 + * operating system, a virtualized operating system environment, or a
    5.17 + * container-managed environment.
    5.18 + *
    5.19 + * <p>
    5.20   * The <tt>OperatingSystemMXBean</tt> object returned by
    5.21   * {@link java.lang.management.ManagementFactory#getOperatingSystemMXBean()}
    5.22   * is an instance of the implementation class of this interface
     6.1 --- a/src/solaris/classes/sun/management/OperatingSystemImpl.java	Thu Aug 27 06:13:12 2020 +0100
     6.2 +++ b/src/solaris/classes/sun/management/OperatingSystemImpl.java	Fri Aug 28 07:33:24 2020 +0100
     6.3 @@ -1,5 +1,5 @@
     6.4  /*
     6.5 - * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
     6.6 + * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
     6.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     6.8   *
     6.9   * This code is free software; you can redistribute it and/or modify it
    6.10 @@ -25,6 +25,9 @@
    6.11  
    6.12  package sun.management;
    6.13  
    6.14 +import jdk.internal.platform.Metrics;
    6.15 +import java.util.concurrent.TimeUnit;
    6.16 +
    6.17  /**
    6.18   * Implementation class for the operating system.
    6.19   * Standard and committed hotspot-specific metrics if any.
    6.20 @@ -35,20 +38,134 @@
    6.21  class OperatingSystemImpl extends BaseOperatingSystemImpl
    6.22      implements com.sun.management.UnixOperatingSystemMXBean {
    6.23  
    6.24 +    private static final int MAX_ATTEMPTS_NUMBER = 10;
    6.25 +    private final Metrics containerMetrics;
    6.26 +
    6.27      OperatingSystemImpl(VMManagement vm) {
    6.28          super(vm);
    6.29 +        this.containerMetrics = jdk.internal.platform.Container.metrics();
    6.30 +    }
    6.31 +
    6.32 +    public long getTotalSwapSpaceSize() {
    6.33 +        if (containerMetrics != null) {
    6.34 +            long limit = containerMetrics.getMemoryAndSwapLimit();
    6.35 +            // The memory limit metrics is not available if JVM runs on Linux host (not in a docker container)
    6.36 +            // or if a docker container was started without specifying a memory limit (without '--memory='
    6.37 +            // Docker option). In latter case there is no limit on how much memory the container can use and
    6.38 +            // it can use as much memory as the host's OS allows.
    6.39 +            long memLimit = containerMetrics.getMemoryLimit();
    6.40 +            if (limit >= 0 && memLimit >= 0) {
    6.41 +                return limit - memLimit;
    6.42 +            }
    6.43 +        }
    6.44 +        return getTotalSwapSpaceSize0();
    6.45 +    }
    6.46 +
    6.47 +    public long getFreeSwapSpaceSize() {
    6.48 +        if (containerMetrics != null) {
    6.49 +            long memSwapLimit = containerMetrics.getMemoryAndSwapLimit();
    6.50 +            long memLimit = containerMetrics.getMemoryLimit();
    6.51 +            if (memSwapLimit >= 0 && memLimit >= 0) {
    6.52 +                for (int attempt = 0; attempt < MAX_ATTEMPTS_NUMBER; attempt++) {
    6.53 +                    long memSwapUsage = containerMetrics.getMemoryAndSwapUsage();
    6.54 +                    long memUsage = containerMetrics.getMemoryUsage();
    6.55 +                    if (memSwapUsage > 0 && memUsage > 0) {
    6.56 +                        // We read "memory usage" and "memory and swap usage" not atomically,
    6.57 +                        // and it's possible to get the negative value when subtracting these two.
    6.58 +                        // If this happens just retry the loop for a few iterations.
    6.59 +                        if ((memSwapUsage - memUsage) >= 0) {
    6.60 +                            return memSwapLimit - memLimit - (memSwapUsage - memUsage);
    6.61 +                        }
    6.62 +                    }
    6.63 +                }
    6.64 +            }
    6.65 +        }
    6.66 +        return getFreeSwapSpaceSize0();
    6.67 +    }
    6.68 +
    6.69 +    public long getFreePhysicalMemorySize() {
    6.70 +        if (containerMetrics != null) {
    6.71 +            long usage = containerMetrics.getMemoryUsage();
    6.72 +            long limit = containerMetrics.getMemoryLimit();
    6.73 +            if (usage > 0 && limit >= 0) {
    6.74 +                return limit - usage;
    6.75 +            }
    6.76 +        }
    6.77 +        return getFreePhysicalMemorySize0();
    6.78 +    }
    6.79 +
    6.80 +    public long getTotalPhysicalMemorySize() {
    6.81 +        if (containerMetrics != null) {
    6.82 +            long limit = containerMetrics.getMemoryLimit();
    6.83 +            if (limit >= 0) {
    6.84 +                return limit;
    6.85 +            }
    6.86 +        }
    6.87 +        return getTotalPhysicalMemorySize0();
    6.88 +    }
    6.89 +
    6.90 +    public double getSystemCpuLoad() {
    6.91 +        if (containerMetrics != null) {
    6.92 +            long quota = containerMetrics.getCpuQuota();
    6.93 +            if (quota > 0) {
    6.94 +                long periodLength = containerMetrics.getCpuPeriod();
    6.95 +                long numPeriods = containerMetrics.getCpuNumPeriods();
    6.96 +                long usageNanos = containerMetrics.getCpuUsage();
    6.97 +                if (periodLength > 0 && numPeriods > 0 && usageNanos > 0) {
    6.98 +                    long elapsedNanos = TimeUnit.MICROSECONDS.toNanos(periodLength * numPeriods);
    6.99 +                    double systemLoad = (double) usageNanos / elapsedNanos;
   6.100 +                    // Ensure the return value is in the range 0.0 -> 1.0
   6.101 +                    systemLoad = Math.max(0.0, systemLoad);
   6.102 +                    systemLoad = Math.min(1.0, systemLoad);
   6.103 +                    return systemLoad;
   6.104 +                }
   6.105 +                return -1;
   6.106 +            } else {
   6.107 +                // If CPU quotas are not active then find the average system load for
   6.108 +                // all online CPUs that are allowed to run this container.
   6.109 +
   6.110 +                // If the cpuset is the same as the host's one there is no need to iterate over each CPU
   6.111 +                if (isCpuSetSameAsHostCpuSet()) {
   6.112 +                    return getSystemCpuLoad0();
   6.113 +                } else {
   6.114 +                    int[] cpuSet = containerMetrics.getEffectiveCpuSetCpus();
   6.115 +                    if (cpuSet != null && cpuSet.length > 0) {
   6.116 +                        double systemLoad = 0.0;
   6.117 +                        for (int cpu : cpuSet) {
   6.118 +                            double cpuLoad = getSingleCpuLoad0(cpu);
   6.119 +                            if (cpuLoad < 0) {
   6.120 +                                return -1;
   6.121 +                            }
   6.122 +                            systemLoad += cpuLoad;
   6.123 +                        }
   6.124 +                        return systemLoad / cpuSet.length;
   6.125 +                    }
   6.126 +                    return -1;
   6.127 +                }
   6.128 +            }
   6.129 +        }
   6.130 +        return getSystemCpuLoad0();
   6.131 +    }
   6.132 +
   6.133 +    private boolean isCpuSetSameAsHostCpuSet() {
   6.134 +        if (containerMetrics != null) {
   6.135 +            return containerMetrics.getCpuSetCpus().length == getHostConfiguredCpuCount0();
   6.136 +        }
   6.137 +        return false;
   6.138      }
   6.139  
   6.140      public native long getCommittedVirtualMemorySize();
   6.141 -    public native long getTotalSwapSpaceSize();
   6.142 -    public native long getFreeSwapSpaceSize();
   6.143 +    private native long getTotalSwapSpaceSize0();
   6.144 +    private native long getFreeSwapSpaceSize0();
   6.145      public native long getProcessCpuTime();
   6.146 -    public native long getFreePhysicalMemorySize();
   6.147 -    public native long getTotalPhysicalMemorySize();
   6.148 +    private native long getFreePhysicalMemorySize0();
   6.149 +    private native long getTotalPhysicalMemorySize0();
   6.150      public native long getOpenFileDescriptorCount();
   6.151      public native long getMaxFileDescriptorCount();
   6.152 -    public native double getSystemCpuLoad();
   6.153 +    private native double getSystemCpuLoad0();
   6.154      public native double getProcessCpuLoad();
   6.155 +    private native double getSingleCpuLoad0(int cpuNum);
   6.156 +    private native int getHostConfiguredCpuCount0();
   6.157  
   6.158      static {
   6.159          initialize();
     7.1 --- a/src/solaris/native/sun/management/LinuxOperatingSystem.c	Thu Aug 27 06:13:12 2020 +0100
     7.2 +++ b/src/solaris/native/sun/management/LinuxOperatingSystem.c	Fri Aug 28 07:33:24 2020 +0100
     7.3 @@ -1,5 +1,5 @@
     7.4  /*
     7.5 - * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
     7.6 + * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
     7.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     7.8   *
     7.9   * This code is free software; you can redistribute it and/or modify it
    7.10 @@ -197,17 +197,20 @@
    7.11   * This method must be called first, before any data can be gathererd.
    7.12   */
    7.13  int perfInit() {
    7.14 -    static int initialized=1;
    7.15 +    static int initialized = 0;
    7.16  
    7.17      if (!initialized) {
    7.18          int  i;
    7.19  
    7.20 -        int n = sysconf(_SC_NPROCESSORS_ONLN);
    7.21 +        // We need to allocate counters for all CPUs, including ones that
    7.22 +        // are currently offline as they could be turned online later.
    7.23 +        int n = sysconf(_SC_NPROCESSORS_CONF);
    7.24          if (n <= 0) {
    7.25              n = 1;
    7.26          }
    7.27  
    7.28          counters.cpus = calloc(n,sizeof(ticks));
    7.29 +        counters.nProcs = n;
    7.30          if (counters.cpus != NULL)  {
    7.31              // For the CPU load
    7.32              get_totalticks(-1, &counters.cpuTicks);
    7.33 @@ -319,10 +322,10 @@
    7.34  }
    7.35  
    7.36  JNIEXPORT jdouble JNICALL
    7.37 -Java_sun_management_OperatingSystemImpl_getSystemCpuLoad
    7.38 +Java_sun_management_OperatingSystemImpl_getSystemCpuLoad0
    7.39  (JNIEnv *env, jobject dummy)
    7.40  {
    7.41 -    if(perfInit() == 0) {
    7.42 +    if (perfInit() == 0) {
    7.43          return get_cpu_load(-1);
    7.44      } else {
    7.45          return -1.0;
    7.46 @@ -333,9 +336,31 @@
    7.47  Java_sun_management_OperatingSystemImpl_getProcessCpuLoad
    7.48  (JNIEnv *env, jobject dummy)
    7.49  {
    7.50 -    if(perfInit() == 0) {
    7.51 +    if (perfInit() == 0) {
    7.52          return get_process_load();
    7.53      } else {
    7.54          return -1.0;
    7.55      }
    7.56  }
    7.57 +
    7.58 +JNIEXPORT jdouble JNICALL
    7.59 +Java_sun_management_OperatingSystemImpl_getSingleCpuLoad0
    7.60 +(JNIEnv *env, jobject mbean, jint cpu_number)
    7.61 +{
    7.62 +    if (perfInit() == 0 && cpu_number >= 0 && cpu_number < counters.nProcs) {
    7.63 +        return get_cpu_load(cpu_number);
    7.64 +    } else {
    7.65 +        return -1.0;
    7.66 +    }
    7.67 +}
    7.68 +
    7.69 +JNIEXPORT jint JNICALL
    7.70 +Java_sun_management_OperatingSystemImpl_getHostConfiguredCpuCount0
    7.71 +(JNIEnv *env, jobject mbean)
    7.72 +{
    7.73 +    if (perfInit() == 0) {
    7.74 +        return counters.nProcs;
    7.75 +    } else {
    7.76 +       return -1;
    7.77 +    }
    7.78 +}
     8.1 --- a/src/solaris/native/sun/management/MacosxOperatingSystem.c	Thu Aug 27 06:13:12 2020 +0100
     8.2 +++ b/src/solaris/native/sun/management/MacosxOperatingSystem.c	Fri Aug 28 07:33:24 2020 +0100
     8.3 @@ -1,5 +1,5 @@
     8.4  /*
     8.5 - * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
     8.6 + * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
     8.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     8.8   *
     8.9   * This code is free software; you can redistribute it and/or modify it
    8.10 @@ -31,7 +31,7 @@
    8.11  
    8.12  
    8.13  JNIEXPORT jdouble JNICALL
    8.14 -Java_sun_management_OperatingSystemImpl_getSystemCpuLoad
    8.15 +Java_sun_management_OperatingSystemImpl_getSystemCpuLoad0
    8.16  (JNIEnv *env, jobject dummy)
    8.17  {
    8.18      // This code is influenced by the darwin top source
     9.1 --- a/src/solaris/native/sun/management/OperatingSystemImpl.c	Thu Aug 27 06:13:12 2020 +0100
     9.2 +++ b/src/solaris/native/sun/management/OperatingSystemImpl.c	Fri Aug 28 07:33:24 2020 +0100
     9.3 @@ -1,5 +1,5 @@
     9.4  /*
     9.5 - * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
     9.6 + * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
     9.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     9.8   *
     9.9   * This code is free software; you can redistribute it and/or modify it
    9.10 @@ -253,14 +253,14 @@
    9.11  }
    9.12  
    9.13  JNIEXPORT jlong JNICALL
    9.14 -Java_sun_management_OperatingSystemImpl_getTotalSwapSpaceSize
    9.15 +Java_sun_management_OperatingSystemImpl_getTotalSwapSpaceSize0
    9.16    (JNIEnv *env, jobject mbean)
    9.17  {
    9.18      return get_total_or_available_swap_space_size(env, JNI_FALSE);
    9.19  }
    9.20  
    9.21  JNIEXPORT jlong JNICALL
    9.22 -Java_sun_management_OperatingSystemImpl_getFreeSwapSpaceSize
    9.23 +Java_sun_management_OperatingSystemImpl_getFreeSwapSpaceSize0
    9.24    (JNIEnv *env, jobject mbean)
    9.25  {
    9.26      return get_total_or_available_swap_space_size(env, JNI_TRUE);
    9.27 @@ -309,7 +309,7 @@
    9.28  }
    9.29  
    9.30  JNIEXPORT jlong JNICALL
    9.31 -Java_sun_management_OperatingSystemImpl_getFreePhysicalMemorySize
    9.32 +Java_sun_management_OperatingSystemImpl_getFreePhysicalMemorySize0
    9.33    (JNIEnv *env, jobject mbean)
    9.34  {
    9.35  #ifdef __APPLE__
    9.36 @@ -343,7 +343,7 @@
    9.37  }
    9.38  
    9.39  JNIEXPORT jlong JNICALL
    9.40 -Java_sun_management_OperatingSystemImpl_getTotalPhysicalMemorySize
    9.41 +Java_sun_management_OperatingSystemImpl_getTotalPhysicalMemorySize0
    9.42    (JNIEnv *env, jobject mbean)
    9.43  {
    9.44  #ifdef _ALLBSD_SOURCE
    9.45 @@ -462,6 +462,22 @@
    9.46  #endif
    9.47  }
    9.48  
    9.49 +#ifndef __linux__
    9.50 +JNIEXPORT jdouble JNICALL
    9.51 +Java_sun_management_OperatingSystemImpl_getSingleCpuLoad0
    9.52 +  (JNIEnv *env, jobject mbean, jint cpu_number)
    9.53 +{
    9.54 +    return -1.0;
    9.55 +}
    9.56 +
    9.57 +JNIEXPORT jint JNICALL
    9.58 +Java_sun_management_OperatingSystemImpl_getHostConfiguredCpuCount0
    9.59 +  (JNIEnv *env, jobject mbean)
    9.60 +{
    9.61 +    return -1;
    9.62 +}
    9.63 +#endif
    9.64 +
    9.65  JNIEXPORT jlong JNICALL
    9.66  Java_sun_management_OperatingSystemImpl_getMaxFileDescriptorCount
    9.67    (JNIEnv *env, jobject mbean)
    10.1 --- a/src/solaris/native/sun/management/SolarisOperatingSystem.c	Thu Aug 27 06:13:12 2020 +0100
    10.2 +++ b/src/solaris/native/sun/management/SolarisOperatingSystem.c	Fri Aug 28 07:33:24 2020 +0100
    10.3 @@ -1,5 +1,5 @@
    10.4  /*
    10.5 - * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
    10.6 + * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
    10.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    10.8   *
    10.9   * This code is free software; you can redistribute it and/or modify it
   10.10 @@ -226,7 +226,7 @@
   10.11  }
   10.12  
   10.13  JNIEXPORT jdouble JNICALL
   10.14 -Java_sun_management_OperatingSystemImpl_getSystemCpuLoad
   10.15 +Java_sun_management_OperatingSystemImpl_getSystemCpuLoad0
   10.16  (JNIEnv *env, jobject dummy)
   10.17  {
   10.18      return get_cpu_load(-1);
    11.1 --- a/test/jdk/internal/platform/docker/Dockerfile-BasicTest	Thu Aug 27 06:13:12 2020 +0100
    11.2 +++ b/test/jdk/internal/platform/docker/Dockerfile-BasicTest	Fri Aug 28 07:33:24 2020 +0100
    11.3 @@ -1,4 +1,4 @@
    11.4 -FROM oraclelinux:7.2
    11.5 +FROM oraclelinux:7.6
    11.6  MAINTAINER mikhailo.seledtsov@oracle.com
    11.7  
    11.8  COPY /jdk /jdk

mercurial