1 /*****************************************************************************
2 * RRDtool 1.3.0 Copyright by Tobi Oetiker, 1997-2008
3 *****************************************************************************
4 * rrd_lastupdate Get the last datum entered for each DS
5 *****************************************************************************/
8 #include "rrd_rpncalc.h"
15 unsigned long *ds_cnt,
25 rrd_set_error("please specify an rrd");
30 rrd_file = rrd_open(filename, &rrd, RRD_READONLY);
34 *last_update = rrd.live_head->last_up;
35 *ds_cnt = rrd.stat_head->ds_cnt;
37 (char **) malloc(rrd.stat_head->ds_cnt * sizeof(char *))) == NULL) {
38 rrd_set_error("malloc fetch ds_namv array");
43 (char **) malloc(rrd.stat_head->ds_cnt * sizeof(char *))) == NULL) {
44 rrd_set_error("malloc fetch last_ds array");
45 goto err_free_ds_namv;
48 for (i = 0; i < rrd.stat_head->ds_cnt; i++) {
49 (*ds_namv)[i] = sprintf_alloc("%s", rrd.ds_def[i].ds_nam);
50 (*last_ds)[i] = sprintf_alloc("%s", rrd.pdp_prep[i].last_ds);