Changeset 6244
- Timestamp:
- 08/21/08 18:10:40 (3 months ago)
- Location:
- trunk/centstorage
- Files:
-
- 2 added
- 13 modified
-
ChangeLog (modified) (1 diff)
-
README (modified) (2 diffs)
-
modules/purge/Makefile (modified) (4 diffs)
-
modules/purge/Makefile.am (modified) (1 diff)
-
modules/purge/Makefile.in (modified) (4 diffs)
-
modules/purge/purge.c (modified) (1 diff)
-
modules/purge/purge.h (modified) (1 diff)
-
modules/purge/runPurge.c (added)
-
modules/purge/runPurge.h (added)
-
modules/recup_perf_datas/db_connection.h (modified) (1 diff)
-
modules/recup_perf_datas/insertValInDataBase.c (modified) (2 diffs)
-
modules/recup_perf_datas/recup_perf_datas.c (modified) (1 diff)
-
src/Conf.c (modified) (2 diffs)
-
src/reloadConf.c (modified) (2 diffs)
-
src/runCentStorage.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/centstorage/ChangeLog
r6192 r6244 2 2 CentStorage ChangeLog 3 3 ######################### 4 5 ??? - 08/21/2008 6 ----------------- 7 * begin to code the module purge 8 * load the configuration of module purge 4 9 5 10 ??? - 08/20/2008 -
trunk/centstorage/README
r6174 r6244 33 33 connection between client and server. 34 34 35 For the oracle support, you need to install Oracle Call Interface. You can find it 35 For the oracle support, you need to install Oracle Call Interface. You can find it 36 36 on the oracle official website: 37 37 http://www.oracle.com/technology/software/tech/oci/instantclient/index.html … … 39 39 40 40 the script configure can take some options in pramameter: 41 --with-<db>-inc=<path to your include files> => to specify the position of header 41 --with-<db>-inc=<path to your include files> => to specify the position of header 42 42 files of the database you are using (<db> must be replace by mysql, pgsql or 43 43 oracle). By default, it should be something like /usr/include/<db>, so this option should'nt -
trunk/centstorage/modules/purge/Makefile
r6209 r6244 67 67 binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) 68 68 PROGRAMS = $(bin_PROGRAMS) 69 am_purge_so_OBJECTS = purge_so-purge.$(OBJEXT) 69 am_purge_so_OBJECTS = purge_so-purge.$(OBJEXT) \ 70 purge_so-runPurge.$(OBJEXT) \ 71 purge_so-db_purge_connection.$(OBJEXT) 70 72 purge_so_OBJECTS = $(am_purge_so_OBJECTS) 71 73 purge_so_DEPENDENCIES = … … 185 187 top_builddir = ../.. 186 188 top_srcdir = ../.. 187 purge_so_SOURCES = purge.c \ 188 \ 189 purge.h 189 purge_so_SOURCES = purge.c \ 190 runPurge.c \ 191 db_purge_connection.c \ 192 \ 193 purge.h \ 194 runPurge.h \ 195 db_purge_connection.h 190 196 191 197 INCLUDES = -I. -I/usr/include/libxml -I../../includes … … 262 268 -rm -f *.tab.c 263 269 270 include ./$(DEPDIR)/purge_so-db_purge_connection.Po 264 271 include ./$(DEPDIR)/purge_so-purge.Po 272 include ./$(DEPDIR)/purge_so-runPurge.Po 265 273 266 274 .c.o: … … 291 299 # DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ 292 300 # $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(purge_so_CFLAGS) $(CFLAGS) -c -o purge_so-purge.obj `if test -f 'purge.c'; then $(CYGPATH_W) 'purge.c'; else $(CYGPATH_W) '$(srcdir)/purge.c'; fi` 301 302 purge_so-runPurge.o: runPurge.c 303 $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(purge_so_CFLAGS) $(CFLAGS) -MT purge_so-runPurge.o -MD -MP -MF $(DEPDIR)/purge_so-runPurge.Tpo -c -o purge_so-runPurge.o `test -f 'runPurge.c' || echo '$(srcdir)/'`runPurge.c 304 mv -f $(DEPDIR)/purge_so-runPurge.Tpo $(DEPDIR)/purge_so-runPurge.Po 305 # source='runPurge.c' object='purge_so-runPurge.o' libtool=no \ 306 # DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ 307 # $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(purge_so_CFLAGS) $(CFLAGS) -c -o purge_so-runPurge.o `test -f 'runPurge.c' || echo '$(srcdir)/'`runPurge.c 308 309 purge_so-runPurge.obj: runPurge.c 310 $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(purge_so_CFLAGS) $(CFLAGS) -MT purge_so-runPurge.obj -MD -MP -MF $(DEPDIR)/purge_so-runPurge.Tpo -c -o purge_so-runPurge.obj `if test -f 'runPurge.c'; then $(CYGPATH_W) 'runPurge.c'; else $(CYGPATH_W) '$(srcdir)/runPurge.c'; fi` 311 mv -f $(DEPDIR)/purge_so-runPurge.Tpo $(DEPDIR)/purge_so-runPurge.Po 312 # source='runPurge.c' object='purge_so-runPurge.obj' libtool=no \ 313 # DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ 314 # $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(purge_so_CFLAGS) $(CFLAGS) -c -o purge_so-runPurge.obj `if test -f 'runPurge.c'; then $(CYGPATH_W) 'runPurge.c'; else $(CYGPATH_W) '$(srcdir)/runPurge.c'; fi` 315 316 purge_so-db_purge_connection.o: db_purge_connection.c 317 $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(purge_so_CFLAGS) $(CFLAGS) -MT purge_so-db_purge_connection.o -MD -MP -MF $(DEPDIR)/purge_so-db_purge_connection.Tpo -c -o purge_so-db_purge_connection.o `test -f 'db_purge_connection.c' || echo '$(srcdir)/'`db_purge_connection.c 318 mv -f $(DEPDIR)/purge_so-db_purge_connection.Tpo $(DEPDIR)/purge_so-db_purge_connection.Po 319 # source='db_purge_connection.c' object='purge_so-db_purge_connection.o' libtool=no \ 320 # DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ 321 # $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(purge_so_CFLAGS) $(CFLAGS) -c -o purge_so-db_purge_connection.o `test -f 'db_purge_connection.c' || echo '$(srcdir)/'`db_purge_connection.c 322 323 purge_so-db_purge_connection.obj: db_purge_connection.c 324 $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(purge_so_CFLAGS) $(CFLAGS) -MT purge_so-db_purge_connection.obj -MD -MP -MF $(DEPDIR)/purge_so-db_purge_connection.Tpo -c -o purge_so-db_purge_connection.obj `if test -f 'db_purge_connection.c'; then $(CYGPATH_W) 'db_purge_connection.c'; else $(CYGPATH_W) '$(srcdir)/db_purge_connection.c'; fi` 325 mv -f $(DEPDIR)/purge_so-db_purge_connection.Tpo $(DEPDIR)/purge_so-db_purge_connection.Po 326 # source='db_purge_connection.c' object='purge_so-db_purge_connection.obj' libtool=no \ 327 # DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ 328 # $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(purge_so_CFLAGS) $(CFLAGS) -c -o purge_so-db_purge_connection.obj `if test -f 'db_purge_connection.c'; then $(CYGPATH_W) 'db_purge_connection.c'; else $(CYGPATH_W) '$(srcdir)/db_purge_connection.c'; fi` 293 329 294 330 ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) -
trunk/centstorage/modules/purge/Makefile.am
r6209 r6244 22 22 bin_PROGRAMS = purge.so 23 23 24 purge_so_SOURCES = purge.c \ 25 \ 26 purge.h 24 purge_so_SOURCES = purge.c \ 25 runPurge.c \ 26 db_purge_connection.c \ 27 \ 28 purge.h \ 29 runPurge.h \ 30 db_purge_connection.h 27 31 28 32 INCLUDES = -I. @XML_HEADER@ -I../../includes -
trunk/centstorage/modules/purge/Makefile.in
r6209 r6244 67 67 binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) 68 68 PROGRAMS = $(bin_PROGRAMS) 69 am_purge_so_OBJECTS = purge_so-purge.$(OBJEXT) 69 am_purge_so_OBJECTS = purge_so-purge.$(OBJEXT) \ 70 purge_so-runPurge.$(OBJEXT) \ 71 purge_so-db_purge_connection.$(OBJEXT) 70 72 purge_so_OBJECTS = $(am_purge_so_OBJECTS) 71 73 purge_so_DEPENDENCIES = … … 185 187 top_builddir = @top_builddir@ 186 188 top_srcdir = @top_srcdir@ 187 purge_so_SOURCES = purge.c \ 188 \ 189 purge.h 189 purge_so_SOURCES = purge.c \ 190 runPurge.c \ 191 db_purge_connection.c \ 192 \ 193 purge.h \ 194 runPurge.h \ 195 db_purge_connection.h 190 196 191 197 INCLUDES = -I. @XML_HEADER@ -I../../includes … … 262 268 -rm -f *.tab.c 263 269 270 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/purge_so-db_purge_connection.Po@am__quote@ 264 271 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/purge_so-purge.Po@am__quote@ 272 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/purge_so-runPurge.Po@am__quote@ 265 273 266 274 .c.o: … … 291 299 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 292 300 @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(purge_so_CFLAGS) $(CFLAGS) -c -o purge_so-purge.obj `if test -f 'purge.c'; then $(CYGPATH_W) 'purge.c'; else $(CYGPATH_W) '$(srcdir)/purge.c'; fi` 301 302 purge_so-runPurge.o: runPurge.c 303 @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(purge_so_CFLAGS) $(CFLAGS) -MT purge_so-runPurge.o -MD -MP -MF $(DEPDIR)/purge_so-runPurge.Tpo -c -o purge_so-runPurge.o `test -f 'runPurge.c' || echo '$(srcdir)/'`runPurge.c 304 @am__fastdepCC_TRUE@ mv -f $(DEPDIR)/purge_so-runPurge.Tpo $(DEPDIR)/purge_so-runPurge.Po 305 @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runPurge.c' object='purge_so-runPurge.o' libtool=no @AMDEPBACKSLASH@ 306 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 307 @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(purge_so_CFLAGS) $(CFLAGS) -c -o purge_so-runPurge.o `test -f 'runPurge.c' || echo '$(srcdir)/'`runPurge.c 308 309 purge_so-runPurge.obj: runPurge.c 310 @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(purge_so_CFLAGS) $(CFLAGS) -MT purge_so-runPurge.obj -MD -MP -MF $(DEPDIR)/purge_so-runPurge.Tpo -c -o purge_so-runPurge.obj `if test -f 'runPurge.c'; then $(CYGPATH_W) 'runPurge.c'; else $(CYGPATH_W) '$(srcdir)/runPurge.c'; fi` 311 @am__fastdepCC_TRUE@ mv -f $(DEPDIR)/purge_so-runPurge.Tpo $(DEPDIR)/purge_so-runPurge.Po 312 @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runPurge.c' object='purge_so-runPurge.obj' libtool=no @AMDEPBACKSLASH@ 313 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 314 @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(purge_so_CFLAGS) $(CFLAGS) -c -o purge_so-runPurge.obj `if test -f 'runPurge.c'; then $(CYGPATH_W) 'runPurge.c'; else $(CYGPATH_W) '$(srcdir)/runPurge.c'; fi` 315 316 purge_so-db_purge_connection.o: db_purge_connection.c 317 @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(purge_so_CFLAGS) $(CFLAGS) -MT purge_so-db_purge_connection.o -MD -MP -MF $(DEPDIR)/purge_so-db_purge_connection.Tpo -c -o purge_so-db_purge_connection.o `test -f 'db_purge_connection.c' || echo '$(srcdir)/'`db_purge_connection.c 318 @am__fastdepCC_TRUE@ mv -f $(DEPDIR)/purge_so-db_purge_connection.Tpo $(DEPDIR)/purge_so-db_purge_connection.Po 319 @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='db_purge_connection.c' object='purge_so-db_purge_connection.o' libtool=no @AMDEPBACKSLASH@ 320 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 321 @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(purge_so_CFLAGS) $(CFLAGS) -c -o purge_so-db_purge_connection.o `test -f 'db_purge_connection.c' || echo '$(srcdir)/'`db_purge_connection.c 322 323 purge_so-db_purge_connection.obj: db_purge_connection.c 324 @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(purge_so_CFLAGS) $(CFLAGS) -MT purge_so-db_purge_connection.obj -MD -MP -MF $(DEPDIR)/purge_so-db_purge_connection.Tpo -c -o purge_so-db_purge_connection.obj `if test -f 'db_purge_connection.c'; then $(CYGPATH_W) 'db_purge_connection.c'; else $(CYGPATH_W) '$(srcdir)/db_purge_connection.c'; fi` 325 @am__fastdepCC_TRUE@ mv -f $(DEPDIR)/purge_so-db_purge_connection.Tpo $(DEPDIR)/purge_so-db_purge_connection.Po 326 @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='db_purge_connection.c' object='purge_so-db_purge_connection.obj' libtool=no @AMDEPBACKSLASH@ 327 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 328 @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(purge_so_CFLAGS) $(CFLAGS) -c -o purge_so-db_purge_connection.obj `if test -f 'db_purge_connection.c'; then $(CYGPATH_W) 'db_purge_connection.c'; else $(CYGPATH_W) '$(srcdir)/db_purge_connection.c'; fi` 293 329 294 330 ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) -
trunk/centstorage/modules/purge/purge.c
r6209 r6244 25 25 26 26 #include <time.h> 27 #include <stdio.h> 28 #include <string.h> 29 #include <libxml/xmlmemory.h> 30 #include <libxml/parser.h> 31 #include <libxml/xpath.h> 32 27 33 #include <purge.h> 28 29 34 #include <extvar.h> 30 31 void purge(int *i) 35 #include <ParseXmlFile.h> 36 37 void *purge_db_connection = NULL; 38 39 /* 40 ** function purge is the "main" function of module purge, 41 ** the one called when the thread for module purge is created (see 42 ** man 3 pthread_create for more explainaition about pthread_create) 43 ** 44 ** @param int*: pointer to int, indicating the "position" in the 45 ** module table. The module table is defined in the core (file Conf.h) 46 ** and filed in runCentstorage.c 47 */ 48 void purge(int *i) 32 49 { 33 unsigned char flagStop; 34 35 while (1) 36 { 37 printf("je suis le module purge\n"); 38 LOCK_MUTEX(&mutex); 39 flagStop = conf->flag_stop[*i + 1]; 40 UNLOCK_MUTEX(&mutex); 41 if (flagStop == TRUE) 42 break ; 43 sleep(5); 44 } 50 unsigned char flagStop; 51 Purge_t *confPurge; 52 char confFile[PATH_SIZE]; 53 int log; 54 55 /* first thing, copy values from the configuration in local variable 56 to avoid access the global Conf_t *conf, that require a mutex and 57 load the configuration */ 58 LOCK_MUTEX(&mutex); 59 strncpy(confFile, conf->confFile, 128); 60 confPurge = loadPurgeConf(confFile, log, *i); 61 log = conf->logs->log; 62 UNLOCK_MUTEX(&mutex); 63 64 runPurge(confPurge, log, *i, confFile); 65 66 purge_db_disconnect(purge_db_connection, log); 67 68 free(confPurge); 69 return ; 45 70 } 71 72 /* 73 ** This function load the configuration of module purge from the configuration 74 ** file. If the file is incomplete default values are loaded for the missing 75 ** values. If the file is syntaxically incorrect default values are loaded. 76 ** 77 ** @param char *: path to the configuration file 78 ** @param int: flag indicating if informations must be log or not 79 ** @param int: "position" of the module in the module array 80 ** 81 ** return a pointer to a structure Purge_t, containing the module configuration 82 */ 83 Purge_t *loadPurgeConf(char *confFile, int log, int i) 84 { 85 Purge_t *confPurge = NULL; 86 xmlDocPtr doc; 87 xmlXPathContextPtr xmlContext; 88 xmlNodePtr cur; 89 xmlChar *txt; 90 91 /* alloc memory for structure Purge_t */ 92 confPurge = malloc(sizeof(*confPurge)); 93 if (!confPurge) 94 { 95 /* if malloc failed printf and eventually log errors messages */ 96 fprintf(stderr, "[module %s] %s : exting thread.\n", 97 MOD_PURGE_NAME, ERROR_MALLOC_CONF_PURGE); 98 if (log) 99 logger(" [module %s] %s", MOD_PURGE_NAME, ERROR_MALLOC_CONF_PURGE); 100 101 conf->threads_id[i] = 0; 102 conf->modules[i].CallFunction = NULL; 103 104 /* exit thread */ 105 pthread_exit(NULL); 106 } 107 108 /* load default values */ 109 confPurge->unit = PURGE_DEFAULT_TIME_UNIT; 110 confPurge->timeval = PURGE_DEFAULT_TIMEVAL; 111 112 /* verify configuration file validity */ 113 if (checkFileValidity(&doc, &cur, confFile) == -1) 114 return confPurge; 115 116 /* initialize xml XPath context */ 117 xmlXPathInit(); 118 xmlContext = xmlXPathNewContext(doc); 119 if (!xmlContext) 120 { 121 /* free ressource */ 122 xmlFreeDoc(doc); 123 124 /* print and log error messages */ 125 fprintf(stderr, "[module %s] %s\n", 126 MOD_PURGE_NAME, PURGE_XMLCONTEXT_ERROR); 127 if (log) 128 logger(" [module %s] %s", MOD_PURGE_NAME, PURGE_XMLCONTEXT_ERROR); 129 return confPurge; 130 } 131 132 /* load the values from configuration file using XPath: 133 first the timeval*/ 134 txt = getParam(PURGE_XPATH_TIME_S, xmlContext, doc); 135 if (!txt) 136 { 137 txt = getParam(PURGE_XPATH_TIME_M, xmlContext, doc); 138 if (!txt) 139 { 140 txt = getParam(PURGE_XPATH_TIME_H, xmlContext, doc); 141 if (!txt) 142 { 143 txt = getParam(PURGE_XPATH_TIME_D, xmlContext, doc); 144 if (txt) 145 { 146 confPurge->unit = DAYS; 147 confPurge->timeval = atoi(txt); 148 free(txt); 149 txt = NULL; 150 } 151 } 152 else 153 { 154 confPurge->unit = HOURS; 155 confPurge->timeval = atoi(txt); 156 free(txt); 157 txt = NULL; 158 } 159 } 160 else 161 { 162 confPurge->unit = MINUTES; 163 confPurge->timeval = atoi(txt); 164 free(txt); 165 txt = NULL; 166 } 167 } 168 else 169 { 170 confPurge->unit = SECONDS; 171 confPurge->timeval = atoi(txt); 172 free(txt); 173 txt = NULL; 174 } 175 176 if (confPurge->timeval == 0) 177 confPurge->timeval = 1; 178 179 /* and second the age */ 180 confPurge->age = PURGE_DEFAULT_AGE; 181 confPurge->ageUnit = PURGE_DEFAULT_AGE_UNIT; 182 183 txt = getParam(PURGE_XPATH_AGE_M, xmlContext, doc); 184 if (!txt) 185 { 186 txt = getParam(PURGE_XPATH_AGE_D, xmlContext, doc); 187 if (txt) 188 { 189 confPurge->age = atoi(txt); 190 confPurge->ageUnit = DAY; 191 free(txt); 192 } 193 } 194 else 195 { 196 confPurge->age = atoi(txt); 197 confPurge->ageUnit = MONTH; 198 free(txt); 199 } 200 201 if (confPurge->age == 0) 202 confPurge->age = 1; 203 204 /* free ressources */ 205 xmlXPathFreeContext(xmlContext); 206 xmlFreeDoc(doc); 207 return confPurge; 208 } -
trunk/centstorage/modules/purge/purge.h
r6209 r6244 23 23 # define PURGE_H_ 24 24 25 #define PATH_SIZE 128 26 27 enum timeUnit 28 { 29 SECONDS, 30 MINUTES, 31 HOURS, 32 DAYS 33 }; 34 35 #define MOD_PURGE_NAME "purge" 36 #define ERROR_MALLOC_CONF_PURGE "Cannot malloc enough memory to load purge configuration" 37 #define PURGE_XMLCONTEXT_ERROR "Cannot create an xml XPath Context. Keeping default configuration" 38 39 enum ageUnits 40 { 41 DAY, 42 MONTH 43 }; 44 45 #define PURGE_DEFAULT_TIMEVAL 5 46 #define PURGE_DEFAULT_TIME_UNIT MINUTES 47 #define PURGE_DEFAULT_AGE 1 48 #define PURGE_DEFAULT_AGE_UNIT MONTH 49 50 #define PURGE_XPATH_TIME_S "/CentStorage/modules/module[@name='purge']/interval[@unit='s']/text()" 51 #define PURGE_XPATH_TIME_M "/CentStorage/modules/module[@name='purge']/interval[@unit='min']/text()" 52 #define PURGE_XPATH_TIME_H "/CentStorage/modules/module[@name='purge']/interval[@unit='h']/text()" 53 #define PURGE_XPATH_TIME_D "/CentStorage/modules/module[@name='purge']/interval[@unit='d']/text()" 54 #define PURGE_XPATH_AGE_M "/CentStorage/modules/module[@name='purge']/age[@unit='month']/text()" 55 #define PURGE_XPATH_AGE_D "/CentStorage/modules/module[@name='purge']/age[@unit='day']/text()" 56 57 /* structure containing the configuration of the module purge */ 58 typedef struct Purge_s 59 { 60 int timeval; 61 int unit; 62 63 int age; 64 int ageUnit; 65 } Purge_t; 66 67 /* prototypes */ 68 /* 69 ** function purge is the "main" function of module purge, 70 ** the one called when the thread for module purge is created (see 71 ** man 3 pthread_create for more explainaition about pthread_create) 72 ** 73 ** @param int*: pointer to int, indicating the "position" in the 74 ** module table. The module table is defined in the core (file Conf.h) 75 ** and filed in runCentstorage.c 76 */ 25 77 void purge(int *); 26 78 79 /* 80 ** This function load the configuration of module purge from the configuration 81 ** file. If the file is incomplete default values are loaded for the missing 82 ** values. If the file is syntaxically incorrect default values are loaded. 83 ** 84 ** @param char *: path to the configuration file 85 ** @param int: flag indicating if informations must be log or not 86 ** @param int: "position" of the module in the module array 87 ** 88 ** return a pointer to a structure Purge_t, containing the module configuration 89 */ 90 Purge_t *loadPurgeConf(char *conf, int, int); 91 27 92 #endif /* PURGE_H_ */ -
trunk/centstorage/modules/recup_perf_datas/db_connection.h
r6185 r6244 75 75 #endif /* USE_ORACLE */ 76 76 77 78 77 #define MOD_NAME "recup_perf_datas" 79 78 -
trunk/centstorage/modules/recup_perf_datas/insertValInDataBase.c
r6209 r6244 68 68 extern void *db_connection; 69 69 extern int serverFailure; 70 extern pthread_mutex_t Access_DB; 70 71 71 72 #ifdef USE_MYSQL … … 94 95 int i, count; 95 96 char nbr[11]; 96 97 // serverFailure = 0; 97 unsigned char lock; 98 98 99 sprintf(client->cmd, "OK%d\n", client->nb_lines); 100 101 LOCK_MUTEX(&mutex); 102 lock = conf->dbLock; 103 UNLOCK_MUTEX(&mutex); 99 104 100 105 if (timeout && timeout < time(NULL)) -
trunk/centstorage/modules/recup_perf_datas/recup_perf_datas.c
r6122 r6244 57 57 #endif 58 58 59 void *db_connection = NULL;59 void *db_connection = NULL; 60 60 61 61 /* -
trunk/centstorage/src/Conf.c
r6209 r6244 216 216 } 217 217 218 tmp = getParam(XPATH_DB_LOCK(ROOT_ELEMENT), xmlConfContext, doc); 219 conf->dbLock = (tmp ? TRUE : FALSE); 220 if (tmp) 221 free(tmp); 218 222 219 223 loadBaseConf(xmlConfContext, doc); … … 225 229 #undef __DEBUG__ 226 230 #ifdef __DEBUG__ 227 printf("tim out:%d unit:%d\n", conf->timeout, conf->unit);231 printf("timeout:%d unit:%d\n", conf->timeout, conf->unit); 228 232 printf("archive: unit:%d time:%d use:%d\n", conf->logs->unit, 229 233 conf->logs->time, conf->logs->arch); -
trunk/centstorage/src/reloadConf.c
r5883 r6244 55 55 #include <extvar.h> 56 56 #include <runCentStorage.h> 57 58 pthread_mutex_t Access_DB = PTHREAD_MUTEX_INITIALIZER; 57 59 58 60 /* … … 200 202 201 203 reloadModules(saveConf); 202 204 203 205 /* this part is written to avoid some mmory leaks */ 204 206 if (conf->modules) -
trunk/centstorage/src/runCentStorage.c
r6209 r6244 52 52 /* setting the conf->flag_stop[i] to TRUE to indicate to the threads 53 53 they must quit. */ 54 // printf("Killing all threads:\n");55 54 for (i = 0; conf->modules[i].ModuleName; i++) 56 55 {
