]> git.sur5r.net Git - openldap/blobdiff - servers/slurpd/fm.c
changes in bdb_psearch() - search scope check
[openldap] / servers / slurpd / fm.c
index 75c1afed027b74da2036f8bc638b748c3adeab35..30ac5845d6428a5f073e816967dc942e97da02e9 100644 (file)
@@ -1,4 +1,8 @@
 /* $OpenLDAP$ */
+/*
+ * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
 /*
  * Copyright (c) 1996 Regents of the University of Michigan.
  * All rights reserved.
@@ -87,16 +91,26 @@ fm(
     while ( !sglob->slurpd_shutdown ) {
        if ( file_nonempty( sglob->slapd_replogfile )) {
            /* New work found - copy to slurpd replog file */
+#ifdef NEW_LOGGING
+       LDAP_LOG ( SLURPD, ARGS, 
+                       "fm: new work in %s\n", sglob->slapd_replogfile, 0, 0 );
+#else
            Debug( LDAP_DEBUG_ARGS, "new work in %s\n",
                    sglob->slapd_replogfile, 0, 0 );
+#endif
            if (( rc = copy_replog( sglob->slapd_replogfile,
                    sglob->slurpd_replogfile )) == 0 )  {
                populate_queue( sglob->slurpd_replogfile );
            } else {
                if ( rc < 0 ) {
+#ifdef NEW_LOGGING
+               LDAP_LOG ( SLURPD, CRIT, 
+                               "fm: Fatal error while copying replication log\n" , 0, 0, 0);
+#else
                    Debug( LDAP_DEBUG_ANY,
                            "Fatal error while copying replication log\n",
                            0, 0, 0 );
+#endif
                    sglob->slurpd_shutdown = 1;
                }
            }
@@ -112,16 +126,26 @@ fm(
            FILE *fp, *lfp;
            if (( rc = acquire_lock( sglob->slurpd_replogfile, &fp,
                    &lfp )) < 0 ) {
+#ifdef NEW_LOGGING
+               LDAP_LOG ( SLURPD, ERR, 
+                       "fm: Error: cannot acquire lock on \"%s\" for trimming\n",
+                       sglob->slurpd_replogfile, 0, 0 );
+#else
                Debug( LDAP_DEBUG_ANY,
                        "Error: cannot acquire lock on \"%s\" for trimming\n",
                        sglob->slurpd_replogfile, 0, 0 );
+#endif
            } else {
                sglob->rq->rq_write( sglob->rq, fp );
                (void) relinquish_lock( sglob->slurpd_replogfile, fp, lfp );
            }
        }
     }
+#ifdef NEW_LOGGING
+       LDAP_LOG ( SLURPD, RESULTS, "fm: exiting\n", 0, 0, 0 );
+#else
     Debug( LDAP_DEBUG_ARGS, "fm: exiting\n", 0, 0, 0 );
+#endif
     return NULL;
 }
 
@@ -144,7 +168,7 @@ set_shutdown(int sig)
        (sglob->replicas[ i ])->ri_wake( sglob->replicas[ i ]);
     }
     sglob->rq->rq_unlock( sglob->rq );                 /* unlock queue */
-    (void) SIGNAL( sig, set_shutdown );        /* reinstall handlers */
+    (void) SIGNAL_REINSTALL( sig, set_shutdown );      /* reinstall handlers */
 }
 
 
@@ -156,7 +180,7 @@ set_shutdown(int sig)
 RETSIGTYPE
 do_nothing(int sig)
 {
-    (void) SIGNAL( sig, do_nothing );
+    (void) SIGNAL_REINSTALL( sig, do_nothing );
 }
 
 
@@ -175,9 +199,15 @@ populate_queue(
     char       *p;
 
     if ( acquire_lock( f, &fp, &lfp ) < 0 ) {
+#ifdef NEW_LOGGING
+       LDAP_LOG ( SLURPD, ERR, 
+               "populate_queue: error: can't lock file \"%s\": %s\n", 
+               f, sys_errlist[ errno ], 0 );
+#else
        Debug( LDAP_DEBUG_ANY,
                "error: can't lock file \"%s\": %s\n",
                f, sys_errlist[ errno ], 0 );
+#endif
        return;
     }
 
@@ -186,9 +216,15 @@ populate_queue(
      * the queue.
      */
     if ( fseek( fp, sglob->srpos, 0 ) < 0 ) {
+#ifdef NEW_LOGGING
+       LDAP_LOG ( SLURPD, ERR, 
+               "populate_queue: error: can't seek to offset %ld in file \"%s\"\n", 
+               sglob->srpos, f, 0 );
+#else
        Debug( LDAP_DEBUG_ANY,
                "error: can't seek to offset %ld in file \"%s\"\n",
                sglob->srpos, f, 0 );
+#endif
     } else {
     while (( p = get_record( fp )) != NULL ) {
        if ( sglob->rq->rq_add( sglob->rq, p ) < 0 ) {
@@ -197,9 +233,15 @@ populate_queue(
            if (( t = strchr( p, '\n' )) != NULL ) {
                *t = '\0';
            }
+#ifdef NEW_LOGGING
+               LDAP_LOG ( SLURPD, ERR, 
+                       "populate_queue: error: malformed replog entry "
+                       "(begins with \"%s\")\n", p, 0, 0 );
+#else
            Debug( LDAP_DEBUG_ANY,
                    "error: malformed replog entry (begins with \"%s\")\n",
                    p, 0, 0 );
+#endif
        }
        free( p );
        ldap_pvt_thread_yield();