docs/html/node40.html
8997c071
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
468b9e48
 
8997c071
 <!--Converted with LaTeX2HTML 2K.1beta (1.48)
468b9e48
 original version by:  Nikos Drakos, CBLU, University of Leeds
 * revised and updated by:  Marcus Hennecke, Ross Moore, Herb Swan
 * with significant contributions from:
   Jens Lippmann, Marek Rouchal, Martin Wilck and others -->
 <HTML>
 <HEAD>
8997c071
 <TITLE>Database reloading</TITLE>
 <META NAME="description" CONTENT="Database reloading">
468b9e48
 <META NAME="keywords" CONTENT="clamdoc">
 <META NAME="resource-type" CONTENT="document">
 <META NAME="distribution" CONTENT="global">
 
8997c071
 <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
 <META NAME="Generator" CONTENT="LaTeX2HTML v2K.1beta">
468b9e48
 <META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">
 
 <LINK REL="STYLESHEET" HREF="clamdoc.css">
 
8997c071
 <LINK REL="next" HREF="node45.html">
 <LINK REL="previous" HREF="node35.html">
 <LINK REL="up" HREF="node30.html">
468b9e48
 <LINK REL="next" HREF="node41.html">
 </HEAD>
 
 <BODY >
8997c071
 <!--Navigation Panel-->
 <A NAME="tex2html930"
468b9e48
   HREF="node41.html">
 <IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next"
  SRC="/usr/share/latex2html/icons/next.png"></A> 
8997c071
 <A NAME="tex2html926"
   HREF="node30.html">
468b9e48
 <IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up"
  SRC="/usr/share/latex2html/icons/up.png"></A> 
8997c071
 <A NAME="tex2html920"
468b9e48
   HREF="node39.html">
 <IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous"
  SRC="/usr/share/latex2html/icons/prev.png"></A> 
8997c071
 <A NAME="tex2html928"
468b9e48
   HREF="node1.html">
 <IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents"
  SRC="/usr/share/latex2html/icons/contents.png"></A>  
 <BR>
8997c071
 <B> Next:</B> <A NAME="tex2html931"
   HREF="node41.html">Data scan functions</A>
 <B> Up:</B> <A NAME="tex2html927"
   HREF="node30.html">LibClamAV</A>
 <B> Previous:</B> <A NAME="tex2html921"
   HREF="node39.html">Database structure</A>
  &nbsp <B>  <A NAME="tex2html929"
468b9e48
   HREF="node1.html">Contents</A></B> 
 <BR>
8997c071
 <BR>
468b9e48
 <!--End of Navigation Panel-->
 
8997c071
 <H2><A NAME="SECTION00074000000000000000">
 Database reloading</A>
468b9e48
 </H2>
8997c071
     The most important thing is to keep the internal instance of the database
     up to date. You can watch database changes with the <code>cl_stat</code>
     functions family.
     <PRE>
 	int cl_statinidir(const char *dirname, struct cl_stat *dbstat);
 	int cl_statchkdir(const struct cl_stat *dbstat);
 	int cl_statfree(struct cl_stat *dbstat);
 </PRE>
     Initialization:
     <PRE>
 	    ...
 	    struct cl_stat dbstat;
 
 	memset(&amp;dbstat, 0, sizeof(struct cl_stat));
 	cl_statinidir(dbdir, &amp;dbstat);
 </PRE>
     To check for a change you only need to call <code>cl_statchkdir</code>:
     <PRE>
 	if(cl_statchkdir(&amp;dbstat) == 1) {
 	    reload_database...;
 	    cl_statfree(&amp;dbstat);
 	    cl_statinidir(cl_retdbdir(), &amp;dbstat);
 	}
 </PRE>
     Remember to reinitialize the structure after reload.
468b9e48
 
 <P>
 <BR><HR>
8997c071
 <!--Table of Child-Links-->
 <A NAME="CHILD_LINKS"><STRONG>Subsections</STRONG></A>
 
 <UL>
 <LI><A NAME="tex2html932"
   HREF="node41.html">Data scan functions</A>
 <LI><A NAME="tex2html933"
   HREF="node42.html">Memory</A>
 <LI><A NAME="tex2html934"
   HREF="node43.html">clamav-config</A>
 <LI><A NAME="tex2html935"
   HREF="node44.html">Example</A>
 </UL>
 <!--End of Table of Child-Links-->
 <BR><HR>
468b9e48
 <ADDRESS>
 Tomasz Kojm
8997c071
 2004-09-20
468b9e48
 </ADDRESS>
 </BODY>
 </HTML>