|
|
@ -260,6 +260,7 @@ void load_global_cfg() {
|
|
|
|
|
|
|
|
|
|
|
|
void template_cfg(char* cmd) {
|
|
|
|
void template_cfg(char* cmd) {
|
|
|
|
int size = 0;
|
|
|
|
int size = 0;
|
|
|
|
|
|
|
|
int index = 0;
|
|
|
|
char** cfg = yon_config_load(cmd, &size);
|
|
|
|
char** cfg = yon_config_load(cmd, &size);
|
|
|
|
for (int index = 0; index < size; index++) {
|
|
|
|
for (int index = 0; index < size; index++) {
|
|
|
|
char* str_key_value = yon_char_new(cfg[index]);
|
|
|
|
char* str_key_value = yon_char_new(cfg[index]);
|
|
|
@ -270,45 +271,113 @@ void template_cfg(char* cmd) {
|
|
|
|
size_t length = strlen(str_key_value);
|
|
|
|
size_t length = strlen(str_key_value);
|
|
|
|
str_key_value = yon_char_divide(str_key_value, length-2);
|
|
|
|
str_key_value = yon_char_divide(str_key_value, length-2);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
str_split_value(str_key_value);
|
|
|
|
str_split_value(str_key_value, index);
|
|
|
|
|
|
|
|
index++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void str_split_value(char* values) {
|
|
|
|
void str_split_value(char* values, int index) {
|
|
|
|
char* new_value = yon_char_new(values);
|
|
|
|
char* new_value = yon_char_new(values);
|
|
|
|
int size = 0;
|
|
|
|
int size = 0;
|
|
|
|
|
|
|
|
char* key = NULL;
|
|
|
|
|
|
|
|
char* value = NULL;
|
|
|
|
char** arr_values = philos_str_split(new_value, &size, ",");
|
|
|
|
char** arr_values = philos_str_split(new_value, &size, ",");
|
|
|
|
if (arr_values == NULL) {
|
|
|
|
if (arr_values == NULL) {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
char* key = NULL;
|
|
|
|
char* value_i = NULL;
|
|
|
|
char* value = NULL;
|
|
|
|
for (int index_1 = 0; index_1 < size; index_1++) {
|
|
|
|
for (int index = 0; index < size; index++) {
|
|
|
|
value = arr_values[index_1];
|
|
|
|
value = arr_values[index];
|
|
|
|
|
|
|
|
key = yon_char_divide_search(value, "=", -1);
|
|
|
|
key = yon_char_divide_search(value, "=", -1);
|
|
|
|
if (yon_char_find_count(key, "MemoryHigh") != 0) {
|
|
|
|
if (yon_char_find_count(key, "MemoryHigh") != 0) {
|
|
|
|
|
|
|
|
set_pow_size(value, main_config.soft_raw_limit_size, main_config.soft_raw_limit, index);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (yon_char_find_count(key, "MemoryMax") != 0) {
|
|
|
|
else {
|
|
|
|
|
|
|
|
set_pow_size("-", main_config.soft_raw_limit_size, main_config.soft_raw_limit, index);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (yon_char_find_count(key, "MemoryMax") != 0) {
|
|
|
|
|
|
|
|
set_pow_size(value, main_config.hard_raw_limit_size, main_config.hard_raw_limit, index);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
set_pow_size("-", main_config.hard_raw_limit_size, main_config.hard_raw_limit, index);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (yon_char_find_count(key, "MemorySwapMax") != 0) {
|
|
|
|
|
|
|
|
set_pow_size(value, main_config.swap_size, main_config.swap, index);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
set_pow_size("-", main_config.swap_size, main_config.swap, index);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (yon_char_find_count(key, "CPUQuota") != 0) {
|
|
|
|
|
|
|
|
set_pow_size(value, main_config.cpu_limit_size, main_config.cpu_limit, index);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
set_pow_size("-", main_config.cpu_limit_size, main_config.cpu_limit, index);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (yon_char_find_count(key, "IOReadBandwidthMax") != 0) {
|
|
|
|
|
|
|
|
set_pow_size(value, main_config.i_o_limit_read_size, main_config.i_o_limit_read, index);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
set_pow_size("-", main_config.i_o_limit_read_size, main_config.i_o_limit_read, index);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (yon_char_find_count(key, "IOWriteBandwidthMax") != 0) {
|
|
|
|
|
|
|
|
set_pow_size(value, main_config.i_o_limit_write_size, main_config.i_o_limit_write, index);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
set_pow_size("-", main_config.i_o_limit_write_size, main_config.i_o_limit_write, index);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (yon_char_find_count(key, "MemorySwapMax") != 0) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (yon_char_find_count(key, "CPUQuota") != 0) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (yon_char_find_count(key, "IOReadBandwidthMax") != 0) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void set_pow_size(char* str_find, int* array_size, char** array_data , int index) {
|
|
|
|
|
|
|
|
if (strstr(str_find,"K") != NULL) {
|
|
|
|
|
|
|
|
array_size = philos_int_append(array_size, &index, 0);
|
|
|
|
|
|
|
|
index--;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (strstr(str_find,"M") != NULL) {
|
|
|
|
|
|
|
|
array_size = philos_int_append(array_size, &index, 1);
|
|
|
|
|
|
|
|
index--;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (strstr(str_find,"G") != NULL) {
|
|
|
|
|
|
|
|
array_size = philos_int_append(array_size, &index, 2);
|
|
|
|
|
|
|
|
index--;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (yon_char_find_count(key, "IOWriteBandwidthMax") != 0) {
|
|
|
|
else if (strstr(str_find,"T") != NULL) {
|
|
|
|
|
|
|
|
array_size = philos_int_append(array_size, &index, 3);
|
|
|
|
|
|
|
|
index--;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (strstr(str_find,"\%") != NULL) {
|
|
|
|
|
|
|
|
array_size = philos_int_append(array_size, &index, -1);
|
|
|
|
|
|
|
|
index--;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (strstr(str_find,"\"") != NULL) {
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (strstr(str_find,"-") != NULL) {
|
|
|
|
|
|
|
|
array_size = philos_int_append(array_size, &index, -1);
|
|
|
|
|
|
|
|
index--;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (strstr(str_find,"-") == NULL) {
|
|
|
|
|
|
|
|
size_t length = strlen(str_find);
|
|
|
|
|
|
|
|
str_find = yon_char_divide(str_find, length-2);
|
|
|
|
|
|
|
|
array_data = yon_char_parsed_append(array_data, &index, str_find);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
array_data = yon_char_parsed_append(array_data, &index, "-");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
GtkTreeIter iter;
|
|
|
|
|
|
|
|
gtk_list_store_append(main_config.list,&iter);
|
|
|
|
|
|
|
|
gtk_list_store_set(main_config.list,&iter,0,main_config.type_quota[index],
|
|
|
|
|
|
|
|
1,main_config.quota_volume[index],
|
|
|
|
|
|
|
|
2,main_config.soft_raw_limit[index],
|
|
|
|
|
|
|
|
3,main_config.hard_raw_limit[index],
|
|
|
|
|
|
|
|
4,main_config.swap[index],
|
|
|
|
|
|
|
|
5,main_config.cpu_limit[index],
|
|
|
|
|
|
|
|
6,main_config.i_o_limit_read[index],
|
|
|
|
|
|
|
|
7,main_config.i_o_limit_write[index],-1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void main_cbx_2_event() {
|
|
|
|
void main_cbx_2_event() {
|
|
|
|
int menu_id = gtk_combo_box_get_active(GTK_COMBO_BOX(widgets->cbtMainInfo));
|
|
|
|
int menu_id = gtk_combo_box_get_active(GTK_COMBO_BOX(widgets->cbtMainInfo));
|
|
|
|
char* cmd_text_param = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(widgets->cbtMainInfo));
|
|
|
|
char* cmd_text_param = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(widgets->cbtMainInfo));
|
|
|
|