]> git.sur5r.net Git - openldap/blob - servers/slapd/back-ldbm/close.c
cleanup bind
[openldap] / servers / slapd / back-ldbm / close.c
1 /* close.c - close ldbm backend */
2 /* $OpenLDAP$ */
3 /*
4  * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
5  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
6  */
7
8 #include "portable.h"
9
10 #include <stdio.h>
11
12 #include <ac/socket.h>
13
14 #include "slap.h"
15 #include "back-ldbm.h"
16
17 int
18 ldbm_back_db_close( Backend *be )
19 {
20         struct ldbminfo *li = (struct ldbminfo *) be->be_private;
21         if ( li->li_dbsyncfreq > 0 )
22         {
23                 li->li_dbshutdown++;
24                 ldap_pvt_thread_join( li->li_dbsynctid, (void *) NULL );
25         }
26 #ifdef NEW_LOGGING
27         LDAP_LOG( BACK_LDBM, CRIT,
28                    "ldbm_back_db_close: ldbm backend syncing\n", 0, 0, 0 );
29 #else
30         Debug( LDAP_DEBUG_TRACE, "ldbm backend syncing\n", 0, 0, 0 );
31 #endif
32
33         ldbm_cache_flush_all( be );
34 #ifdef NEW_LOGGING
35         LDAP_LOG( BACK_LDBM, CRIT,
36                    "ldbm_back_db_close: ldbm backend synch'ed\n", 0, 0, 0 );
37 #else
38         Debug( LDAP_DEBUG_TRACE, "ldbm backend done syncing\n", 0, 0, 0 );
39 #endif
40
41
42         cache_release_all( &((struct ldbminfo *) be->be_private)->li_cache );
43
44         return 0;
45 }