X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Frrd_tool.h;h=6d7652b74d0bd507ad553bed09c564199d61b5f8;hb=298b318acaf1147474ab9e97cac37c3608660efd;hp=279566512bede984765e72d1804936029c0f9ada;hpb=7c016dfa001ae254bf4e18126f814ee8f0abd821;p=rrdtool.git diff --git a/src/rrd_tool.h b/src/rrd_tool.h index 2795665..6d7652b 100644 --- a/src/rrd_tool.h +++ b/src/rrd_tool.h @@ -2,19 +2,6 @@ * RRDtool 1.0.33 Copyright Tobias Oetiker, 1997 - 2000 ***************************************************************************** * rrd_tool.h Common Header File - ***************************************************************************** - * $Id$ - * $Log$ - * Revision 1.2 2001/03/04 13:01:55 oetiker - * Aberrant Behavior Detection support. A brief overview added to rrdtool.pod. - * Major updates to rrd_update.c, rrd_create.c. Minor update to other core files. - * This is backwards compatible! But new files using the Aberrant stuff are not readable - * by old rrdtool versions. See http://cricket.sourceforge.net/aberrant/rrd_hw.htm - * -- Jake Brutlag - * - * Revision 1.1.1.1 2001/02/25 22:25:06 oetiker - * checkin - * *****************************************************************************/ #ifdef __cplusplus extern "C" { @@ -25,7 +12,7 @@ extern "C" { #define _RRD_TOOL_H #ifdef WIN32 -# include "ntconfig.h" +#include "../confignt/config.h" #else #ifdef HAVE_CONFIG_H #include @@ -58,6 +45,36 @@ extern "C" { #if HAVE_MATH_H # include #endif +/* Sorry: don't know autoconf as well how to check the exist of + dirent.h ans sys/stat.h +*/ + +#if HAVE_DIRENT_H +# include +# define NAMLEN(dirent) strlen((dirent)->d_name) +#else +# define dirent direct +# define NAMLEN(dirent) (dirent)->d_namlen +# if HAVE_SYS_NDIR_H +# include +# endif +# if HAVE_SYS_DIR_H +# include +# endif +# if HAVE_NDIR_H +# include +# endif +#endif + +#if HAVE_SYS_TYPES_H +# include +#endif + +#if HAVE_SYS_STAT_H +# include +#endif + + #if HAVE_UNISTD_H # include #endif @@ -131,12 +148,8 @@ typedef struct info_t { info_t *rrd_info(int, char **); /* HELPER FUNCTIONS */ -int GifSize(FILE *, long *, long *); -int PngSize(FILE *, long *, long *); -int PngSize(FILE *, long *, long *); -#include -void gdImagePng(gdImagePtr im, FILE *out); +int PngSize(FILE *, long *, long *); int rrd_create_fn(char *file_name, rrd_t *rrd); int rrd_fetch_fn(char *filename, enum cf_en cf_idx, @@ -147,10 +160,13 @@ int rrd_fetch_fn(char *filename, enum cf_en cf_idx, rrd_value_t **data); void rrd_free(rrd_t *rrd); +void rrd_freemem(void *mem); void rrd_init(rrd_t *rrd); int rrd_open(char *file_name, FILE **in_file, rrd_t *rrd, int rdwr); +int rrd_open_r(char *file_name, FILE **in_file, rrd_t *rrd, int rdwr); int readfile(char *file, char **buffer, int skipfirst); +int readfile_r(char *file, char **buffer, int skipfirst); #define RRD_READONLY 0 #define RRD_READWRITE 1 @@ -160,36 +176,16 @@ enum dst_en dst_conv(char *string); long ds_match(rrd_t *rrd,char *ds_nam); double rrd_diff(char *a, char *b); -/* functions added for aberrant behavior detection. - * implemented for the most part in rrd_hw.c */ -int update_aberrant_CF(rrd_t *rrd, rrd_value_t pdp_val, enum cf_en current_cf, - unsigned long cdp_idx, unsigned long rra_idx, unsigned long ds_idx, - unsigned short CDP_scratch_idx, rrd_value_t *seasonal_coef); -int create_hw_contingent_rras(rrd_t *rrd, unsigned short period, - unsigned long hashed_name); -int lookup_seasonal(rrd_t *rrd, unsigned long rra_idx, unsigned long rra_start, - FILE *rrd_file, unsigned long offset, rrd_value_t **seasonal_coef); -void erase_violations(rrd_t *rrd, unsigned long cdp_idx, unsigned long rra_idx); -int apply_smoother(rrd_t *rrd, unsigned long rra_idx, unsigned long rra_start, - FILE *rrd_file); - -/* a standard fixed-capacity FIFO queue implementation */ -typedef struct FIFOqueue { - rrd_value_t *queue; - int capacity, head, tail; -} FIFOqueue; + /* rrd_strerror is thread safe, but still it uses a global buffer + (but one per thread), thus subsequent calls within a single + thread overwrite the same buffer */ +const char *rrd_strerror(int err); -int queue_alloc(FIFOqueue **q,int capacity); -void queue_dealloc(FIFOqueue *q); -void queue_push(FIFOqueue *q, rrd_value_t value); -int queue_isempty(FIFOqueue *q); -rrd_value_t queue_pop(FIFOqueue *q); - -#define BURNIN_CYCLES 3 +/* just a defensive work-around... */ +#define strerror(x) rrd_strerror(x) #endif - #ifdef __cplusplus } #endif