summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: cc0d31a)
raw | patch | inline | side by side (parent: cc0d31a)
author | octo <octo> | |
Tue, 21 Mar 2006 12:42:48 +0000 (12:42 +0000) | ||
committer | octo <octo> | |
Tue, 21 Mar 2006 12:42:48 +0000 (12:42 +0000) |
src/common.c | patch | blob | history | |
src/common.h | patch | blob | history |
diff --git a/src/common.c b/src/common.c
index 3c416fc2f1e0c62fdda895503b1d67c472cbd98a..72cc5589d42bd2b16697e7ea037f28b31e8296d7 100644 (file)
--- a/src/common.c
+++ b/src/common.c
#endif
#ifdef HAVE_LIBRRD
+#if 0
static char *rra_def[] =
{
"RRA:AVERAGE:0.0:1:1500",
NULL
};
static int rra_num = 12;
+#endif
static int rra_timespans[] =
{
return (0);
}
+int timeval_sub_timespec (struct timeval *tv0, struct timeval *tv1, struct timespec *ret)
+{
+ if ((tv0 == NULL) || (tv1 == NULL) || (ret == NULL))
+ return (-2);
+
+ if ((tv0->tv_sec < tv1->tv_sec)
+ || ((tv0->tv_sec == tv1->tv_sec) && (tv0->tv_usec < tv1->tv_usec)))
+ return (-1);
+
+ ret->tv_sec = tv0->tv_sec - tv1->tv_sec;
+ ret->tv_nsec = 1000 * ((long) (tv0->tv_usec - tv1->tv_usec));
+
+ if (ret->tv_nsec < 0)
+ {
+ assert (ret->tv_sec > 0);
+
+ ret->tv_nsec += 1000000000;
+ ret->tv_sec -= 1;
+ }
+
+ return (0);
+}
+
#ifdef HAVE_LIBRRD
int check_create_dir (const char *file_orig)
{
{
char **argv;
int argc;
+ char **rra_def;
+ int rra_num;
int i, j;
int status = 0;
if (check_create_dir (filename))
return (-1);
- rra_get (&argv); /* FIXME */
+ if ((rra_num = rra_get (&rra_def)) < 1)
+ {
+ syslog (LOG_ERR, "rra_create failed: Could not calculate RRAs");
+ return (-1);
+ }
argc = ds_num + rra_num + 4;
diff --git a/src/common.h b/src/common.h
index 59984b182a0e1ac1e2ef3837fefec7e6bfddd1ab..fafce4a81ead159a5fc2dbf665d25f190d0725ad 100644 (file)
--- a/src/common.h
+++ b/src/common.h
*/
int escape_slashes (char *buf, int buf_len);
+/* FIXME: `timeval_sub_timespec' needs a description */
+int timeval_sub_timespec (struct timeval *tv0, struct timeval *tv1, struct timespec *ret);
+
int rrd_update_file (char *host, char *file, char *values, char **ds_def,
int ds_num);