#include <stdlib.h>
+#include <stdio.h>
+#include <unistd.h>
#include <string.h>
#include <strings.h>
#include <errno.h>
#include <limits.h> /* PATH_MAX */
+#include <sys/types.h>
+#include <sys/stat.h>
#include "graph_ident.h"
#include "common.h"
#include "filesystem.h"
+#include <fcgiapp.h>
+#include <fcgi_stdio.h>
+
/*
* Data types
*/
return (strdup (buffer));
} /* }}} char *ident_to_json */
+time_t ident_get_mtime (const graph_ident_t *ident) /* {{{ */
+{
+ char *file;
+ struct stat statbuf;
+ int status;
+
+ if (ident == NULL)
+ return (0);
+
+ file = ident_to_file (ident);
+ if (file == NULL)
+ return (0);
+
+ memset (&statbuf, 0, sizeof (statbuf));
+ status = stat (file, &statbuf);
+ if (status != 0)
+ {
+ fprintf (stderr, "ident_get_mtime: stat'ing file \"%s\" failed: %s\n",
+ file, strerror (errno));
+ return (0);
+ }
+
+ free (file);
+ return (statbuf.st_mtime);
+} /* }}} time_t ident_get_mtime */
+
/* vim: set sw=2 sts=2 et fdm=marker : */
#ifndef GRAPH_IDENT_H
#define GRAPH_IDENT_H 1
+#include <time.h>
+
#define ANY_TOKEN "/any/"
#define ALL_TOKEN "/all/"
char *ident_to_file (const graph_ident_t *ident);
char *ident_to_json (const graph_ident_t *ident);
+time_t ident_get_mtime (const graph_ident_t *ident);
+
/* vim: set sw=2 sts=2 et fdm=marker : */
#endif /* GRAPH_IDENT_H */
#include <stdlib.h>
#include <string.h>
#include <errno.h>
+#include <time.h>
#include "graph_instance.h"
#include "graph_ident.h"
return (0);
} /* }}} int inst_describe */
+time_t inst_get_mtime (graph_instance_t *inst) /* {{{ */
+{
+ size_t i;
+ time_t mtime;
+
+ if (inst == NULL)
+ return (0);
+
+ mtime = 0;
+ for (i = 0; i < inst->files_num; i++)
+ {
+ time_t tmp;
+
+ tmp = ident_get_mtime (inst->files[i]);
+ if (mtime < tmp)
+ mtime = tmp;
+ }
+
+ return (mtime);
+} /* }}} time_t inst_get_mtime */
+
/* vim: set sw=2 sts=2 et fdm=marker : */
typedef int (*inst_callback_t) (graph_instance_t *inst, void *user_data);
+#include <time.h>
+
#include "graph.h"
#include "utils_array.h"
int inst_describe (graph_config_t *cfg, graph_instance_t *inst,
char *buffer, size_t buffer_size);
+time_t inst_get_mtime (graph_instance_t *inst);
+
#endif /* GRAPH_INSTANCE_H */
/* vim: set sw=2 sts=2 et fdm=marker : */