diff --git a/src/hotspot/os/linux/cgroupV2Subsystem_linux.cpp b/src/hotspot/os/linux/cgroupV2Subsystem_linux.cpp index 2883f6e7da518..62e8cac3a62b2 100644 --- a/src/hotspot/os/linux/cgroupV2Subsystem_linux.cpp +++ b/src/hotspot/os/linux/cgroupV2Subsystem_linux.cpp @@ -25,6 +25,22 @@ #include "cgroupV2Subsystem_linux.hpp" #include "cgroupUtil_linux.hpp" +// Constructor +CgroupV2Controller::CgroupV2Controller(char* mount_path, + char *cgroup_path, + bool ro) : _read_only(ro), + _path(construct_path(mount_path, cgroup_path)) { + _cgroup_path = os::strdup(cgroup_path); + _mount_point = os::strdup(mount_path); +} +// Shallow copy constructor +CgroupV2Controller::CgroupV2Controller(const CgroupV2Controller& o) : + _read_only(o._read_only), + _path(o._path) { + _cgroup_path = o._cgroup_path; + _mount_point = o._mount_point; +} + /* cpu_shares * * Return the amount of cpu shares available to the process diff --git a/src/hotspot/os/linux/cgroupV2Subsystem_linux.hpp b/src/hotspot/os/linux/cgroupV2Subsystem_linux.hpp index 2c362e2a1b472..3f869828c8b30 100644 --- a/src/hotspot/os/linux/cgroupV2Subsystem_linux.hpp +++ b/src/hotspot/os/linux/cgroupV2Subsystem_linux.hpp @@ -37,20 +37,9 @@ class CgroupV2Controller: public CgroupController { static char* construct_path(char* mount_path, const char *cgroup_path); public: - CgroupV2Controller(char* mount_path, - char *cgroup_path, - bool ro) : _read_only(ro), - _path(construct_path(mount_path, cgroup_path)) { - _cgroup_path = os::strdup(cgroup_path); - _mount_point = os::strdup(mount_path); - } + CgroupV2Controller(char* mount_path, char *cgroup_path, bool ro); // Shallow copy constructor - CgroupV2Controller(const CgroupV2Controller& o) : - _read_only(o._read_only), - _path(o._path) { - _cgroup_path = o._cgroup_path; - _mount_point = o._mount_point; - } + CgroupV2Controller(const CgroupV2Controller& o); ~CgroupV2Controller() { // At least one controller exists with references to the paths }