X-Git-Url: https://git.octo.it/?p=rrdtool.git;a=blobdiff_plain;f=src%2Frrd_update.c;h=fa50929a5fd4aae6ee2a8e92fede979d1a1c5f2f;hp=9d3e85466b00271daf4f34a3badb4d9cda5f2b9b;hb=85cd3f3afae48026843bea34d2d0d1056ee9dda5;hpb=a12627275ff8487174cbb907a066f62a00b6ae44 diff --git a/src/rrd_update.c b/src/rrd_update.c index 9d3e854..fa50929 100644 --- a/src/rrd_update.c +++ b/src/rrd_update.c @@ -449,14 +449,10 @@ int rrd_update( { rc = rrdc_update (argv[optind], /* file */ argc - optind - 1, /* values_num */ - (void *) (argv + optind + 1)); /* values */ - if (rc != 0) - { + (const char *const *) (argv + optind + 1)); /* values */ + if (rc > 0) rrd_set_error("Failed sending the values to rrdcached: %s", - (rc < 0) - ? "Internal error" - : rrd_strerror (rc)); - } + rrd_strerror (rc)); } out: @@ -523,6 +519,7 @@ int _rrd_update( goto err_out; } + rrd_init(&rrd); if ((rrd_file = rrd_open(filename, &rrd, RRD_READWRITE)) == NULL) { goto err_free; } @@ -621,41 +618,6 @@ int _rrd_update( } /* - * get exclusive lock to whole file. - * lock gets removed when we close the file - * - * returns 0 on success - */ -int rrd_lock( - rrd_file_t *file) -{ - int rcstat; - - { -#if defined(_WIN32) && !defined(__CYGWIN__) && !defined(__CYGWIN32__) - struct _stat st; - - if (_fstat(file->fd, &st) == 0) { - rcstat = _locking(file->fd, _LK_NBLCK, st.st_size); - } else { - rcstat = -1; - } -#else - struct flock lock; - - lock.l_type = F_WRLCK; /* exclusive write lock */ - lock.l_len = 0; /* whole file */ - lock.l_start = 0; /* start of file */ - lock.l_whence = SEEK_SET; /* end of file */ - - rcstat = fcntl(file->fd, F_SETLK, &lock); -#endif - } - - return (rcstat); -} - -/* * Allocate some important arrays used, and initialize the template. * * When it returns, either all of the structures are allocated @@ -1966,6 +1928,8 @@ static int write_to_rras( (rrd_file, rrd, rra_idx, scratch_idx, pcdp_summary, rra_time) == -1) return -1; + + rrd_notify_row(rrd_file, rra_idx, rra_pos_new, rra_time); } rra_start += rra_def->row_cnt * ds_cnt * sizeof(rrd_value_t); @@ -2003,7 +1967,7 @@ static int write_RRA_row( /* append info to the return hash */ *pcdp_summary = rrd_info_push(*pcdp_summary, sprintf_alloc - ("[%d]RRA[%s][%lu]DS[%s]", rra_time, + ("[%lli]RRA[%s][%lu]DS[%s]", rra_time, rrd->rra_def[rra_idx].cf_nam, rrd->rra_def[rra_idx].pdp_cnt, rrd->ds_def[ds_idx].ds_nam),