X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Frrd_update.c;h=1d9d5150d325f90a65af55ade48702c7ddce02b5;hb=caa9411848390bf066b02588c4525731bee190c5;hp=5e26055a66db2fa20244860359f137f3f0b010b6;hpb=428c0dfd6c70a0e70039d15c2de3a729e01f8fef;p=rrdtool.git diff --git a/src/rrd_update.c b/src/rrd_update.c index 5e26055..1d9d515 100644 --- a/src/rrd_update.c +++ b/src/rrd_update.c @@ -519,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; } @@ -617,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 @@ -1962,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);