< prev index next >

src/hotspot/os/linux/cgroupSubsystem_linux.hpp

Print this page

 85   bool is_ok;                                                                         \
 86   is_ok = controller->read_number_handle_max(filename, &retval);                      \
 87   if (!is_ok) {                                                                       \
 88     log_trace(os, container)(log_string " failed: %d", OSCONTAINER_ERROR);            \
 89     return OSCONTAINER_ERROR;                                                         \
 90   }                                                                                   \
 91   log_trace(os, container)(log_string " is: " JLONG_FORMAT, retval);                  \
 92 }
 93 
 94 #define CONTAINER_READ_STRING_CHECKED(controller, filename, log_string, retval, buf_size) \
 95 {                                                                                         \
 96   bool is_ok;                                                                             \
 97   is_ok = controller->read_string(filename, retval, buf_size);                            \
 98   if (!is_ok) {                                                                           \
 99     log_trace(os, container)(log_string " failed: %d", OSCONTAINER_ERROR);                \
100     return nullptr;                                                                       \
101   }                                                                                       \
102   log_trace(os, container)(log_string " is: %s", retval);                                 \
103 }
104 












105 class CgroupController: public CHeapObj<mtInternal> {
106   protected:
107     char* _cgroup_path;
108     char* _mount_point;
109   public:
110     virtual const char* subsystem_path() = 0;
111     virtual bool is_read_only() = 0;
112     const char* cgroup_path() { return _cgroup_path; }
113     const char* mount_point() { return _mount_point; }
114     virtual bool needs_hierarchy_adjustment() { return false; }
115 
116     /* Read a numerical value as unsigned long
117      *
118      * returns: false if any error occurred. true otherwise and
119      * the parsed value is set in the provided julong pointer.
120      */
121     bool read_number(const char* filename, julong* result);
122 
123     /* Convenience method to deal with numbers as well as the string 'max'
124      * in interface files. Otherwise same as read_number().

 85   bool is_ok;                                                                         \
 86   is_ok = controller->read_number_handle_max(filename, &retval);                      \
 87   if (!is_ok) {                                                                       \
 88     log_trace(os, container)(log_string " failed: %d", OSCONTAINER_ERROR);            \
 89     return OSCONTAINER_ERROR;                                                         \
 90   }                                                                                   \
 91   log_trace(os, container)(log_string " is: " JLONG_FORMAT, retval);                  \
 92 }
 93 
 94 #define CONTAINER_READ_STRING_CHECKED(controller, filename, log_string, retval, buf_size) \
 95 {                                                                                         \
 96   bool is_ok;                                                                             \
 97   is_ok = controller->read_string(filename, retval, buf_size);                            \
 98   if (!is_ok) {                                                                           \
 99     log_trace(os, container)(log_string " failed: %d", OSCONTAINER_ERROR);                \
100     return nullptr;                                                                       \
101   }                                                                                       \
102   log_trace(os, container)(log_string " is: %s", retval);                                 \
103 }
104 
105 #define CONTAINER_READ_NUMERICAL_KEY_VALUE_CHECKED(controller, filename, key, log_string, retval) \
106 {                                                                                     \
107   bool is_ok;                                                                         \
108   is_ok = controller->read_numerical_key_value(filename, key, &retval);               \
109   if (!is_ok) {                                                                       \
110     log_trace(os, container)(log_string " failed: %d", OSCONTAINER_ERROR);            \
111     return OSCONTAINER_ERROR;                                                         \
112   }                                                                                   \
113   log_trace(os, container)(log_string " is: " JULONG_FORMAT, retval);                 \
114 }
115 
116 
117 class CgroupController: public CHeapObj<mtInternal> {
118   protected:
119     char* _cgroup_path;
120     char* _mount_point;
121   public:
122     virtual const char* subsystem_path() = 0;
123     virtual bool is_read_only() = 0;
124     const char* cgroup_path() { return _cgroup_path; }
125     const char* mount_point() { return _mount_point; }
126     virtual bool needs_hierarchy_adjustment() { return false; }
127 
128     /* Read a numerical value as unsigned long
129      *
130      * returns: false if any error occurred. true otherwise and
131      * the parsed value is set in the provided julong pointer.
132      */
133     bool read_number(const char* filename, julong* result);
134 
135     /* Convenience method to deal with numbers as well as the string 'max'
136      * in interface files. Otherwise same as read_number().
< prev index next >