typedef struct cf_value_map_s
{
char *key;
- int (*func) (const oconfig_item_t *);
+ int (*func) (oconfig_item_t *);
} cf_value_map_t;
typedef struct cf_global_option_s
/*
* Prototypes of callback functions
*/
-static int dispatch_value_typesdb (const oconfig_item_t *ci);
-static int dispatch_value_plugindir (const oconfig_item_t *ci);
-static int dispatch_loadplugin (const oconfig_item_t *ci);
+static int dispatch_value_typesdb (oconfig_item_t *ci);
+static int dispatch_value_plugindir (oconfig_item_t *ci);
+static int dispatch_loadplugin (oconfig_item_t *ci);
+static int dispatch_block_plugin (oconfig_item_t *ci);
/*
* Private variables
{
{"TypesDB", dispatch_value_typesdb},
{"PluginDir", dispatch_value_plugindir},
- {"LoadPlugin", dispatch_loadplugin}
+ {"LoadPlugin", dispatch_loadplugin},
+ {"Plugin", dispatch_block_plugin}
};
static int cf_value_map_num = STATIC_ARRAY_SIZE (cf_value_map);
return (-1);
} /* int dispatch_global_option */
-static int dispatch_value_typesdb (const oconfig_item_t *ci)
+static int dispatch_value_typesdb (oconfig_item_t *ci)
{
int i = 0;
return (0);
} /* int dispatch_value_typesdb */
-static int dispatch_value_plugindir (const oconfig_item_t *ci)
+static int dispatch_value_plugindir (oconfig_item_t *ci)
{
assert (strcasecmp (ci->key, "PluginDir") == 0);
return (0);
}
-static int dispatch_loadplugin (const oconfig_item_t *ci)
+static int dispatch_loadplugin (oconfig_item_t *ci)
{
int i;
const char *name;
return (cf_dispatch (plugin, ci->key, buffer_ptr));
} /* int dispatch_value_plugin */
-static int dispatch_value (const oconfig_item_t *ci)
+static int dispatch_value (oconfig_item_t *ci)
{
int ret = -2;
int i;
}
else /* synchronous */
{
- status = srrd_create (filename, stepsize, last_up,
- argc, (const char **) argv);
-
+ status = lock_file (filename);
if (status != 0)
{
- WARNING ("cu_rrd_create_file: srrd_create (%s) returned status %i.",
- filename, status);
+ if (status == EEXIST)
+ NOTICE ("cu_rrd_create_file: File \"%s\" is already being created.",
+ filename);
+ else
+ ERROR ("cu_rrd_create_file: Unable to lock file \"%s\".",
+ filename);
}
else
{
- DEBUG ("cu_rrd_create_file: Successfully created RRD file \"%s\".",
- filename);
+ status = srrd_create (filename, stepsize, last_up,
+ argc, (const char **) argv);
+
+ if (status != 0)
+ {
+ WARNING ("cu_rrd_create_file: srrd_create (%s) returned status %i.",
+ filename, status);
+ }
+ else
+ {
+ DEBUG ("cu_rrd_create_file: Successfully created RRD file \"%s\".",
+ filename);
+ }
+ unlock_file (filename);
}
}