Navigation



Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/rt_default/rtd_rules.c

    r1336 r1179  
    4747 *  Under each TARGET element, we have the list of RULES that are defined for this target, ordered by CRITERIA type, then is_regex, then string value.
    4848 *
    49  * Note: Access these only when holding rtd_lock; config reload may change the underlying data.
     49 * Note: Except during configuration parsing and module termination, the lists are only ever accessed read-only, so we do not need a lock.
    5050 */
    5151
     
    390390}
    391391
    392 static void free_targets(void)
     392/* Destroy the module's data */
     393void rtd_fini(void)
    393394{
    394395        int i;
     396       
     397        TRACE_ENTRY();
    395398
    396399        for (i = 0; i < RTD_TAR_MAX; i++) {
     
    399402                }
    400403        }
    401 }
    402 
    403 /* Destroy the module's data */
    404 void rtd_fini(void)
    405 {
    406         TRACE_ENTRY();
    407 
    408         free_targets();
     404       
    409405}
    410406
     
    497493       
    498494        return 0;
    499 }
    500 
    501 void rtd_conf_reload(char *config_file)
    502 {
    503         /* save old config in case reload goes wrong */
    504         struct fd_list old_config[RTD_TAR_MAX];
    505         int i;
    506 
    507         for (i = 0; i < RTD_TAR_MAX; i++) {
    508                 old_config[i] = TARGETS[i];
    509         }
    510         memset(TARGETS, 0, sizeof(*TARGETS) * RTD_TAR_MAX);
    511         for (i = 0; i < RTD_TAR_MAX; i++) {
    512                 fd_list_init(&TARGETS[i], NULL);
    513         }
    514 
    515         if (rtd_conf_handle(config_file) != 0) {
    516                 fd_log_notice("rt_default: error reloading configuration, restoring previous configuration");
    517                 free_targets();
    518                 for (i = 0; i < RTD_TAR_MAX; i++) {
    519                         TARGETS[i] = old_config[i];
    520                 }
    521         } else {
    522                 /* this has to be done in this weird way because the items contain back pointers referencing TARGETS */
    523                 struct fd_list save_config[RTD_TAR_MAX];
    524                 for (i = 0; i < RTD_TAR_MAX; i++) {
    525                         save_config[i] = TARGETS[i];
    526                         TARGETS[i] = old_config[i];
    527                 }
    528                 free_targets();
    529                 for (i = 0; i < RTD_TAR_MAX; i++) {
    530                         TARGETS[i] = save_config[i];
    531                 }
    532         }
    533495}
    534496
Note: See TracChangeset for help on using the changeset viewer.