diff options
| author | liuxueli <[email protected]> | 2023-06-16 20:13:39 +0800 |
|---|---|---|
| committer | liuxueli <[email protected]> | 2023-06-18 13:52:40 +0800 |
| commit | 910f97b3bf4ce87dd08d81a8b7883cff6415496f (patch) | |
| tree | de138f6e80c6408bc543952a06316c74d83b483b /src/tsg_rule.cpp | |
| parent | 7cc941be4eea021ba136e64de91c2396899fcba8 (diff) | |
适配MAAT4的plugin表的垃圾回收机制,减少原子操作
Diffstat (limited to 'src/tsg_rule.cpp')
| -rw-r--r-- | src/tsg_rule.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/tsg_rule.cpp b/src/tsg_rule.cpp index 6d5fefe..3b43790 100644 --- a/src/tsg_rule.cpp +++ b/src/tsg_rule.cpp @@ -773,8 +773,8 @@ void ex_data_app_id_dict_dup(int table_id, void **to, void **from, long argl, vo { if((*from)!=NULL) { - struct app_id_dict *dict=(struct app_id_dict *)(*from); - atomic_inc(&dict->ref_cnt); + //struct app_id_dict *dict=(struct app_id_dict *)(*from); + //atomic_inc(&dict->ref_cnt); *to=*from; } @@ -843,7 +843,7 @@ void ex_data_app_id_dict_new(const char *table_name, int table_id, const char* k dict->characteristics_len=(char)strlen(dict->characteristics); } - atomic_inc(&dict->ref_cnt); + //atomic_inc(&dict->ref_cnt); *ad=(void *)dict; tsg_stat_sync_exdata_add_update(SYNC_EXDATA_APP_ID_DICT, 1); @@ -855,7 +855,7 @@ void ex_data_app_id_dict_free(int table_id, void **ad, long argl, void* argp) if((*ad)!=NULL) { struct app_id_dict *dict=(struct app_id_dict *)(*ad); - if((__sync_sub_and_fetch(&dict->ref_cnt, 1) == 0)) + //if((__sync_sub_and_fetch(&dict->ref_cnt, 1) == 0)) { tsg_free_field(dict->app_name); tsg_free_field(dict->parent_app_name); @@ -1312,9 +1312,9 @@ void ex_data_security_compile_new(const char *table_name, int table_id, const ch void ex_data_security_compile_dup(int table_id, void **to, void **from, long argl, void *argp) { - struct maat_compile *compile=(struct maat_compile *)(*from); - if(compile!=NULL) + if(*from!=NULL) { + struct maat_compile *compile=(struct maat_compile *)(*from); atomic_inc(&compile->ref_cnt); *to=*from; } @@ -2973,7 +2973,7 @@ int tsg_get_app_name_by_id(struct maat *feather, int app_id, char *app_name, int { if((int)(dict->app_name_len) > app_name_len) { - ex_data_app_id_dict_free(g_tsg_maat_rt_para.plugin_tb[MAAT_PLUGIN_APP_ID_DICT].id, (void **)&dict, 0, NULL); + //ex_data_app_id_dict_free(g_tsg_maat_rt_para.plugin_tb[MAAT_PLUGIN_APP_ID_DICT].id, (void **)&dict, 0, NULL); return offset; } @@ -2994,7 +2994,7 @@ int tsg_get_app_name_by_id(struct maat *feather, int app_id, char *app_name, int app_name[offset]='\0'; } - ex_data_app_id_dict_free(g_tsg_maat_rt_para.plugin_tb[MAAT_PLUGIN_APP_ID_DICT].id, (void **)&dict, 0, NULL); + //ex_data_app_id_dict_free(g_tsg_maat_rt_para.plugin_tb[MAAT_PLUGIN_APP_ID_DICT].id, (void **)&dict, 0, NULL); return offset; } |
