config-parser: Support limiter.conf in limiter.conf.d 31/319731/1 accepted/tizen/9.0/unified/20241109.042001
authorUnsung Lee <unsung.lee@samsung.com>
Thu, 24 Oct 2024 05:52:06 +0000 (14:52 +0900)
committerUnsung Lee <unsung.lee@samsung.com>
Thu, 31 Oct 2024 06:08:41 +0000 (15:08 +0900)
Support limiter.conf configuration file in limiter.conf.d directory.
Previously, resourced supported only one limiter.conf file included in the project.
Now it has been changed so that each user can replace it with their own limiter.conf file.

Example:
/etc/resourced/limiter.conf -> it will be not used for limiter moudle.
/etc/resourced/limiter.conf.d/limiter.conf -> It will be used for limiter

Change-Id: I04ff9b332ee20187ab6fc87de7d26c4a3274bc07
Signed-off-by: Unsung Lee <unsung.lee@samsung.com>
src/common/conf/config-parser.c
src/common/conf/config-parser.h

index ab841391e6f5dd30bf2b22f5a3a3e207e3c54d83..07c71dcb37bbdd3e1498d3933040bc33604fe228 100644 (file)
@@ -1220,8 +1220,11 @@ void resourced_parse_vendor_configs(void)
 
        fixed_app_and_service_list_init();
 
-       /* Load configurations in limiter.conf and limiter.conf.d/ */
-       config_parse(LIMITER_CONF_FILE, limiter_config, NULL);
+       if (access(LIMITER_CONF_DIR_LIMITER_CONF, F_OK) != 0)
+               config_parse(LIMITER_CONF_FILE, limiter_config, NULL);
+       else
+               config_parse(LIMITER_CONF_DIR_LIMITER_CONF, limiter_config, NULL);
+
        config_type = LIMITER_CONFIG;
        load_per_vendor_configs(LIMITER_CONF_DIR, vendor_config, &config_type);
 
index f7c3249046ad2957614c47a5dd114926d95241c3..6e2533f6e41387873281864ede656bdb84aeb64d 100644 (file)
@@ -30,6 +30,8 @@ extern "C" {
 
 #define CONF_FILE_SUFFIX                    ".conf"
 
+#define LIMITER_CONF_DIR_LIMITER_CONF       LIMITER_CONF_DIR "/limiter.conf"
+
 #define LIMITER_CONF_FILE                   RD_CONFIG_FILE(limiter)
 #define OPTIMIZER_CONF_FILE                 RD_CONFIG_FILE(optimizer)
 #define PROCESS_CONF_FILE                   RD_CONFIG_FILE(process)